GeographicLib-1.45/configure0000755000771000077100000212623212602735151015741 0ustar ckarneyckarney#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for GeographicLib 1.45. # # 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 charles@karney.com $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: 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='GeographicLib' PACKAGE_TARNAME='geographiclib' PACKAGE_VERSION='1.45' PACKAGE_STRING='GeographicLib 1.45' PACKAGE_BUGREPORT='charles@karney.com' PACKAGE_URL='' ac_unique_file="src/Geodesic.cpp" # 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 HAVE_PODPROGS_FALSE HAVE_PODPROGS_TRUE COL POD2HTML POD2MAN HAVE_DOXYGEN_FALSE HAVE_DOXYGEN_TRUE DOXYGEN CXXCPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC LT_AGE LT_REVISION LT_CURRENT MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE GEOGRAPHICLIB_VERSION_PATCH GEOGRAPHICLIB_VERSION_MINOR GEOGRAPHICLIB_VERSION_MAJOR 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_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build 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' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC CXXCPP' # 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 GeographicLib 1.45 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/geographiclib] --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] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of GeographicLib 1.45:";; 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-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --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) 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-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). 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 CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor 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 . _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 GeographicLib configure 1.45 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_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_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_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_cxx_try_run LINENO # ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_cxx_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_cxx_try_run 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 GeographicLib $as_me 1.45, 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_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$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\" \"$srcdir/..\" \"$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. # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version='1.14' # 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}" != 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='geographiclib' VERSION='1.45' 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. 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 GEOGRAPHICLIB_VERSION_MAJOR=1 GEOGRAPHICLIB_VERSION_MINOR=45 GEOGRAPHICLIB_VERSION_PATCH=0 cat >>confdefs.h <<_ACEOF #define GEOGRAPHICLIB_VERSION_MAJOR $GEOGRAPHICLIB_VERSION_MAJOR _ACEOF cat >>confdefs.h <<_ACEOF #define GEOGRAPHICLIB_VERSION_MINOR $GEOGRAPHICLIB_VERSION_MINOR _ACEOF cat >>confdefs.h <<_ACEOF #define GEOGRAPHICLIB_VERSION_PATCH $GEOGRAPHICLIB_VERSION_PATCH _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE ac_config_headers="$ac_config_headers include/GeographicLib/Config-ac.h" LT_CURRENT=16 LT_REVISION=1 LT_AGE=2 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # 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 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 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 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 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 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 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.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # 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 "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; 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 "$with_gnu_ld" = yes; 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 case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) 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 "$lt_cv_path_NM" != "no"; 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 /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) 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; } { $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 # 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; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # 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"; 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 $i != 17 # 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"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } 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 "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; 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 # which 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. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && 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 ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; 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) 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*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; 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 ;; 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 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 "$ac_status" -eq 0; 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 "$ac_status" -ne 0; 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 "x$lt_cv_ar_at_file" = xno; 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 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 "$host_cpu" = ia64; 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 # 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 -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$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 -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/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 # and D for any global 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};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print 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 con'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* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$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 "$pipe_works" = yes; 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 "$GCC" = yes; 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; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && 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 which ABI we are using. 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 which ABI we are using. 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 "$lt_cv_prog_gnu_ld" = yes; 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* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. 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*) LD="${LD-ld} -m elf_i386" ;; 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 x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. 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*) 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 "x$lt_cv_path_mainfest_tool" != xyes; 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 $_lt_result -eq 0; 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 $_lt_result -eq 0 && $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 "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; 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 "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac { $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 test -z "$pic_mode" && pic_mode=default # 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 # 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 "X${COLLECT_NAMES+set}" != Xset; 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 for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # 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 "$GCC" = yes; 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" # 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 x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; 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 "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; 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' ;; 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 "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; 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' ;; 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) 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' ;; 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 which 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" # 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 x"$lt_cv_prog_compiler_pic_works" = xyes; 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 x"$lt_cv_prog_compiler_static_works" = xyes; 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 "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; 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 "$hard_links" = no; 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 "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) 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 "$with_gnu_ld" = yes; 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 "$lt_use_gnu_ld_interface" = yes; 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 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 "$host_cpu" != ia64; 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 (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; 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 ;; 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 "$host_os" = linux-dietlibc; 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 "$tmp_diet" = no 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' ;; 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 "x$supports_anon_versioning" = xyes; 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 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 "x$supports_anon_versioning" = xyes; 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 can not *** 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 "$ld_shlibs" = no; 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 "$GCC" = yes && 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 "$host_cpu" = ia64; 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 AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". 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) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | 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 # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; 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,' if test "$GCC" = yes; 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 "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; 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 "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi 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_use_runtimelinking" = yes; 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 "${lt_cv_aix_libpath+set}" = 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 "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; 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 "${lt_cv_aix_libpath+set}" = 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 "$with_gnu_ld" = yes; 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 # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' 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~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $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 "$lt_cv_ld_force_load" = "yes"; 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*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; 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 "$GCC" = yes; 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 $output_objdir/$soname = $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 $output_objdir/$soname = $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 "$GCC" = yes && test "$with_gnu_ld" = no; 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 "$with_gnu_ld" = no; 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 "$GCC" = yes && test "$with_gnu_ld" = no; 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 x"$lt_cv_prog_compiler__b" = xyes; 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 "$with_gnu_ld" = no; 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 "$GCC" = yes; 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 "$lt_cv_irix_exported_symbol" = yes; 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 ;; 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*) 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__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; 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 case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; 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 "$GCC" = yes; 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 "$GCC" = yes; 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 "$GCC" = yes; 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 "x$host_vendor" = xsequent; 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 "$GCC" = yes; 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 can NOT 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 "$GCC" = yes; 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 x$host_vendor = xsni; 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 "$ld_shlibs" = no && 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 "$enable_shared" = yes && test "$GCC" = yes; 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 "$GCC" = yes; 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` 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" else 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 "$host_cpu" = ia64; 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 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # 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}' else # 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' fi 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%'\''`; test $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} $libname${shared_ext}' 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 ;; 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' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; 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=yes 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 "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; 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 "$lt_cv_prog_gnu_ld" = yes; 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 ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-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 # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents 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="$sys_lib_dlsearch_path_spec $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*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac 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 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; 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 "$with_gnu_ld" = yes; 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=freebsd-elf 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 "$with_gnu_ld" = yes; 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 "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $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 "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # 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 "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; 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 "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; 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 ;; *) 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 "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && 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 "$cross_compiling" = yes; 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 -fvisbility=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 "x$lt_cv_dlopen_self" = xyes; 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 "$cross_compiling" = yes; 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 -fvisbility=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 which 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 "$can_build_shared" = "no" && 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 "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no 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 "$enable_shared" = yes || 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 "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; 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 "$_lt_caught_CXX_error" != yes; 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 for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; 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 "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; 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 "$with_gnu_ld" = yes; 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 "$with_gnu_ld" = yes; 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 "$host_cpu" = ia64; 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 # need to do runtime linking. 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 ;; 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,' if test "$GXX" = yes; 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 "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; 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 "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi 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_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. if test "${lt_cv_aix_libpath+set}" = 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 "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; 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 "${lt_cv_aix_libpath+set}" = 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 "$with_gnu_ld" = yes; 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 # This is similar to how AIX traditionally builds its shared # libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' 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~linknames=' archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $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 (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; 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 "$lt_cv_ld_force_load" = "yes"; 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*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; 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 "$lt_cv_apple_cc_single_mod" != "yes"; 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 ;; 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 ;; gnu*) ;; 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 $output_objdir/$soname = $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 "$GXX" = yes; 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 $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; 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 "$GXX" = yes; then if test $with_gnu_ld = no; 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 "$GXX" = yes; then if test "$with_gnu_ld" = no; 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) 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 "x$supports_anon_versioning" = xyes; 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 ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) 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__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; 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 "$GXX" = yes && test "$with_gnu_ld" = no; 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 "$GXX" = yes && test "$with_gnu_ld" = no; 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 $LDFLAGS $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 -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 $LDFLAGS $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 -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 can NOT 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 "$ld_shlibs_CXX" = no && 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 $p = "-L" || test $p = "-R"; 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 "$pre_test_object_deps_done" = no; 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 "$pre_test_object_deps_done" = no; 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= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; 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 "$GXX" = yes; 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 "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; 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' ;; 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 "$host_cpu" = ia64; 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 "$host_cpu" != ia64; 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) 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 which 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" # 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 x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; 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 x"$lt_cv_prog_compiler_static_works_CXX" = xyes; 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 "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; 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 "$hard_links" = no; 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 AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". 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) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | 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 "$ld_shlibs_CXX" = no && 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 "$enable_shared" = yes && test "$GCC" = yes; 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 "$host_cpu" = ia64; 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 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # 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}' else # 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' fi 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%'\''`; test $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} $libname${shared_ext}' 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 ;; 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' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; 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=yes 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 "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; 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 "$lt_cv_prog_gnu_ld" = yes; 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 ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-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 # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents 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="$sys_lib_dlsearch_path_spec $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*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac 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 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; 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 "$with_gnu_ld" = yes; 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=freebsd-elf 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 "$with_gnu_ld" = yes; 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 "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $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 "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_CXX" != no && # 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 "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; 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 "$hardcode_action_CXX" = relink || test "$inherit_rpath_CXX" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; 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 "$_lt_caught_CXX_error" != yes 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: 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 # Checks for long double { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double" >&5 $as_echo_n "checking for long double... " >&6; } if ${ac_cv_type_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if test "$GCC" = yes; then ac_cv_type_long_double=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* The Stardent Vistra knows sizeof (long double), but does not support it. */ long double foo = 0.0L; int main () { static int test_array [1 - 2 * !(/* On Ultrix 4.3 cc, long double is 4 and double is 8. */ sizeof (double) <= sizeof (long double))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_type_long_double=yes else ac_cv_type_long_double=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double" >&5 $as_echo "$ac_cv_type_long_double" >&6; } if test $ac_cv_type_long_double = yes; then $as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h fi # Check endianness { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no 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 if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no 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 if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_cxx_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes 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_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac # Check flags for C++11 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -std=c++11" >&5 $as_echo_n "checking whether C++ compiler accepts -std=c++11... " >&6; } if ${ax_cv_check_cxxflags___std_cpp11+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -std=c++11" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ax_cv_check_cxxflags___std_cpp11=yes else ax_cv_check_cxxflags___std_cpp11=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___std_cpp11" >&5 $as_echo "$ax_cv_check_cxxflags___std_cpp11" >&6; } if test "x$ax_cv_check_cxxflags___std_cpp11" = xyes; then : CXXFLAGS="$CXXFLAGS -std=c++11" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -std=c++0x" >&5 $as_echo_n "checking whether C++ compiler accepts -std=c++0x... " >&6; } if ${ax_cv_check_cxxflags___std_cpp0x+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -std=c++0x" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ax_cv_check_cxxflags___std_cpp0x=yes else ax_cv_check_cxxflags___std_cpp0x=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___std_cpp0x" >&5 $as_echo "$ax_cv_check_cxxflags___std_cpp0x" >&6; } if test "x$ax_cv_check_cxxflags___std_cpp0x" = xyes; then : CXXFLAGS="$CXXFLAGS -std=c++0x" else : fi fi # Check for C++11 math functions cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int q; return int(std::hypot(3.0, 4.0) + std::expm1(0.5) + std::log1p(2.0) + std::asinh(10.0) + std::atanh(0.8) + std::cbrt(8.0) + std::fma(1.0, 2.0, 3.0) + std::remquo(100.0, 90.0, &q) + std::remainder(100.0, 90.0)) + std::isfinite(4.0) + std::isnan(0.0); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : CXXFLAGS="$CXXFLAGS -DGEOGRAPHICLIB_CXX11_MATH=1" else CXXFLAGS="$CXXFLAGS -DGEOGRAPHICLIB_CXX11_MATH=0" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Check for doxygen. Version 1.8.7 or later needed for … for ac_prog in doxygen 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_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DOXYGEN"; then ac_cv_prog_DOXYGEN="$DOXYGEN" # 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_DOXYGEN="$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 DOXYGEN=$ac_cv_prog_DOXYGEN if test -n "$DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 $as_echo "$DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DOXYGEN" && break done if test "$DOXYGEN" && test `"$DOXYGEN" --version | sed 's/\b\([0-9]\)\b/0\1/g'` '>' 01.08.06.99; then HAVE_DOXYGEN_TRUE= HAVE_DOXYGEN_FALSE='#' else HAVE_DOXYGEN_TRUE='#' HAVE_DOXYGEN_FALSE= fi for ac_prog in pod2man 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_POD2MAN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$POD2MAN"; then ac_cv_prog_POD2MAN="$POD2MAN" # 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_POD2MAN="$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 POD2MAN=$ac_cv_prog_POD2MAN if test -n "$POD2MAN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $POD2MAN" >&5 $as_echo "$POD2MAN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$POD2MAN" && break done for ac_prog in pod2html 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_POD2HTML+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$POD2HTML"; then ac_cv_prog_POD2HTML="$POD2HTML" # 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_POD2HTML="$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 POD2HTML=$ac_cv_prog_POD2HTML if test -n "$POD2HTML"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $POD2HTML" >&5 $as_echo "$POD2HTML" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$POD2HTML" && break done for ac_prog in col 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_COL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$COL"; then ac_cv_prog_COL="$COL" # 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_COL="$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 COL=$ac_cv_prog_COL if test -n "$COL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COL" >&5 $as_echo "$COL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$COL" && break done if test "$POD2MAN" -a "$POD2HTML" -a "$COL"; then HAVE_PODPROGS_TRUE= HAVE_PODPROGS_FALSE='#' else HAVE_PODPROGS_TRUE='#' HAVE_PODPROGS_FALSE= fi ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile tools/Makefile doc/Makefile js/Makefile man/Makefile matlab/Makefile python/Makefile cmake/Makefile examples/Makefile" 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= U= 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 "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 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_DOXYGEN_TRUE}" && test -z "${HAVE_DOXYGEN_FALSE}"; then as_fn_error $? "conditional \"HAVE_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_PODPROGS_TRUE}" && test -z "${HAVE_PODPROGS_FALSE}"; then as_fn_error $? "conditional \"HAVE_PODPROGS\" 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 GeographicLib $as_me 1.45, 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 ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ GeographicLib config.status 1.45 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" ac_aux_dir="$ac_aux_dir" # 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"`' 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_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"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $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"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $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_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ 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\\"\\\`\\\\\\"" ;; *) 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 \ sys_lib_dlsearch_path_spec \ 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\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which 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' TIMESTAMP='$TIMESTAMP' 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 "include/GeographicLib/Config-ac.h") CONFIG_HEADERS="$CONFIG_HEADERS include/GeographicLib/Config-ac.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "js/Makefile") CONFIG_FILES="$CONFIG_FILES js/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "matlab/Makefile") CONFIG_FILES="$CONFIG_FILES matlab/Makefile" ;; "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;; "cmake/Makefile") CONFIG_FILES="$CONFIG_FILES cmake/Makefile" ;; "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; *) 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. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which 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 # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $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. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="CXX " # ### 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 # 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 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 # 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 in which our libraries should be installed. lt_sysroot=$lt_sysroot # 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 # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # 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 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 "X${COLLECT_NAMES+set}" != Xset; 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) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi 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 GeographicLib-1.45/java/direct/pom.xml0000644000771000077100000000505112602735126017535 0ustar ckarneyckarney 4.0.0 net.sf.geographiclib.example Direct Direct 1.45-SNAPSHOT jar . 1.6 2.9 UTF-8 2.3.2 2.4 2.8 3.0 net.sf.geographiclib GeographicLib-Java 1.45 org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} ${java.version} ${java.version} org.apache.maven.plugins maven-surefire-plugin ${surefire-plugin.version} false org.apache.maven.plugins maven-javadoc-plugin ${maven-javadoc.version} public true attach-javadocs jar org.codehaus.mojo exec-maven-plugin 1.2.1 Direct GeographicLib-1.45/java/direct/src/main/java/Direct.java0000644000771000077100000000161712602735126022735 0ustar ckarneyckarney/** * A test program for the GeographicLib.Geodesic.Direct method **********************************************************************/ import java.util.*; import net.sf.geographiclib.*; public class Direct { /** * Solve the direct geodesic problem. * * This program reads in lines with lat1, lon1, azi1, s12 and prints out lines * with lat2, lon2, azi2 (for the WGS84 ellipsoid). **********************************************************************/ public static void main(String[] args) { try { Scanner in = new Scanner(System.in); double lat1, lon1, azi1, s12; while (true) { lat1 = in.nextDouble(); lon1 = in.nextDouble(); azi1 = in.nextDouble(); s12 = in.nextDouble(); GeodesicData g = Geodesic.WGS84.Direct(lat1, lon1, azi1, s12); System.out.println(g.lat2 + " " + g.lon2 + " " + g.azi2); } } catch (Exception e) {} } } GeographicLib-1.45/java/inverse/pom.xml0000644000771000077100000000505412602735126017741 0ustar ckarneyckarney 4.0.0 net.sf.geographiclib.example Inverse Inverse 1.45-SNAPSHOT jar . 1.6 2.9 UTF-8 2.3.2 2.4 2.8 3.0 net.sf.geographiclib GeographicLib-Java 1.45 org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} ${java.version} ${java.version} org.apache.maven.plugins maven-surefire-plugin ${surefire-plugin.version} false org.apache.maven.plugins maven-javadoc-plugin ${maven-javadoc.version} public true attach-javadocs jar org.codehaus.mojo exec-maven-plugin 1.2.1 Inverse GeographicLib-1.45/java/inverse/src/main/java/Inverse.java0000644000771000077100000000162512602735126023336 0ustar ckarneyckarney/** * A test program for the GeographicLib.Geodesic.Inverse method **********************************************************************/ import java.util.*; import net.sf.geographiclib.*; /** * Solve the inverse geodesic problem. * * This program reads in lines with lat1, lon1, lat2, lon2 and prints out lines * with azi1, azi2, s12 (for the WGS84 ellipsoid). **********************************************************************/ public class Inverse { public static void main(String[] args) { try { Scanner in = new Scanner(System.in); double lat1, lon1, lat2, lon2; while (true) { lat1 = in.nextDouble(); lon1 = in.nextDouble(); lat2 = in.nextDouble(); lon2 = in.nextDouble(); GeodesicData g = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2); System.out.println(g.azi1 + " " + g.azi2 + " " + g.s12); } } catch (Exception e) {} } } GeographicLib-1.45/java/README.txt0000644000771000077100000000130712602735126016444 0ustar ckarneyckarneyThis is a Java implementation of the geodesic algorithms described in C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); https://dx.doi.org/10.1007/s00190-012-0578-z Addenda: http://geographiclib.sf.net/geod-addenda.html For documentation, see http://geographiclib.sourceforge.net/html/java/ The code in this directory is entirely self-contained. In particular, it does not depend on the C++ classes. You can build the example programs using, for example, cd inverse/src/main/java javac -cp .:../../../../src/main/java Inverse.java echo -30 0 29.5 179.5 | java -cp .:../../../../src/main/java Inverse Building with maven is also supported (see the documentation). GeographicLib-1.45/java/pom.xml0000644000771000077100000001220612602735126016263 0ustar ckarneyckarney 4.0.0 net.sf.geographiclib GeographicLib-Java 1.45 jar The MIT License(MIT) http://opensource.org/licenses/MIT Java implementation of GeographicLib This is a Java implementation of the geodesic algorithms from GeographicLib. This is a self-contained library which makes it easy to do geodesic computations for an ellipsoid of revolution in a Java program. It requires Java version 1.1 or later. http://geographiclib.sf.net Charles Karney charles@karney.com http://sourceforge.net/u/karney/profile/ . 1.6 2.9 UTF-8 2.3.2 2.4 2.8 3.0 org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} ${java.version} ${java.version} org.apache.maven.plugins maven-surefire-plugin ${surefire-plugin.version} false release org.apache.maven.plugins maven-javadoc-plugin ${maven-javadoc.version} public true attach-javadocs jar org.apache.maven.plugins maven-source-plugin 2.2.1 attach-sources jar-no-fork org.sonatype.plugins nexus-staging-maven-plugin 1.6.3 true ossrh https://oss.sonatype.org/ true org.apache.maven.plugins maven-gpg-plugin 1.5 sign-artifacts verify sign ossrh https://oss.sonatype.org/content/repositories/snapshots ossrh https://oss.sonatype.org/service/local/staging/deploy/maven2 scm:git://git.code.sf.net/p/geographiclib/code scm:git:http://git.code.sf.net/p/geographiclib/code http://sourceforge.net/p/geographiclib/code/ci/master/tree/ junit junit 4.12 GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/GeodesicData.java0000644000771000077100000000576112602735126026566 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeodesicData class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * The results of geodesic calculations. * * This is used to return the results for a geodesic between point 1 * (lat1, lon1) and point 2 (lat2, lon2). Fields * that have not been set will be filled with Double.NaN. The returned * GeodesicData objects always include the parameters provided to {@link * Geodesic#Direct(double, double, double, double) Geodesic.Direct} and {@link * Geodesic#Inverse(double, double, double, double) Geodesic.Inverse} and it * always includes the field a12. **********************************************************************/ public class GeodesicData { /** * latitude of point 1 (degrees). **********************************************************************/ public double lat1; /** * longitude of point 1 (degrees). **********************************************************************/ public double lon1; /** * azimuth at point 1 (degrees). **********************************************************************/ public double azi1; /** * latitude of point 2 (degrees). **********************************************************************/ public double lat2; /** * longitude of point 2 (degrees). **********************************************************************/ public double lon2; /** * azimuth at point 2 (degrees). **********************************************************************/ public double azi2; /** * distance between point 1 and point 2 (meters). **********************************************************************/ public double s12; /** * arc length on the auxiliary sphere between point 1 and point 2 * (degrees). **********************************************************************/ public double a12; /** * reduced length of geodesic (meters). **********************************************************************/ public double m12; /** * geodesic scale of point 2 relative to point 1 (dimensionless). **********************************************************************/ public double M12; /** * geodesic scale of point 1 relative to point 2 (dimensionless). **********************************************************************/ public double M21; /** * area under the geodesic (meters2). **********************************************************************/ public double S12; /** * Initialize all the fields to Double.NaN. **********************************************************************/ public GeodesicData() { lat1 = lon1 = azi1 = lat2 = lon2 = azi2 = s12 = a12 = m12 = M12 = M21 = S12 = Double.NaN; } } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/Geodesic.java0000644000771000077100000021047512602735126025774 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Geodesic class * * Copyright (c) Charles Karney (2013-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * Geodesic calculations. *

* The shortest path between two points on a ellipsoid at (lat1, * lon1) and (lat2, lon2) is called the geodesic. Its * length is s12 and the geodesic from point 1 to point 2 has azimuths * azi1 and azi2 at the two end points. (The azimuth is the * heading measured clockwise from north. azi2 is the "forward" * azimuth, i.e., the heading that takes you beyond point 2 not back to point * 1.) *

* Given lat1, lon1, azi1, and s12, we can * determine lat2, lon2, and azi2. This is the * direct geodesic problem and its solution is given by the function * {@link #Direct Direct}. (If s12 is sufficiently large that the * geodesic wraps more than halfway around the earth, there will be another * geodesic between the points with a smaller s12.) *

* Given lat1, lon1, lat2, and lon2, we can * determine azi1, azi2, and s12. This is the * inverse geodesic problem, whose solution is given by {@link #Inverse * Inverse}. Usually, the solution to the inverse problem is unique. In cases * where there are multiple solutions (all with the same s12, of * course), all the solutions can be easily generated once a particular * solution is provided. *

* The standard way of specifying the direct problem is the specify the * distance s12 to the second point. However it is sometimes useful * instead to specify the arc length a12 (in degrees) on the auxiliary * sphere. This is a mathematical construct used in solving the geodesic * problems. The solution of the direct problem in this form is provided by * {@link #ArcDirect ArcDirect}. An arc length in excess of 180° indicates * that the geodesic is not a shortest path. In addition, the arc length * between an equatorial crossing and the next extremum of latitude for a * geodesic is 90°. *

* This class can also calculate several other quantities related to * geodesics. These are: *

    *
  • * reduced length. If we fix the first point and increase * azi1 by dazi1 (radians), the second point is displaced * m12 dazi1 in the direction azi2 + 90°. The * quantity m12 is called the "reduced length" and is symmetric under * interchange of the two points. On a curved surface the reduced length * obeys a symmetry relation, m12 + m21 = 0. On a flat * surface, we have m12 = s12. The ratio s12/m12 * gives the azimuthal scale for an azimuthal equidistant projection. *
  • * geodesic scale. Consider a reference geodesic and a second * geodesic parallel to this one at point 1 and separated by a small distance * dt. The separation of the two geodesics at point 2 is M12 * dt where M12 is called the "geodesic scale". M21 is * defined similarly (with the geodesics being parallel at point 2). On a * flat surface, we have M12 = M21 = 1. The quantity * 1/M12 gives the scale of the Cassini-Soldner projection. *
  • * area. The area between the geodesic from point 1 to point 2 and * the equation is represented by S12; it is the area, measured * counter-clockwise, of the geodesic quadrilateral with corners * (lat1,lon1), (0,lon1), (0,lon2), and * (lat2,lon2). It can be used to compute the area of any * simple geodesic polygon. *
*

* The quantities m12, M12, M21 which all specify the * behavior of nearby geodesics obey addition rules. If points 1, 2, and 3 all * lie on a single geodesic, then the following rules hold: *

    *
  • * s13 = s12 + s23 *
  • * a13 = a12 + a23 *
  • * S13 = S12 + S23 *
  • * m13 = m12 M23 + m23 M21 *
  • * M13 = M12 M23 − (1 − M12 * M21) m23 / m12 *
  • * M31 = M32 M21 − (1 − M23 * M32) m12 / m23 *
*

* The results of the geodesic calculations are bundled up into a {@link * GeodesicData} object which includes the input parameters and all the * computed results, i.e., lat1, lon1, azi1, lat2, * lon2, azi2, s12, a12, m12, M12, * M21, S12. *

* The functions {@link #Direct(double, double, double, double, int) Direct}, * {@link #ArcDirect(double, double, double, double, int) ArcDirect}, and * {@link #Inverse(double, double, double, double, int) Inverse} include an * optional final argument outmask which allows you specify which * results should be computed and returned. If you omit outmask, then * the "standard" geodesic results are computed (latitudes, longitudes, * azimuths, and distance). outmask is bitor'ed combination of {@link * GeodesicMask} values. For example, if you wish just to compute the distance * between two points you would call, e.g., *

 * {@code
 *  GeodesicData g = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2,
 *                      GeodesicMask.DISTANCE); }
*

* Additional functionality is provided by the {@link GeodesicLine} class, * which allows a sequence of points along a geodesic to be computed. *

* 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: *

    *
  • * lat1 = −lat2 (with neither point at a pole). If * azi1 = azi2, the geodesic is unique. Otherwise there are * two geodesics and the second one is obtained by setting [azi1, * azi2] → [azi2, azi1], [M12, M21] * → [M21, M12], S12 → −S12. * (This occurs when the longitude difference is near ±180° for * oblate ellipsoids.) *
  • * lon2 = lon1 ± 180° (with neither point at a * pole). If azi1 = 0° or ±180°, the geodesic is * unique. Otherwise there are two geodesics and the second one is obtained * by setting [ azi1, azi2] → [−azi1, * −azi2], S12 → − S12. (This occurs * when lat2 is near −lat1 for prolate ellipsoids.) *
  • * Points 1 and 2 at opposite poles. There are infinitely many geodesics * which can be generated by setting [azi1, azi2] → * [azi1, azi2] + [d, −d], for arbitrary * d. (For spheres, this prescription applies when points 1 and 2 are * antipodal.) *
  • * s12 = 0 (coincident points). There are infinitely many geodesics which * can be generated by setting [azi1, azi2] → * [azi1, azi2] + [d, d], for arbitrary d. *
*

* The calculations are accurate to better than 15 nm (15 nanometers) for the * WGS84 ellipsoid. See Sec. 9 of * arXiv:1102.1215v1 for * details. The algorithms used by this class are based on series expansions * using the flattening f as a small parameter. These are only accurate * for |f| < 0.02; however reasonably accurate results will be * obtained for |f| < 0.2. Here is a table of the approximate * maximum error (expressed as a distance) for an ellipsoid with the same * major radius as the WGS84 ellipsoid and different values of the * flattening.

 *     |f|      error
 *     0.01     25 nm
 *     0.02     30 nm
 *     0.05     10 um
 *     0.1     1.5 mm
 *     0.2     300 mm 
*

* The algorithms are described in *

*

* Example of use: *

 * {@code
 * // Solve the direct geodesic problem.
 *
 * // This program reads in lines with lat1, lon1, azi1, s12 and prints
 * // out lines with lat2, lon2, azi2 (for the WGS84 ellipsoid).
 *
 * import java.util.*;
 * import net.sf.geographiclib.*;
 * public class Direct {
 *   public static void main(String[] args) {
 *     try {
 *       Scanner in = new Scanner(System.in);
 *       double lat1, lon1, azi1, s12;
 *       while (true) {
 *         lat1 = in.nextDouble(); lon1 = in.nextDouble();
 *         azi1 = in.nextDouble(); s12 = in.nextDouble();
 *         GeodesicData g = Geodesic.WGS84.Direct(lat1, lon1, azi1, s12);
 *         System.out.println(g.lat2 + " " + g.lon2 + " " + g.azi2);
 *       }
 *     }
 *     catch (Exception e) {}
 *   }
 * }}
**********************************************************************/ public class Geodesic { /** * The order of the expansions used by Geodesic. **********************************************************************/ protected static final int GEOGRAPHICLIB_GEODESIC_ORDER = 6; protected static final int nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nA3x_ = nA3_; protected static final int nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC3x_ = (nC3_ * (nC3_ - 1)) / 2; protected static final int nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC4x_ = (nC4_ * (nC4_ + 1)) / 2; private static final int maxit1_ = 20; private static final int maxit2_ = maxit1_ + GeoMath.digits + 10; // Underflow guard. We require // tiny_ * epsilon() > 0 // tiny_ + epsilon() == epsilon() protected static final double tiny_ = Math.sqrt(GeoMath.min); private static final double tol0_ = GeoMath.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) private static final double tol1_ = 200 * tol0_; private static final double tol2_ = Math.sqrt(tol0_); // Check on bisection interval private static final double tolb_ = tol0_ * tol2_; private static final double xthresh_ = 1000 * tol2_; protected double _a, _f, _f1, _e2, _ep2, _b, _c2; private double _n, _etol2; private double _A3x[], _C3x[], _C4x[]; /** * Constructor for a ellipsoid with *

* @param a equatorial radius (meters). * @param f flattening of ellipsoid. Setting f = 0 gives a sphere. * Negative f gives a prolate ellipsoid. * @exception GeographicErr if a or (1 − f ) a is * not positive. **********************************************************************/ public Geodesic(double a, double f) { _a = a; _f = f <= 1 ? f : 1/f; // f > 1 behavior is DEPRECATED _f1 = 1 - _f; _e2 = _f * (2 - _f); _ep2 = _e2 / GeoMath.sq(_f1); // e2 / (1 - e2) _n = _f / ( 2 - _f); _b = _a * _f1; _c2 = (GeoMath.sq(_a) + GeoMath.sq(_b) * (_e2 == 0 ? 1 : (_e2 > 0 ? GeoMath.atanh(Math.sqrt(_e2)) : Math.atan(Math.sqrt(-_e2))) / Math.sqrt(Math.abs(_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. _etol2 = 0.1 * tol2_ / Math.sqrt( Math.max(0.001, Math.abs(_f)) * Math.min(1.0, 1 - _f/2) / 2 ); if (!(GeoMath.isfinite(_a) && _a > 0)) throw new GeographicErr("Major radius is not positive"); if (!(GeoMath.isfinite(_b) && _b > 0)) throw new GeographicErr("Minor radius is not positive"); _A3x = new double[nA3x_]; _C3x = new double[nC3x_]; _C4x = new double[nC4x_]; A3coeff(); C3coeff(); C4coeff(); } /** * Solve the direct geodesic problem where the length of the geodesic * is specified in terms of distance. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param s12 distance between point 1 and point 2 (meters); it can be * negative. * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. *

* lat1 should be in the range [−90°, 90°]. The values * of lon2 and azi2 returned are in the range [−180°, * 180°). *

* If either point is at a pole, the azimuth is defined by keeping the * longitude fixed, writing 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°.) **********************************************************************/ public GeodesicData Direct(double lat1, double lon1, double azi1, double s12) { return Direct(lat1, lon1, azi1, false, s12, GeodesicMask.STANDARD); } /** * Solve the direct geodesic problem where the length of the geodesic is * specified in terms of distance and with a subset of the geodesic results * returned. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param s12 distance between point 1 and point 2 (meters); it can be * negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the fields specified by * outmask computed. *

* lat1, lon1, azi1, s12, and a12 are * always included in the returned result. The value of lon2 returned * is in the range [−180°, 180°), unless the outmask * includes the {@link GeodesicMask#LONG_UNROLL} flag. **********************************************************************/ public GeodesicData Direct(double lat1, double lon1, double azi1, double s12, int outmask) { return Direct(lat1, lon1, azi1, false, s12, outmask); } /** * Solve the direct geodesic problem where the length of the geodesic * is specified in terms of arc length. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param a12 arc length between point 1 and point 2 (degrees); it can * be negative. * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. *

* lat1 should be in the range [−90°, 90°]. The values * of lon2 and azi2 returned are in the range [−180°, * 180°). *

* If either point is at a pole, the azimuth is defined by keeping the * longitude fixed, writing 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°.) **********************************************************************/ public GeodesicData ArcDirect(double lat1, double lon1, double azi1, double a12) { return Direct(lat1, lon1, azi1, true, a12, GeodesicMask.STANDARD); } /** * Solve the direct geodesic problem where the length of the geodesic is * specified in terms of arc length and with a subset of the geodesic results * returned. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param a12 arc length between point 1 and point 2 (degrees); it can * be negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the fields specified by * outmask computed. *

* lat1, lon1, azi1, and a12 are always included * in the returned result. The value of lon2 returned is in the range * [−180°, 180°), unless the outmask includes the {@link * GeodesicMask#LONG_UNROLL} flag. **********************************************************************/ public GeodesicData ArcDirect(double lat1, double lon1, double azi1, double a12, int outmask) { return Direct(lat1, lon1, azi1, true, a12, outmask); } /** * The general direct geodesic problem. {@link #Direct Direct} and * {@link #ArcDirect ArcDirect} are defined in terms of this function. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param arcmode boolean flag determining the meaning of the * s12_a12. * @param s12_a12 if arcmode is false, this is the distance between * point 1 and point 2 (meters); otherwise it is the arc length between * point 1 and point 2 (degrees); it can be negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the fields specified by * outmask computed. *

* The {@link GeodesicMask} values possible for outmask are *

    *
  • * outmask |= GeodesicMask.LATITUDE for the latitude lat2; *
  • * outmask |= GeodesicMask.LONGITUDE for the latitude lon2; *
  • * outmask |= GeodesicMask.AZIMUTH for the latitude azi2; *
  • * outmask |= GeodesicMask.DISTANCE for the distance s12; *
  • * outmask |= GeodesicMask.REDUCEDLENGTH for the reduced length * m12; *
  • * outmask |= GeodesicMask.GEODESICSCALE for the geodesic scales * M12 and M21; *
  • * outmask |= GeodesicMask.AREA for the area S12; *
  • * outmask |= GeodesicMask.ALL for all of the above; *
  • * outmask |= GeodesicMask.LONG_UNROLL, if set then lon1 is * unchanged and lon2lon1 indicates how many times * and in what sense the geodesic encircles the ellipsoid. Otherwise * lon1 and lon2 are both reduced to the range * [−180°, 180°). *
*

* The function value a12 is always computed and returned and this * equals s12_a12 is arcmode is true. If outmask * includes {@link GeodesicMask#DISTANCE} and arcmode is false, then * s12 = s12_a12. It is not necessary to include {@link * GeodesicMask#DISTANCE_IN} in outmask; this is automatically * included is arcmode is false. **********************************************************************/ public GeodesicData Direct(double lat1, double lon1, double azi1, boolean arcmode, double s12_a12, int outmask) { return new GeodesicLine(this, lat1, lon1, azi1, // Automatically supply DISTANCE_IN if necessary outmask | (arcmode ? GeodesicMask.NONE : GeodesicMask.DISTANCE_IN)) . // Note the dot! Position(arcmode, s12_a12, outmask); } /** * Solve the inverse geodesic problem. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param lat2 latitude of point 2 (degrees). * @param lon2 longitude of point 2 (degrees). * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. *

* lat1 and lat2 should be in the range [−90°, * 90°]. The values of azi1 and azi2 returned are in the * range [−180°, 180°). *

* If either point is at a pole, the azimuth is defined by keeping the * longitude fixed, writing lat = ±(90° − ε), * 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. **********************************************************************/ public GeodesicData Inverse(double lat1, double lon1, double lat2, double lon2) { return Inverse(lat1, lon1, lat2, lon2, GeodesicMask.STANDARD); } /** * Solve the inverse geodesic problem with a subset of the geodesic results * returned. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param lat2 latitude of point 2 (degrees). * @param lon2 longitude of point 2 (degrees). * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the fields specified by * outmask computed. *

* The {@link GeodesicMask} values possible for outmask are *

    *
  • * outmask |= GeodesicMask.DISTANCE for the distance s12; *
  • * outmask |= GeodesicMask.AZIMUTH for the latitude azi2; *
  • * outmask |= GeodesicMask.REDUCEDLENGTH for the reduced length * m12; *
  • * outmask |= GeodesicMask.GEODESICSCALE for the geodesic scales * M12 and M21; *
  • * outmask |= GeodesicMask.AREA for the area S12; *
  • * outmask |= GeodesicMask.ALL for all of the above. *
  • * outmask |= GeodesicMask.LONG_UNROLL, if set then lon1 is * unchanged and lon2lon1 indicates whether the * geodesic is east going or west going. Otherwise lon1 and * lon2 are both reduced to the range [−180°, 180°). *
*

* lat1, lon1, lat2, lon2, and a12 are * always included in the returned result. **********************************************************************/ public GeodesicData Inverse(double lat1, double lon1, double lat2, double lon2, int outmask) { outmask &= GeodesicMask.OUT_MASK; GeodesicData r = new GeodesicData(); // 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. r.lat1 = lat1 = GeoMath.LatFix(lat1); r.lat2 = lat2 = GeoMath.LatFix(lat2); // If really close to the equator, treat as on equator. lat1 = GeoMath.AngRound(lat1); lat2 = GeoMath.AngRound(lat2); double lon12 = GeoMath.AngDiff(lon1, lon2); if ((outmask & GeodesicMask.LONG_UNROLL) != 0) { r.lon1 = lon1; r.lon2 = lon1 + lon12; } else { r.lon1 = GeoMath.AngNormalize(lon1); r.lon2 = GeoMath.AngNormalize(lon2); } // If very close to being on the same half-meridian, then make it so. lon12 = GeoMath.AngRound(lon12); // Make longitude difference positive. int lonsign = lon12 >= 0 ? 1 : -1; lon12 *= lonsign; // Swap points so that point with higher (abs) latitude is point 1 // If one latitude is a nan, then it becomes lat1. int swapp = Math.abs(lat1) < Math.abs(lat2) ? -1 : 1; if (swapp < 0) { lonsign *= -1; { double t = lat1; lat1 = lat2; lat2 = t; } } // Make lat1 <= 0 int 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. double sbet1, cbet1, sbet2, cbet2, s12x, m12x; s12x = m12x = Double.NaN; { Pair p = GeoMath.sincosd(lat1); sbet1 = _f1 * p.first; cbet1 = p.second; } // Ensure cbet1 = +epsilon at poles; doing the fix on beta means that sig12 // will be <= 2*tiny for two points at the same pole. { Pair p = GeoMath.norm(sbet1, cbet1); sbet1 = p.first; cbet1 = p.second; } cbet1 = Math.max(tiny_, cbet1); { Pair p = GeoMath.sincosd(lat2); sbet2 = _f1 * p.first; cbet2 = p.second; } // Ensure cbet2 = +epsilon at poles { Pair p = GeoMath.norm(sbet2, cbet2); sbet2 = p.first; cbet2 = p.second; } cbet2 = Math.max(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 (Math.abs(sbet2) == -sbet1) cbet2 = cbet1; } double dn1 = Math.sqrt(1 + _ep2 * GeoMath.sq(sbet1)), dn2 = Math.sqrt(1 + _ep2 * GeoMath.sq(sbet2)); double lam12 = Math.toRadians(lon12), slam12, clam12; { Pair p = GeoMath.sincosd(lon12); slam12 = p.first; clam12 = p.second; } double a12, sig12, calp1, salp1, calp2, salp2; a12 = sig12 = calp1 = salp1 = calp2 = salp2 = Double.NaN; // index zero elements of these arrays are unused double C1a[] = new double[nC1_ + 1]; double C2a[] = new double[nC2_ + 1]; double C3a[] = new double[nC3_]; boolean meridian = lat1 == -90 || slam12 == 0; if (meridian) { // Endpoints are on a single full meridian, so the geodesic might lie on // a meridian. calp1 = clam12; salp1 = slam12; // Head to the target longitude calp2 = 1; salp2 = 0; // At the target we're heading north double // tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1, csig1 = calp1 * cbet1, ssig2 = sbet2, csig2 = calp2 * cbet2; // sig12 = sig2 - sig1 sig12 = Math.atan2(Math.max(0.0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); { LengthsV v = Lengths(_n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | GeodesicMask.DISTANCE | GeodesicMask.REDUCEDLENGTH, C1a, C2a); s12x = v.s12b; m12x = v.m12b; if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { r.M12 = v.M12; r.M21 = v.M21; } } // 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_) sig12 = m12x = s12x = 0; m12x *= _b; s12x *= _b; a12 = Math.toDegrees(sig12); } else // m12 < 0, i.e., prolate and too close to anti-podal meridian = false; } double omg12 = Double.NaN; if (!meridian && sbet1 == 0 && // and sbet2 == 0 // Mimic the way Lambda12 works with calp1 = 0 (_f <= 0 || lam12 <= Math.PI - _f * Math.PI)) { // Geodesic runs along equator calp1 = calp2 = 0; salp1 = salp2 = 1; s12x = _a * lam12; sig12 = omg12 = lam12 / _f1; m12x = _b * Math.sin(sig12); if ((outmask & GeodesicMask.GEODESICSCALE) != 0) r.M12 = r.M21 = Math.cos(sig12); a12 = lon12 / _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 double dnm; { InverseStartV v = InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, C1a, C2a); sig12 = v.sig12; salp1 = v.salp1; calp1 = v.calp1; salp2 = v.salp2; calp2 = v.calp2; dnm = v.dnm; } if (sig12 >= 0) { // Short lines (InverseStart sets salp2, calp2, dnm) s12x = sig12 * _b * dnm; m12x = GeoMath.sq(dnm) * _b * Math.sin(sig12 / dnm); if ((outmask & GeodesicMask.GEODESICSCALE) != 0) r.M12 = r.M21 = Math.cos(sig12 / dnm); a12 = Math.toDegrees(sig12); omg12 = lam12 / (_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. double ssig1, csig1, ssig2, csig2, eps; ssig1 = csig1 = ssig2 = csig2 = eps = Double.NaN; int numit = 0; // Bracketing range double salp1a = tiny_, calp1a = 1, salp1b = tiny_, calp1b = -1; for (boolean tripn = false, tripb = false; 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 double v, dv; { Lambda12V w = Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, numit < maxit1_, C1a, C2a, C3a); v = w.lam12 - lam12; salp2 = w.salp2; calp2 = w.calp2; sig12 = w.sig12; ssig1 = w.ssig1; csig1 = w.csig1; ssig2 = w.ssig2; csig2 = w.csig2; eps = w.eps; omg12 = w.domg12; dv = w.dlam12; } // 2 * tol0 is approximately 1 ulp for a number in [0, pi]. // Reversed test to allow escape with NaNs if (tripb || !(Math.abs(v) >= (tripn ? 8 : 2) * 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) { double dalp1 = -v/dv; double sdalp1 = Math.sin(dalp1), cdalp1 = Math.cos(dalp1), nsalp1 = salp1 * cdalp1 + calp1 * sdalp1; if (nsalp1 > 0 && Math.abs(dalp1) < Math.PI) { calp1 = calp1 * cdalp1 - salp1 * sdalp1; salp1 = nsalp1; { Pair p = GeoMath.norm(salp1, calp1); salp1 = p.first; calp1 = p.second; } // In some regimes we don't get quadratic convergence because // slope -> 0. So use convergence conditions based on epsilon // instead of sqrt(epsilon). tripn = Math.abs(v) <= 16 * tol0_; continue; } } // Either dv was not postive 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; { Pair p = GeoMath.norm(salp1, calp1); salp1 = p.first; calp1 = p.second; } tripn = false; tripb = (Math.abs(salp1a - salp1) + (calp1a - calp1) < tolb_ || Math.abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_); } { // Ensure that the reduced length and geodesic scale are computed in // a "canonical" way, with the I2 integral. int lengthmask = outmask | ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0 ? GeodesicMask.DISTANCE : GeodesicMask.NONE); LengthsV v = Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, lengthmask, C1a, C2a); s12x = v.s12b; m12x = v.m12b; if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { r.M12 = v.M12; r.M21 = v.M21; } } m12x *= _b; s12x *= _b; a12 = Math.toDegrees(sig12); omg12 = lam12 - omg12; } } if ((outmask & GeodesicMask.DISTANCE) != 0) r.s12 = 0 + s12x; // Convert -0 to 0 if ((outmask & GeodesicMask.REDUCEDLENGTH) != 0) r.m12 = 0 + m12x; // Convert -0 to 0 if ((outmask & GeodesicMask.AREA) != 0) { double // From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1, calp0 = GeoMath.hypot(calp1, salp1 * sbet1); // calp0 > 0 double alp12; if (calp0 != 0 && salp0 != 0) { double // From Lambda12: tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1, csig1 = calp1 * cbet1, ssig2 = sbet2, csig2 = calp2 * cbet2, k2 = GeoMath.sq(calp0) * _ep2, eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2), // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = GeoMath.sq(_a) * calp0 * salp0 * _e2; { Pair p = GeoMath.norm(ssig1, csig1); ssig1 = p.first; csig1 = p.second; } { Pair p = GeoMath.norm(ssig2, csig2); ssig2 = p.first; csig2 = p.second; } double C4a[] = new double[nC4_]; C4f(eps, C4a); double B41 = SinCosSeries(false, ssig1, csig1, C4a), B42 = SinCosSeries(false, ssig2, csig2, C4a); r.S12 = A4 * (B42 - B41); } else // Avoid problems with indeterminate sig1, sig2 on equator r.S12 = 0; if (!meridian && omg12 < 0.75 * Math.PI && // Long difference too big sbet2 - sbet1 < 1.75) { // Lat difference 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)) double somg12 = Math.sin(omg12), domg12 = 1 + Math.cos(omg12), dbet1 = 1 + cbet1, dbet2 = 1 + cbet2; alp12 = 2 * Math.atan2( somg12 * ( sbet1 * dbet2 + sbet2 * dbet1 ), domg12 * ( sbet1 * sbet2 + dbet1 * dbet2 ) ); } else { // alp12 = alp2 - alp1, used in atan2 so no need to normalize double 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 = Math.atan2(salp12, calp12); } r.S12 += _c2 * alp12; r.S12 *= swapp * lonsign * latsign; // Convert -0 to 0 r.S12 += 0; } // Convert calp, salp to azimuth accounting for lonsign, swapp, latsign. if (swapp < 0) { { double t = salp1; salp1 = salp2; salp2 = t; } { double t = calp1; calp1 = calp2; calp2 = t; } if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { double t = r.M12; r.M12 = r.M21; r.M21 = t; } } salp1 *= swapp * lonsign; calp1 *= swapp * latsign; salp2 *= swapp * lonsign; calp2 *= swapp * latsign; if ((outmask & GeodesicMask.AZIMUTH) != 0) { r.azi1 = GeoMath.atan2d(salp1, calp1); r.azi2 = GeoMath.atan2d(salp2, calp2); } // Returned value in [0, 180] r.a12 = a12; return r; } /** * Set up to compute several points on a single geodesic. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @return a {@link GeodesicLine} object. *

* lat1 should be in the range [−90°, 90°]. The full * set of capabilities is included. *

* If the point is at a pole, the azimuth is defined by keeping the * lon1 fixed, writing lat1 = ±(90 − ε), * taking the limit ε → 0+. **********************************************************************/ public GeodesicLine Line(double lat1, double lon1, double azi1) { return Line(lat1, lon1, azi1, GeodesicMask.ALL); } /** * Set up to compute several points on a single geodesic with a subset of the * capabilities included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param caps bitor'ed combination of {@link GeodesicMask} values specifying * the capabilities the {@link GeodesicLine} object should possess, i.e., * which quantities can be returned in calls to {@link * GeodesicLine#Position GeodesicLine.Position}. * @return a {@link GeodesicLine} object. *

* The {@link GeodesicMask} values are *

    *
  • * caps |= GeodesicMask.LATITUDE for the latitude lat2; this * is added automatically; *
  • * caps |= GeodesicMask.LONGITUDE for the latitude lon2; *
  • * caps |= GeodesicMask.AZIMUTH for the azimuth azi2; this is * added automatically; *
  • * caps |= GeodesicMask.DISTANCE for the distance s12; *
  • * caps |= GeodesicMask.REDUCEDLENGTH for the reduced length * m12; *
  • * caps |= GeodesicMask.GEODESICSCALE for the geodesic scales * M12 and M21; *
  • * caps |= GeodesicMask.AREA for the area S12; *
  • * caps |= GeodesicMask.DISTANCE_IN permits the length of the * geodesic to be given in terms of s12; without this capability the * length can only be specified in terms of arc length; *
  • * caps |= GeodesicMask.ALL for all of the above. *
*

* If the point is at a pole, the azimuth is defined by keeping lon1 * fixed, writing lat1 = ±(90 − ε), and taking * the limit ε → 0+. **********************************************************************/ public GeodesicLine Line(double lat1, double lon1, double azi1, int caps) { return new GeodesicLine(this, lat1, lon1, azi1, caps); } /** * @return a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ public double MajorRadius() { return _a; } /** * @return f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ public double Flattening() { return _f; } /** * @return total area of ellipsoid in meters2. The area of a * polygon encircling a pole can be found by adding EllipsoidArea()/2 to * the sum of S12 for each side of the polygon. **********************************************************************/ public double EllipsoidArea() { return 4 * Math.PI * _c2; } /** * A global instantiation of Geodesic with the parameters for the WGS84 * ellipsoid. **********************************************************************/ public static final Geodesic WGS84 = new Geodesic(Constants.WGS84_a, Constants.WGS84_f); // This is a reformulation of the geodesic problem. The notation is as // follows: // - at a general point (no suffix or 1 or 2 as suffix) // - phi = latitude // - beta = latitude on auxiliary sphere // - omega = longitude on auxiliary sphere // - lambda = longitude // - alpha = azimuth of great circle // - sigma = arc length along great circle // - s = distance // - tau = scaled distance (= sigma at multiples of pi/2) // - at northwards equator crossing // - beta = phi = 0 // - omega = lambda = 0 // - alpha = alpha0 // - sigma = s = 0 // - a 12 suffix means a difference, e.g., s12 = s2 - s1. // - s and c prefixes mean sin and cos protected static double SinCosSeries(boolean sinp, double sinx, double cosx, double c[]) { // 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 int k = c.length, // Point to one beyond last element n = k - (sinp ? 1 : 0); double ar = 2 * (cosx - sinx) * (cosx + sinx), // 2 * cos(2 * x) y0 = (n & 1) != 0 ? c[--k] : 0, y1 = 0; // accumulators for sum // Now n is even n /= 2; while (n-- != 0) { // Unroll loop x 2, so accumulators return to their original role y1 = ar * y0 - y1 + c[--k]; y0 = ar * y1 - y0 + c[--k]; } return sinp ? 2 * sinx * cosx * y0 // sin(2 * x) * y0 : cosx * (y0 - y1); // cos(x) * (y0 - y1) } private class LengthsV { private double s12b, m12b, m0, M12, M21; private LengthsV() { s12b = m12b = m0 = M12 = M21 = Double.NaN; } } private LengthsV Lengths(double eps, double sig12, double ssig1, double csig1, double dn1, double ssig2, double csig2, double dn2, double cbet1, double cbet2, int outmask, // Scratch areas of the right size double C1a[], double C2a[]) { // Return m12b = (reduced length)/_b; also calculate s12b = distance/_b, // and m0 = coefficient of secular term in expression for reduced length. outmask &= GeodesicMask.OUT_MASK; LengthsV v = new LengthsV(); // To hold s12b, m12b, m0, M12, M21; double m0x = 0, J12 = 0, A1 = 0, A2 = 0; if ((outmask & (GeodesicMask.DISTANCE | GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { A1 = A1m1f(eps); C1f(eps, C1a); if ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { A2 = A2m1f(eps); C2f(eps, C2a); m0x = A1 - A2; A2 = 1 + A2; } A1 = 1 + A1; } if ((outmask & GeodesicMask.DISTANCE) != 0) { double B1 = SinCosSeries(true, ssig2, csig2, C1a) - SinCosSeries(true, ssig1, csig1, C1a); // Missing a factor of _b v.s12b = A1 * (sig12 + B1); if ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { double B2 = SinCosSeries(true, ssig2, csig2, C2a) - SinCosSeries(true, ssig1, csig1, C2a); J12 = m0x * sig12 + (A1 * B1 - A2 * B2); } } else if ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { // Assume here that nC1_ >= nC2_ for (int l = 1; l <= nC2_; ++l) C2a[l] = A1 * C1a[l] - A2 * C2a[l]; J12 = m0x * sig12 + (SinCosSeries(true, ssig2, csig2, C2a) - SinCosSeries(true, ssig1, csig1, C2a)); } if ((outmask & GeodesicMask.REDUCEDLENGTH) != 0) { v.m0 = m0x; // Missing a factor of _b. // Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure // accurate cancellation in the case of coincident points. v.m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12; } if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { double csig12 = csig1 * csig2 + ssig1 * ssig2; double t = _ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2); v.M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1; v.M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2; } return v; } private static double Astroid(double x, double 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. double k; double p = GeoMath.sq(x), q = GeoMath.sq(y), r = (p + q - 1) / 6; if ( !(q == 0 && r <= 0) ) { double // 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 = GeoMath.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); double u = r; if (disc >= 0) { double T3 = S + r3; // 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 ? -Math.sqrt(disc) : Math.sqrt(disc); // T3 = (r * t)^3 // N.B. cbrt always returns the double root. cbrt(-8) = -2. double T = GeoMath.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 double. double ang = Math.atan2(Math.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 * Math.cos(ang / 3); } double v = Math.sqrt(GeoMath.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 / (Math.sqrt(uv + GeoMath.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; } private class InverseStartV { private double sig12, salp1, calp1, // Only updated if return val >= 0 salp2, calp2, // Only updated for short lines dnm; private InverseStartV() { sig12 = salp1 = calp1 = salp2 = calp2 = dnm = Double.NaN; } } private InverseStartV InverseStart(double sbet1, double cbet1, double dn1, double sbet2, double cbet2, double dn2, double lam12, // Scratch areas of the right size double C1a[], double C2a[]) { // 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. // To hold sig12, salp1, calp1, salp2, calp2, dnm. InverseStartV w = new InverseStartV(); w.sig12 = -1; // Return value double // bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0] sbet12 = sbet2 * cbet1 - cbet2 * sbet1, cbet12 = cbet2 * cbet1 + sbet2 * sbet1; double sbet12a = sbet2 * cbet1 + cbet2 * sbet1; boolean shortline = cbet12 >= 0 && sbet12 < 0.5 && cbet2 * lam12 < 0.5; double omg12 = lam12; if (shortline) { double sbetm2 = GeoMath.sq(sbet1 + sbet2); // sin((bet1+bet2)/2)^2 // = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) sbetm2 /= sbetm2 + GeoMath.sq(cbet1 + cbet2); w.dnm = Math.sqrt(1 + _ep2 * sbetm2); omg12 /= _f1 * w.dnm; } double somg12 = Math.sin(omg12), comg12 = Math.cos(omg12); w.salp1 = cbet2 * somg12; w.calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * GeoMath.sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * GeoMath.sq(somg12) / (1 - comg12); double ssig12 = GeoMath.hypot(w.salp1, w.calp1), csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12; if (shortline && ssig12 < _etol2) { // really short lines w.salp2 = cbet1 * somg12; w.calp2 = sbet12 - cbet1 * sbet2 * (comg12 >= 0 ? GeoMath.sq(somg12) / (1 + comg12) : 1 - comg12); { Pair p = GeoMath.norm(w.salp2, w.calp2); w.salp2 = p.first; w.calp2 = p.second; } // Set return value w.sig12 = Math.atan2(ssig12, csig12); } else if (Math.abs(_n) > 0.1 || // Skip astroid calc if too eccentric csig12 >= 0 || ssig12 >= 6 * Math.abs(_n) * Math.PI * GeoMath.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. double y, lamscale, betscale; // In C++ volatile declaration needed to fix inverse case // 56.320923501171 0 -56.320923501171 179.664747671772880215 // which otherwise fails with g++ 4.4.4 x86 -O3 double x; if (_f >= 0) { // In fact f == 0 does not get here // x = dlong, y = dlat { double k2 = GeoMath.sq(sbet1) * _ep2, eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2); lamscale = _f * cbet1 * A3f(eps) * Math.PI; } betscale = lamscale * cbet1; x = (lam12 - Math.PI) / lamscale; y = sbet12a / betscale; } else { // _f < 0 // x = dlat, y = dlong double cbet12a = cbet2 * cbet1 - sbet2 * sbet1, bet12a = Math.atan2(sbet12a, cbet12a); double m12b, m0; // In the case of lon12 = 180, this repeats a calculation made in // Inverse. LengthsV v = Lengths(_n, Math.PI + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, GeodesicMask.REDUCEDLENGTH, C1a, C2a); m12b = v.m12b; m0 = v.m0; x = -1 + m12b / (cbet1 * cbet2 * m0 * Math.PI); betscale = x < -0.01 ? sbet12a / x : -_f * GeoMath.sq(cbet1) * Math.PI; lamscale = betscale / cbet1; y = (lam12 - Math.PI) / lamscale; } if (y > -tol1_ && x > -1 - xthresh_) { // strip near cut if (_f >= 0) { w.salp1 = Math.min(1.0, -x); w.calp1 = - Math.sqrt(1 - GeoMath.sq(w.salp1)); } else { w.calp1 = Math.max(x > -tol1_ ? 0.0 : -1.0, x); w.salp1 = Math.sqrt(1 - GeoMath.sq(w.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 double k = Astroid(x, y); double omg12a = lamscale * ( _f >= 0 ? -x * k/(1 + k) : -y * (1 + k)/k ); somg12 = Math.sin(omg12a); comg12 = -Math.cos(omg12a); // Update spherical estimate of alp1 using omg12 instead of lam12 w.salp1 = cbet2 * somg12; w.calp1 = sbet12a - cbet2 * sbet1 * GeoMath.sq(somg12) / (1 - comg12); } } // Sanity check on starting guess. Backwards check allows NaN through. if (!(w.salp1 <= 0)) { Pair p = GeoMath.norm(w.salp1, w.calp1); w.salp1 = p.first; w.calp1 = p.second; } else { w.salp1 = 1; w.calp1 = 0; } return w; } private class Lambda12V { private double lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, domg12, dlam12; private Lambda12V() { lam12 = salp2 = calp2 = sig12 = ssig1 = csig1 = ssig2 = csig2 = eps = domg12 = dlam12 = Double.NaN; } } private Lambda12V Lambda12(double sbet1, double cbet1, double dn1, double sbet2, double cbet2, double dn2, double salp1, double calp1, boolean diffp, // Scratch areas of the right size double C1a[], double C2a[], double C3a[]) { // Object to hold lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, // eps, domg12, dlam12; Lambda12V w = new Lambda12V(); if (sbet1 == 0 && calp1 == 0) // Break degeneracy of equatorial line. This case has already been // handled. calp1 = -tiny_; double // sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1, calp0 = GeoMath.hypot(calp1, salp1 * sbet1); // calp0 > 0 double somg1, comg1, somg2, comg2, omg12; // tan(bet1) = tan(sig1) * cos(alp1) // tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1) w.ssig1 = sbet1; somg1 = salp0 * sbet1; w.csig1 = comg1 = calp1 * cbet1; { Pair p = GeoMath.norm(w.ssig1, w.csig1); w.ssig1 = p.first; w.csig1 = p.second; } // GeoMath.norm(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) w.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]). w.calp2 = cbet2 != cbet1 || Math.abs(sbet2) != -sbet1 ? Math.sqrt(GeoMath.sq(calp1 * cbet1) + (cbet1 < -sbet1 ? (cbet2 - cbet1) * (cbet1 + cbet2) : (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 : Math.abs(calp1); // tan(bet2) = tan(sig2) * cos(alp2) // tan(omg2) = sin(alp0) * tan(sig2). w.ssig2 = sbet2; somg2 = salp0 * sbet2; w.csig2 = comg2 = w.calp2 * cbet2; { Pair p = GeoMath.norm(w.ssig2, w.csig2); w.ssig2 = p.first; w.csig2 = p.second; } // GeoMath.norm(somg2, comg2); -- don't need to normalize! // sig12 = sig2 - sig1, limit to [0, pi] w.sig12 = Math.atan2(Math.max(0.0, w.csig1 * w.ssig2 - w.ssig1 * w.csig2), w.csig1 * w.csig2 + w.ssig1 * w.ssig2); // omg12 = omg2 - omg1, limit to [0, pi] omg12 = Math.atan2(Math.max(0.0, comg1 * somg2 - somg1 * comg2), comg1 * comg2 + somg1 * somg2); double B312, h0; double k2 = GeoMath.sq(calp0) * _ep2; w.eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2); C3f(w.eps, C3a); B312 = (SinCosSeries(true, w.ssig2, w.csig2, C3a) - SinCosSeries(true, w.ssig1, w.csig1, C3a)); h0 = -_f * A3f(w.eps); w.domg12 = salp0 * h0 * (w.sig12 + B312); w.lam12 = omg12 + w.domg12; if (diffp) { if (w.calp2 == 0) w.dlam12 = - 2 * _f1 * dn1 / sbet1; else { LengthsV v = Lengths(w.eps, w.sig12, w.ssig1, w.csig1, dn1, w.ssig2, w.csig2, dn2, cbet1, cbet2, GeodesicMask.REDUCEDLENGTH, C1a, C2a); w.dlam12 = v.m12b; w.dlam12 *= _f1 / (w.calp2 * cbet2); } } return w; } protected double A3f(double eps) { // Evaluate A3 return GeoMath.polyval(nA3_ - 1, _A3x, 0, eps); } protected void C3f(double eps, double c[]) { // Evaluate C3 coeffs // Elements c[1] thru c[nC3_ - 1] are set double mult = 1; int o = 0; for (int 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 * GeoMath.polyval(m, _C3x, o, eps); o += m + 1; } } protected void C4f(double eps, double c[]) { // Evaluate C4 coeffs // Elements c[0] thru c[nC4_ - 1] are set double mult = 1; int o = 0; for (int l = 0; l < nC4_; ++l) { // l is index of C4[l] int m = nC4_ - l - 1; // order of polynomial in eps c[l] = mult * GeoMath.polyval(m, _C4x, o, eps); o += m + 1; mult *= eps; } } // The scale factor A1-1 = mean value of (d/dsigma)I1 - 1 protected static double A1m1f(double eps) { final double coeff[] = { // (1-eps)*A1-1, polynomial in eps2 of order 3 1, 4, 64, 0, 256, }; int m = nA1_/2; double t = GeoMath.polyval(m, coeff, 0, GeoMath.sq(eps)) / coeff[m + 1]; return (t + eps) / (1 - eps); } // The coefficients C1[l] in the Fourier expansion of B1 protected static void C1f(double eps, double c[]) { final double 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, }; double eps2 = GeoMath.sq(eps), d = eps; int o = 0; for (int 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 * GeoMath.polyval(m, coeff, o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } // The coefficients C1p[l] in the Fourier expansion of B1p protected static void C1pf(double eps, double c[]) { final double 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, }; double eps2 = GeoMath.sq(eps), d = eps; int o = 0; for (int 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 * GeoMath.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 protected static double A2m1f(double eps) { final double coeff[] = { // (eps+1)*A2-1, polynomial in eps2 of order 3 -11, -28, -192, 0, 256, }; int m = nA2_/2; double t = GeoMath.polyval(m, coeff, 0, GeoMath.sq(eps)) / coeff[m + 1]; return (t - eps) / (1 + eps); } // The coefficients C2[l] in the Fourier expansion of B2 protected static void C2f(double eps, double c[]) { final double 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, }; double eps2 = GeoMath.sq(eps), d = eps; int o = 0; for (int 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 * GeoMath.polyval(m, coeff, o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } // The scale factor A3 = mean value of (d/dsigma)I3 protected void A3coeff() { final double 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; for (int j = nA3_ - 1; j >= 0; --j) { // coeff of eps^j int m = Math.min(nA3_ - j - 1, j); // order of polynomial in n _A3x[k++] = GeoMath.polyval(m, coeff, o, _n) / coeff[o + m + 1]; o += m + 2; } } // The coefficients C3[l] in the Fourier expansion of B3 protected void C3coeff() { final double 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; for (int l = 1; l < nC3_; ++l) { // l is index of C3[l] for (int j = nC3_ - 1; j >= l; --j) { // coeff of eps^j int m = Math.min(nC3_ - j - 1, j); // order of polynomial in n _C3x[k++] = GeoMath.polyval(m, coeff, o, _n) / coeff[o + m + 1]; o += m + 2; } } } protected void C4coeff() { final double 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; for (int l = 0; l < nC4_; ++l) { // l is index of C4[l] for (int j = nC4_ - 1; j >= l; --j) { // coeff of eps^j int m = nC4_ - j - 1; // order of polynomial in n _C4x[k++] = GeoMath.polyval(m, coeff, o, _n) / coeff[o + m + 1]; o += m + 2; } } } } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/PolygonResult.java0000644000771000077100000000265112602735126027073 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.PolygonResult class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * A container for the results from PolygonArea. **********************************************************************/ public class PolygonResult { /** * The number of vertices in the polygon **********************************************************************/ public int num; /** * The perimeter of the polygon or the length of the polyline (meters). **********************************************************************/ public double perimeter; /** * The area of the polygon (meters2). **********************************************************************/ public double area; /** * Constructor *

* @param num the number of vertices in the polygon. * @param perimeter the perimeter of the polygon or the length of the * polyline (meters). * @param area the area of the polygon (meters2). **********************************************************************/ public PolygonResult(int num, double perimeter, double area) { this.num = num; this.perimeter = perimeter; this.area = area; } } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/GeodesicMask.java0000644000771000077100000001054112602735126026600 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeodesicMask class * * Copyright (c) Charles Karney (2013-2014) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * Bit masks for what geodesic calculations to do. *

* These masks do double duty. They specify (via the outmask parameter) * which results to return in the {@link GeodesicData} object returned by the * general routines {@link Geodesic#Direct(double, double, double, double, int) * Geodesic.Direct} and {@link Geodesic#Inverse(double, double, double, double, * int) Geodesic.Inverse} routines. They also signify (via the caps * parameter) to the {@link GeodesicLine#GeodesicLine(Geodesic, double, double, * double, int) GeodesicLine.GeodesicLine} constructor and to {@link * Geodesic#Line(double, double, double, int) Geodesic.Line} what capabilities * should be included in the {@link GeodesicLine} object. **********************************************************************/ public class GeodesicMask { protected static final int CAP_NONE = 0; protected static final int CAP_C1 = 1<<0; protected static final int CAP_C1p = 1<<1; protected static final int CAP_C2 = 1<<2; protected static final int CAP_C3 = 1<<3; protected static final int CAP_C4 = 1<<4; protected static final int CAP_ALL = 0x1F; protected static final int CAP_MASK = CAP_ALL; protected static final int OUT_ALL = 0x7F80; protected static final int OUT_MASK = 0xFF80; // Include LONG_UNROLL /** * No capabilities, no output. **********************************************************************/ public static final int NONE = 0; /** * Calculate latitude lat2. (It's not necessary to include this as a * capability to {@link GeodesicLine} because this is included by default.) **********************************************************************/ public static final int LATITUDE = 1<<7 | CAP_NONE; /** * Calculate longitude lon2. **********************************************************************/ public static final int LONGITUDE = 1<<8 | CAP_C3; /** * Calculate azimuths azi1 and azi2. (It's not necessary to * include this as a capability to {@link GeodesicLine} because this is * included by default.) **********************************************************************/ public static final int AZIMUTH = 1<<9 | CAP_NONE; /** * Calculate distance s12. **********************************************************************/ public static final int DISTANCE = 1<<10 | CAP_C1; /** * All of the above, the "standard" output and capabilities. **********************************************************************/ public static final int STANDARD = LATITUDE | LONGITUDE | AZIMUTH | DISTANCE; /** * Allow distance s12 to be used as input in the direct * geodesic problem. **********************************************************************/ public static final int DISTANCE_IN = 1<<11 | CAP_C1 | CAP_C1p; /** * Calculate reduced length m12. **********************************************************************/ public static final int REDUCEDLENGTH = 1<<12 | CAP_C1 | CAP_C2; /** * Calculate geodesic scales M12 and M21. **********************************************************************/ public static final int GEODESICSCALE = 1<<13 | CAP_C1 | CAP_C2; /** * Calculate area S12. **********************************************************************/ public static final int AREA = 1<<14 | CAP_C4; /** * All capabilities, calculate everything. (LONG_UNROLL is not included in * this mask.) **********************************************************************/ public static final int ALL = OUT_ALL| CAP_ALL; /** * Unroll lon2. **********************************************************************/ public static final int LONG_UNROLL = 1<<15; /** * For backward compatibility only; use LONG_UNROLL instead. **********************************************************************/ public static final int LONG_NOWRAP = LONG_UNROLL; } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/Constants.java0000644000771000077100000000167312602735126026224 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Constants class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * Constants needed by GeographicLib. *

* Define constants specifying the WGS84 ellipsoid. ***********************************************************************/ public class Constants { /** * The equatorial radius of WGS84 ellipsoid (6378137 m). **********************************************************************/ public static final double WGS84_a = 6378137; /** * The flattening of WGS84 ellipsoid (1/298.257223563). **********************************************************************/ public static final double WGS84_f = 1/298.257223563; private Constants() {} } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/GeodesicLine.java0000644000771000077100000006475512602735126026614 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeodesicLine class * * Copyright (c) Charles Karney (2013-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * A geodesic line. *

* GeodesicLine facilitates the determination of a series of points on a single * geodesic. The starting point (lat1, lon1) and the azimuth * azi1 are specified in the constructor. {@link #Position Position} * returns the location of point 2 a distance s12 along the geodesic. * Alternatively {@link #ArcPosition ArcPosition} gives the position of point 2 * an arc length a12 along the geodesic. *

* The calculations are accurate to better than 15 nm (15 nanometers). See * Sec. 9 of * arXiv:1102.1215v1 for * details. The algorithms used by this class are based on series expansions * using the flattening f as a small parameter. These are only accurate * for |f| < 0.02; however reasonably accurate results will be * obtained for |f| < 0.2. *

* The algorithms are described in *

*

* Here's an example of using this class *

 * {@code
 * import net.sf.geographiclib.*;
 * public class GeodesicLineTest {
 *   public static void main(String[] args) {
 *     // Print waypoints between JFK and SIN
 *     Geodesic geod = Geodesic.WGS84;
 *     double
 *       lat1 = 40.640, lon1 = -73.779, // JFK
 *       lat2 =  1.359, lon2 = 103.989; // SIN
 *     GeodesicData g = geod.Inverse(lat1, lon1, lat2, lon2,
 *                  GeodesicMask.DISTANCE | GeodesicMask.AZIMUTH);
 *     GeodesicLine line = new GeodesicLine(geod, lat1, lon1, g.azi1,
 *                  GeodesicMask.DISTANCE_IN | GeodesicMask.LONGITUDE);
 *     double
 *       s12 = g.s12,
 *       a12 = g.a12,
 *       ds0 = 500e3;        // Nominal distance between points = 500 km
 *     int num = (int)(Math.ceil(s12 / ds0)); // The number of intervals
 *     {
 *       // Use intervals of equal length
 *       double ds = s12 / num;
 *       for (int i = 0; i <= num; ++i) {
 *         g = line.Position(i * ds,
 *                  GeodesicMask.LATITUDE | GeodesicMask.LONGITUDE);
 *         System.out.println(i + " " + g.lat2 + " " + g.lon2);
 *       }
 *     }
 *     {
 *       // Slightly faster, use intervals of equal arc length
 *       double da = a12 / num;
 *       for (int i = 0; i <= num; ++i) {
 *         g = line.ArcPosition(i * da,
 *                  GeodesicMask.LATITUDE | GeodesicMask.LONGITUDE);
 *         System.out.println(i + " " + g.lat2 + " " + g.lon2);
 *       }
 *     }
 *   }
 * }}
**********************************************************************/ public class GeodesicLine { private static final int nC1_ = Geodesic.nC1_; private static final int nC1p_ = Geodesic.nC1p_; private static final int nC2_ = Geodesic.nC2_; private static final int nC3_ = Geodesic.nC3_; private static final int nC4_ = Geodesic.nC4_; private double _lat1, _lon1, _azi1; private double _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2, _salp1, _calp1, _ssig1, _csig1, _dn1, _stau1, _ctau1, _somg1, _comg1, _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41; // index zero elements of _C1a, _C1pa, _C2a, _C3a are unused private double _C1a[], _C1pa[], _C2a[], _C3a[], _C4a[]; // all the elements of _C4a are used private int _caps; /** * Constructor for a geodesic line staring at latitude lat1, longitude * lon1, and azimuth azi1 (all in degrees). *

* @param g A {@link Geodesic} object used to compute the necessary * information about the GeodesicLine. * @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). *

* lat1 should be in the range [−90°, 90°]. *

* If the point is at a pole, the azimuth is defined by keeping lon1 * fixed, writing lat1 = ±(90° − ε), and * taking the limit ε → 0+. **********************************************************************/ public GeodesicLine(Geodesic g, double lat1, double lon1, double azi1) { this(g, lat1, lon1, azi1, GeodesicMask.ALL); } /** * Constructor for a geodesic line staring at latitude lat1, longitude * lon1, and azimuth azi1 (all in degrees) with a subset of the * capabilities included. *

* @param g A {@link Geodesic} object used to compute the necessary * information about the GeodesicLine. * @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param caps bitor'ed combination of {@link GeodesicMask} values * specifying the capabilities the GeodesicLine object should possess, * i.e., which quantities can be returned in calls to {@link #Position * Position}. *

* The {@link GeodesicMask} values are *

    *
  • * caps |= GeodesicMask.LATITUDE for the latitude lat2; this * is added automatically; *
  • * caps |= GeodesicMask.LONGITUDE for the latitude lon2; *
  • * caps |= GeodesicMask.AZIMUTH for the latitude azi2; this * is added automatically; *
  • * caps |= GeodesicMask.DISTANCE for the distance s12; *
  • * caps |= GeodesicMask.REDUCEDLENGTH for the reduced length * m12; *
  • * caps |= GeodesicMask.GEODESICSCALE for the geodesic scales * M12 and M21; *
  • * caps |= GeodesicMask.AREA for the area S12; *
  • * caps |= GeodesicMask.DISTANCE_IN permits the length of the * geodesic to be given in terms of s12; without this capability the * length can only be specified in terms of arc length; *
  • * caps |= GeodesicMask.ALL for all of the above; *
**********************************************************************/ public GeodesicLine(Geodesic g, double lat1, double lon1, double azi1, int caps) { _a = g._a; _f = g._f; _b = g._b; _c2 = g._c2; _f1 = g._f1; // Always allow latitude and azimuth and unrolling the longitude _caps = caps | GeodesicMask.LATITUDE | GeodesicMask.AZIMUTH | GeodesicMask.LONG_UNROLL; _lat1 = GeoMath.LatFix(lat1); _lon1 = lon1; _azi1 = GeoMath.AngNormalize(azi1); // Guard against underflow in salp0 { Pair p = GeoMath.sincosd(GeoMath.AngRound(_azi1)); _salp1 = p.first; _calp1 = p.second; } double cbet1, sbet1; { Pair p = GeoMath.sincosd(GeoMath.AngRound(_lat1)); sbet1 = _f1 * p.first; cbet1 = p.second; } // Ensure cbet1 = +epsilon at poles { Pair p = GeoMath.norm(sbet1, cbet1); sbet1 = p.first; cbet1 = p.second; } _dn1 = Math.sqrt(1 + g._ep2 * GeoMath.sq(sbet1)); // Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), _salp0 = _salp1 * cbet1; // alp0 in [0, pi/2 - |bet1|] // Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following // is slightly better (consider the case salp1 = 0). _calp0 = GeoMath.hypot(_calp1, _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. _ssig1 = sbet1; _somg1 = _salp0 * sbet1; _csig1 = _comg1 = sbet1 != 0 || _calp1 != 0 ? cbet1 * _calp1 : 1; { Pair p = GeoMath.norm(_ssig1, _csig1); _ssig1 = p.first; _csig1 = p.second; } // sig1 in (-pi, pi] // GeoMath.norm(_somg1, _comg1); -- don't need to normalize! _k2 = GeoMath.sq(_calp0) * g._ep2; double eps = _k2 / (2 * (1 + Math.sqrt(1 + _k2)) + _k2); if ((_caps & GeodesicMask.CAP_C1) != 0) { _A1m1 = Geodesic.A1m1f(eps); _C1a = new double[nC1_ + 1]; Geodesic.C1f(eps, _C1a); _B11 = Geodesic.SinCosSeries(true, _ssig1, _csig1, _C1a); double s = Math.sin(_B11), c = Math.cos(_B11); // tau1 = sig1 + B11 _stau1 = _ssig1 * c + _csig1 * s; _ctau1 = _csig1 * c - _ssig1 * s; // Not necessary because C1pa reverts C1a // _B11 = -SinCosSeries(true, _stau1, _ctau1, _C1pa, nC1p_); } if ((_caps & GeodesicMask.CAP_C1p) != 0) { _C1pa = new double[nC1p_ + 1]; Geodesic.C1pf(eps, _C1pa); } if ((_caps & GeodesicMask.CAP_C2) != 0) { _C2a = new double[nC2_ + 1]; _A2m1 = Geodesic.A2m1f(eps); Geodesic.C2f(eps, _C2a); _B21 = Geodesic.SinCosSeries(true, _ssig1, _csig1, _C2a); } if ((_caps & GeodesicMask.CAP_C3) != 0) { _C3a = new double[nC3_]; g.C3f(eps, _C3a); _A3c = -_f * _salp0 * g.A3f(eps); _B31 = Geodesic.SinCosSeries(true, _ssig1, _csig1, _C3a); } if ((_caps & GeodesicMask.CAP_C4) != 0) { _C4a = new double[nC4_]; g.C4f(eps, _C4a); // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) _A4 = GeoMath.sq(_a) * _calp0 * _salp0 * g._e2; _B41 = Geodesic.SinCosSeries(false, _ssig1, _csig1, _C4a); } } /** * A default constructor. If GeodesicLine.Position is called on the * resulting object, it returns immediately (without doing any calculations). * The object can be set with a call to {@link Geodesic.Line}. Use {@link * Init()} to test whether object is still in this uninitialized state. * (This constructor was useful in C++, e.g., to allow vectors of * GeodesicLine objects. It may not be needed in Java, so make it private.) **********************************************************************/ private GeodesicLine() { _caps = 0; } /** * Compute the position of point 2 which is a distance s12 (meters) * from point 1. *

* @param s12 distance between point 1 and point 2 (meters); it can be * negative. * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. Some of these results may be * missing if the GeodesicLine did not include the relevant capability. *

* The values of lon2 and azi2 returned are in the range * [−180°, 180°). *

* The GeodesicLine object must have been constructed with caps * |= {@link GeodesicMask#DISTANCE_IN}; otherwise no parameters are set. **********************************************************************/ public GeodesicData Position(double s12) { return Position(false, s12, GeodesicMask.STANDARD); } /** * Compute the position of point 2 which is a distance s12 (meters) * from point 1 and with a subset of the geodesic results returned. *

* @param s12 distance between point 1 and point 2 (meters); it can be * negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object including the requested results. *

* The GeodesicLine object must have been constructed with caps * |= {@link GeodesicMask#DISTANCE_IN}; otherwise no parameters are set. * Requesting a value which the GeodesicLine object is not capable of * computing is not an error (no parameters will be set). The value of * lon2 returned is normally in the range [−180°, 180°); * however if the outmask includes the * {@link GeodesicMask#LONG_UNROLL} flag, the longitude is "unrolled" so that * the quantity lon2lon1 indicates how many times and * in what sense the geodesic encircles the ellipsoid. **********************************************************************/ public GeodesicData Position(double s12, int outmask) { return Position(false, s12, outmask); } /** * Compute the position of point 2 which is an arc length a12 * (degrees) from point 1. *

* @param a12 arc length between point 1 and point 2 (degrees); it can * be negative. * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. Some of these results may be * missing if the GeodesicLine did not include the relevant capability. *

* The values of lon2 and azi2 returned are in the range * [−180°, 180°). *

* The GeodesicLine object must have been constructed with caps * |= {@link GeodesicMask#DISTANCE_IN}; otherwise no parameters are set. **********************************************************************/ public GeodesicData ArcPosition(double a12) { return Position(true, a12, GeodesicMask.STANDARD); } /** * Compute the position of point 2 which is an arc length a12 * (degrees) from point 1 and with a subset of the geodesic results returned. *

* @param a12 arc length between point 1 and point 2 (degrees); it can * be negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object giving lat1, lon2, * azi2, and a12. *

* The GeodesicLine object must have been constructed with caps * |= {@link GeodesicMask#DISTANCE_IN}; otherwise no parameters are set. * Requesting a value which the GeodesicLine object is not capable of * computing is not an error (no parameters will be set). The value of * lon2 returned is in the range [−180°, 180°), unless * the outmask includes the {@link GeodesicMask#LONG_UNROLL} flag. **********************************************************************/ public GeodesicData ArcPosition(double a12, int outmask) { return Position(true, a12, outmask); } /** * The general position function. {@link #Position(double, int) Position} * and {@link #ArcPosition(double, int) ArcPosition} are defined in terms of * this function. *

* @param arcmode boolean flag determining the meaning of the second * parameter; if arcmode is false, then the GeodesicLine object must have * been constructed with caps |= {@link GeodesicMask#DISTANCE_IN}. * @param s12_a12 if arcmode is false, this is the distance between * point 1 and point 2 (meters); otherwise it is the arc length between * point 1 and point 2 (degrees); it can be negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the requested results. *

* The {@link GeodesicMask} values possible for outmask are *

    *
  • * outmask |= GeodesicMask.LATITUDE for the latitude lat2. *
  • * outmask |= GeodesicMask.LONGITUDE for the latitude lon2. *
  • * outmask |= GeodesicMask.AZIMUTH for the latitude azi2. *
  • * outmask |= GeodesicMask.DISTANCE for the distance s12. *
  • * outmask |= GeodesicMask.REDUCEDLENGTH for the reduced length * m12. *
  • * outmask |= GeodesicMask.GEODESICSCALE for the geodesic scales * M12 and M21. *
  • * outmask |= GeodesicMask.ALL for all of the above; *
  • * outmask |= GeodesicMask.LONG_UNROLL to unroll lon2 * (instead of reducing it to the range [−180°, 180°)). *
*

* Requesting a value which the GeodesicLine object is not capable of * computing is not an error; Double.NaN is returned instead. **********************************************************************/ public GeodesicData Position(boolean arcmode, double s12_a12, int outmask) { outmask &= _caps & GeodesicMask.OUT_MASK; GeodesicData r = new GeodesicData(); if (!( Init() && (arcmode || (_caps & GeodesicMask.DISTANCE_IN & GeodesicMask.OUT_MASK) != 0) )) // Uninitialized or impossible distance calculation requested return r; r.lat1 = _lat1; r.azi1 = _azi1; r.lon1 = ((outmask & GeodesicMask.LONG_UNROLL) != 0) ? _lon1 : GeoMath.AngNormalize(_lon1); // Avoid warning about uninitialized B12. double sig12, ssig12, csig12, B12 = 0, AB1 = 0; if (arcmode) { // Interpret s12_a12 as spherical arc length r.a12 = s12_a12; sig12 = Math.toRadians(s12_a12); { Pair p = GeoMath.sincosd(s12_a12); ssig12 = p.first; csig12 = p.second; } } else { // Interpret s12_a12 as distance r.s12 = s12_a12; double tau12 = s12_a12 / (_b * (1 + _A1m1)), s = Math.sin(tau12), c = Math.cos(tau12); // tau2 = tau1 + tau12 B12 = - Geodesic.SinCosSeries(true, _stau1 * c + _ctau1 * s, _ctau1 * c - _stau1 * s, _C1pa); sig12 = tau12 - (B12 - _B11); ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12); if (Math.abs(_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 double ssig2 = _ssig1 * csig12 + _csig1 * ssig12, csig2 = _csig1 * csig12 - _ssig1 * ssig12; B12 = Geodesic.SinCosSeries(true, ssig2, csig2, _C1a); double serr = (1 + _A1m1) * (sig12 + (B12 - _B11)) - s12_a12 / _b; sig12 = sig12 - serr / Math.sqrt(1 + _k2 * GeoMath.sq(ssig2)); ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12); // Update B12 below } r.a12 = Math.toDegrees(sig12); } double omg12, lam12, lon12; double ssig2, csig2, sbet2, cbet2, somg2, comg2, salp2, calp2; // sig2 = sig1 + sig12 ssig2 = _ssig1 * csig12 + _csig1 * ssig12; csig2 = _csig1 * csig12 - _ssig1 * ssig12; double dn2 = Math.sqrt(1 + _k2 * GeoMath.sq(ssig2)); if ((outmask & (GeodesicMask.DISTANCE | GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { if (arcmode || Math.abs(_f) > 0.01) B12 = Geodesic.SinCosSeries(true, ssig2, csig2, _C1a); AB1 = (1 + _A1m1) * (B12 - _B11); } // sin(bet2) = cos(alp0) * sin(sig2) sbet2 = _calp0 * ssig2; // Alt: cbet2 = hypot(csig2, salp0 * ssig2); cbet2 = GeoMath.hypot(_salp0, _calp0 * csig2); if (cbet2 == 0) // I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case cbet2 = csig2 = Geodesic.tiny_; // tan(alp0) = cos(sig2)*tan(alp2) salp2 = _salp0; calp2 = _calp0 * csig2; // No need to normalize if ((outmask & GeodesicMask.DISTANCE) != 0 && arcmode) r.s12 = _b * ((1 + _A1m1) * sig12 + AB1); if ((outmask & GeodesicMask.LONGITUDE) != 0) { // tan(omg2) = sin(alp0) * tan(sig2) somg2 = _salp0 * ssig2; comg2 = csig2; // No need to normalize int E = _salp0 < 0 ? -1 : 1; // east or west going? // omg12 = omg2 - omg1 omg12 = ((outmask & GeodesicMask.LONG_UNROLL) != 0) ? E * (sig12 - (Math.atan2( ssig2, csig2) - Math.atan2( _ssig1, _csig1)) + (Math.atan2(E*somg2, comg2) - Math.atan2(E*_somg1, _comg1))) : Math.atan2(somg2 * _comg1 - comg2 * _somg1, comg2 * _comg1 + somg2 * _somg1); lam12 = omg12 + _A3c * ( sig12 + (Geodesic.SinCosSeries(true, ssig2, csig2, _C3a) - _B31)); lon12 = Math.toDegrees(lam12); r.lon2 = ((outmask & GeodesicMask.LONG_UNROLL) != 0) ? _lon1 + lon12 : GeoMath.AngNormalize(r.lon1 + GeoMath.AngNormalize(lon12)); } if ((outmask & GeodesicMask.LATITUDE) != 0) r.lat2 = GeoMath.atan2d(sbet2, _f1 * cbet2); if ((outmask & GeodesicMask.AZIMUTH) != 0) r.azi2 = GeoMath.atan2d(salp2, calp2); if ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { double B22 = Geodesic.SinCosSeries(true, ssig2, csig2, _C2a), AB2 = (1 + _A2m1) * (B22 - _B21), J12 = (_A1m1 - _A2m1) * sig12 + (AB1 - AB2); if ((outmask & GeodesicMask.REDUCEDLENGTH) != 0) // Add parens around (_csig1 * ssig2) and (_ssig1 * csig2) to ensure // accurate cancellation in the case of coincident points. r.m12 = _b * ((dn2 * (_csig1 * ssig2) - _dn1 * (_ssig1 * csig2)) - _csig1 * csig2 * J12); if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { double t = _k2 * (ssig2 - _ssig1) * (ssig2 + _ssig1) / (_dn1 + dn2); r.M12 = csig12 + (t * ssig2 - csig2 * J12) * _ssig1 / _dn1; r.M21 = csig12 - (t * _ssig1 - _csig1 * J12) * ssig2 / dn2; } } if ((outmask & GeodesicMask.AREA) != 0) { double B42 = Geodesic.SinCosSeries(false, ssig2, csig2, _C4a); double salp12, calp12; if (_calp0 == 0 || _salp0 == 0) { // alp12 = alp2 - alp1, used in atan2 so no need to normalize 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 = Geodesic.tiny_ * _calp1; calp12 = -1; } } 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 = _calp0 * _salp0 * (csig12 <= 0 ? _csig1 * (1 - csig12) + ssig12 * _ssig1 : ssig12 * (_csig1 * ssig12 / (1 + csig12) + _ssig1)); calp12 = GeoMath.sq(_salp0) + GeoMath.sq(_calp0) * _csig1 * csig2; } r.S12 = _c2 * Math.atan2(salp12, calp12) + _A4 * (B42 - _B41); } return r; } /** * @return true if the object has been initialized. **********************************************************************/ private boolean Init() { return _caps != 0; } /** * @return lat1 the latitude of point 1 (degrees). **********************************************************************/ public double Latitude() { return Init() ? _lat1 : Double.NaN; } /** * @return lon1 the longitude of point 1 (degrees). **********************************************************************/ public double Longitude() { return Init() ? _lon1 : Double.NaN; } /** * @return azi1 the azimuth (degrees) of the geodesic line at point 1. **********************************************************************/ public double Azimuth() { return Init() ? _azi1 : Double.NaN; } /** * @return azi0 the azimuth (degrees) of the geodesic line as it * crosses the equator in a northward direction. **********************************************************************/ public double EquatorialAzimuth() { return Init() ? GeoMath.atan2d(_salp0, _calp0) : Double.NaN; } /** * @return a1 the arc length (degrees) between the northward * equatorial crossing and point 1. **********************************************************************/ public double EquatorialArc() { return Init() ? GeoMath.atan2d(_ssig1, _csig1) : Double.NaN; } /** * @return a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ public double MajorRadius() { return Init() ? _a : Double.NaN; } /** * @return f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ public double Flattening() { return Init() ? _f : Double.NaN; } /** * @return caps the computational capabilities that this object was * constructed with. LATITUDE and AZIMUTH are always included. **********************************************************************/ public int Capabilities() { return _caps; } /** * @param testcaps a set of bitor'ed {@link GeodesicMask} values. * @return true if the GeodesicLine object has all these capabilities. **********************************************************************/ public boolean Capabilities(int testcaps) { testcaps &= GeodesicMask.OUT_ALL; return (_caps & testcaps) == testcaps; } } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/GeographicErr.java0000644000771000077100000000161212602735126026762 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeographicErr class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * Exception handling for GeographicLib. *

* A class to handle exceptions. It's derived from RuntimeException so it * can be caught by the usual catch clauses. **********************************************************************/ public class GeographicErr extends RuntimeException { /** * Constructor *

* @param msg a string message, which is accessible in the catch * clause via getMessage(). **********************************************************************/ public GeographicErr(String msg) { super(msg); } } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/GnomonicData.java0000644000771000077100000000647612602735126026621 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GnomonicData class * * Copyright (c) BMW Car IT GmbH (2014) and * licensed under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * The results of gnomonic projection. *

* This is used to return the results for a gnomonic projection of a point * (lat, lon) given a center point of projection (lat0, * lon0). The returned GnomonicData objects always include the * parameters provided to * {@link Gnomonic#Forward(double, double, double, double) Gnomonic.Forward} * and * {@link Gnomonic#Reverse(double, double, double, double) Gnomonic.Reverse} * and it always includes the fields x, y, azi. and * rk. **********************************************************************/ public class GnomonicData { /** * latitude of center point of projection (degrees). **********************************************************************/ public double lat0; /** * longitude of center point of projection (degrees). **********************************************************************/ public double lon0; /** * latitude of point (degrees). **********************************************************************/ public double lat; /** * longitude of point (degrees). **********************************************************************/ public double lon; /** * easting of point (meters). **********************************************************************/ public double x; /** * northing of point (meters). **********************************************************************/ public double y; /** * azimuth of geodesic at point (degrees). **********************************************************************/ public double azi; /** * reciprocal of azimuthal scale at point. **********************************************************************/ public double rk; /** * Initialize all the fields to Double.NaN. **********************************************************************/ public GnomonicData() { lat0 = lon0 = lat = lon = x = y = azi = rk = Double.NaN; } /** * Constructor initializing all the fields for gnomonic projection of a point * (lat, lon) given a center point of projection (lat0, * lon0). *

* @param lat0 * latitude of center point of projection (degrees). * @param lon0 * longitude of center point of projection (degrees). * @param lat * latitude of point (degrees). * @param lon * longitude of point (degrees). * @param x * easting of point (meters). * @param y * northing of point (meters). * @param azi * azimuth of geodesic at point (degrees). * @param rk * reciprocal of azimuthal scale at point. */ public GnomonicData(double lat0, double lon0, double lat, double lon, double x, double y, double azi, double rk) { this.lat0 = lat0; this.lon0 = lon0; this.lat = lat; this.lon = lon; this.x = x; this.y = y; this.azi = azi; this.rk = rk; } } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/GeoMath.java0000644000771000077100000002600412602735126025567 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeoMath class * * Copyright (c) Charles Karney (2013-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * Mathematical functions needed by GeographicLib. *

* Define mathematical functions and constants so that any version of Java * can be used. **********************************************************************/ public class GeoMath { /** * The number of binary digits in the fraction of a double precision * number (equivalent to C++'s {@code numeric_limits::digits}). **********************************************************************/ public static final int digits = 53; /** * Equivalent to C++'s {@code numeric_limits::epsilon()}. In Java * version 1.5 and later, Math.ulp(1.0) can be used. **********************************************************************/ public static final double epsilon = Math.pow(0.5, digits - 1); /** * Equivalent to C++'s {@code numeric_limits::min()}. In Java * version 1.6 and later, Double.MIN_NORMAL can be used. **********************************************************************/ public static final double min = Math.pow(0.5, 1022); /** * Square a number. *

* @param x the argument. * @return x2. **********************************************************************/ public static double sq(double x) { return x * x; } /** * The hypotenuse function avoiding underflow and overflow. In Java version * 1.5 and later, Math.hypot can be used. *

* @param x the first argument. * @param y the second argument. * @return sqrt(x2 + y2). **********************************************************************/ public static double hypot(double x, double y) { x = Math.abs(x); y = Math.abs(y); double a = Math.max(x, y), b = Math.min(x, y) / (a != 0 ? a : 1); return a * Math.sqrt(1 + b * b); // For an alternative method see // C. Moler and D. Morrision (1983) https://dx.doi.org/10.1147/rd.276.0577 // and A. A. Dubrulle (1983) https://dx.doi.org/10.1147/rd.276.0582 } /** * log(1 + x) accurate near x = 0. In Java version 1.5 and * later, Math.log1p can be used. *

* This is taken from D. Goldberg, * What every computer * scientist should know about floating-point arithmetic (1991), * Theorem 4. See also, N. J. Higham, Accuracy and Stability of Numerical * Algorithms, 2nd Edition (SIAM, 2002), Answer to Problem 1.5, p 528. *

* @param x the argument. * @return log(1 + x). **********************************************************************/ public static double log1p(double x) { double y = 1 + x, z = y - 1; // Here's the explanation for this magic: y = 1 + z, exactly, and z // approx x, thus log(y)/z (which is nearly constant near z = 0) returns // a good approximation to the true log(1 + x)/x. The multiplication x * // (log(y)/z) introduces little additional error. return z == 0 ? x : x * Math.log(y) / z; } /** * The inverse hyperbolic tangent function. This is defined in terms of * GeoMath.log1p(x) in order to maintain accuracy near x = 0. * In addition, the odd parity of the function is enforced. *

* @param x the argument. * @return atanh(x). **********************************************************************/ public static double atanh(double x) { double y = Math.abs(x); // Enforce odd parity y = Math.log1p(2 * y/(1 - y))/2; return x < 0 ? -y : y; } /** * The cube root function. In Java version 1.5 and later, Math.cbrt can be * used. *

* @param x the argument. * @return the real cube root of x. **********************************************************************/ public static double cbrt(double x) { double y = Math.pow(Math.abs(x), 1/3.0); // Return the real cube root return x < 0 ? -y : y; } public static Pair norm(double sinx, double cosx) { double r = hypot(sinx, cosx); return new Pair(sinx/r, cosx/r); } /** * The error-free sum of two numbers. *

* @param u the first number in the sum. * @param v the second number in the sum. * @return Pair(s, t) with s = round(u + * v) and t = u + v - s. *

* See D. E. Knuth, TAOCP, Vol 2, 4.2.2, Theorem B. **********************************************************************/ public static Pair sum(double u, double v) { double s = u + v; double up = s - v; double vpp = s - up; up -= u; vpp -= v; double t = -(up + vpp); // u + v = s + t // = round(u + v) + t return new Pair(s, t); } /** * Evaluate a polynomial. *

* @param N the order of the polynomial. * @param p the coefficient array (of size N + s + 1 or more). * @param s starting index for the array. * @param x the variable. * @return the value of the polynomial. * * Evaluate y = ∑n=0..N * ps+n * xNn. Return 0 if N < 0. * Return ps, if N = 0 (even if x is * infinite or a nan). The evaluation uses Horner's method. **********************************************************************/ public static double polyval(int N, double p[], int s, double x) { double y = N < 0 ? 0 : p[s++]; while (--N >= 0) y = y * x + p[s++]; return y; } public static double AngRound(double x) { // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^57 // for reals = 0.7 pm on the earth if x is an angle in degrees. (This // is about 1000 times more resolution than we get with angles around 90 // degrees.) We use this to avoid having to deal with near singular // cases when x is non-zero but tiny (e.g., 1.0e-200). This also converts // -0 to +0. final double z = 1/16.0; double y = Math.abs(x); // The compiler mustn't "simplify" z - (z - y) to y y = y < z ? z - (z - y) : y; return x < 0 ? 0 - y : y; } /** * Normalize an angle (restricted input range). *

* @param x the angle in degrees. * @return the angle reduced to the range [−180°, 180°). *

* The range of x is unrestricted. **********************************************************************/ public static double AngNormalize(double x) { x = x % 360.0; return x < -180 ? x + 360 : (x < 180 ? x : x - 360); } /** * Normalize a latitude. *

* @param x the angle in degrees. * @return x if it is in the range [−90°, 90°], otherwise * return NaN. **********************************************************************/ public static double LatFix(double x) { return Math.abs(x) > 90 ? Double.NaN : x; } /** * Difference of two angles reduced to [−180°, 180°] *

* @param x the first angle in degrees. * @param y the second angle in degrees. * @return yx, reduced to the range [−180°, * 180°]. *

* x and y must both lie in [−180°, 180°]. The * result is equivalent to computing the difference exactly, reducing it to * (−180°, 180°] and rounding the result. Note that this * prescription allows −180° to be returned (e.g., if x is * tiny and negative and y = 180°). **********************************************************************/ public static double AngDiff(double x, double y) { double d, t; { Pair r = sum(AngNormalize(x), AngNormalize(-y)); d = - AngNormalize(r.first); t = r.second; } return (d == 180 && t < 0 ? -180 : d) - t; } /** * Evaluate the sine and cosine function with the argument in degrees * * @param x in degrees. * @return Pair(s, t) with s = sin(x) and * c = cos(x). * * The results obey exactly the elementary properties of the trigonometric * functions, e.g., sin 9° = cos 81° = − sin 123456789°. **********************************************************************/ public static Pair sincosd(double x) { // In order to minimize round-off errors, this function exactly reduces // the argument to the range [-45, 45] before converting it to radians. double r; int q; r = x % 360.0; q = (int)Math.floor(r / 90 + 0.5); r -= 90 * q; // now abs(r) <= 45 r = Math.toRadians(r); // Possibly could call the gnu extension sincos double s = Math.sin(r), c = Math.cos(r); double sinx, cosx; switch (q & 3) { case 0: sinx = s; cosx = c; break; case 1: sinx = c; cosx = 0 - s; break; case 2: sinx = 0 - s; cosx = 0 - c; break; default: sinx = 0 - c; cosx = s; break; // case 3 } return new Pair(sinx, cosx); } /** * Evaluate the atan2 function with the result in degrees * * @param y * @param x * @return atan2(y, x) in degrees. * * The result is in the range [−180° 180°). N.B., * atan2d(±0, −1) = −180°; atan2d(+ε, * −1) = +180°, for ε positive and tiny; * atan2d(±0, 1) = ±0°. **********************************************************************/ public static double atan2d(double y, double 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; if (Math.abs(y) > Math.abs(x)) { double t; t = x; x = y; y = t; q = 2; } if (x < 0) { x = -x; ++q; } // here x >= 0 and x >= abs(y), so angle is in [-pi/4, pi/4] double ang = Math.toDegrees(Math.atan2(y, x)); 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; // // and handle mpfr as in AngRound. case 1: ang = (y > 0 ? 180 : -180) - ang; break; case 2: ang = 90 - ang; break; case 3: ang = -90 + ang; break; } return ang; } /** * Test for finiteness. *

* @param x the argument. * @return true if number is finite, false if NaN or infinite. **********************************************************************/ public static boolean isfinite(double x) { return Math.abs(x) <= Double.MAX_VALUE; } private GeoMath() {} } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/Pair.java0000644000771000077100000000215012602735126025132 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Pair class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * A pair of double precision numbers. *

* This duplicates the C++ class {@code std::pair}. **********************************************************************/ public class Pair { /** * The first member of the pair. **********************************************************************/ public double first; /** * The second member of the pair. **********************************************************************/ public double second; /** * Constructor *

* @param first the first member of the pair. * @param second the second member of the pair. **********************************************************************/ public Pair(double first, double second) { this.first = first; this.second = second; } } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/Accumulator.java0000644000771000077100000001112312602735126026516 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Accumulator class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * An accumulator for sums. *

* This allow many double precision numbers to be added together with twice the * normal precision. Thus the effective precision of the sum is 106 bits or * about 32 decimal places. *

* The implementation follows J. R. Shewchuk, * Adaptive Precision * Floating-Point Arithmetic and Fast Robust Geometric Predicates, * Discrete & Computational Geometry 18(3) 305–363 (1997). *

* In the documentation of the member functions, sum stands for the value * currently held in the accumulator. ***********************************************************************/ public class Accumulator { // _s + _t accumulators for the sum. private double _s, _t; /** * Construct from a double. *

* @param y set sum = y. **********************************************************************/ public Accumulator(double y) { _s = y; _t = 0; } /** * Construct from another Accumulator. *

* @param a set sum = a. **********************************************************************/ public Accumulator(Accumulator a) { _s = a._s; _t = a._t; } /** * Set the value to a double. *

* @param y set sum = y. **********************************************************************/ public void Set(double y) { _s = y; _t = 0; } /** * Return the value held in the accumulator. *

* @return sum. **********************************************************************/ public double Sum() { return _s; } /** * Return the result of adding a number to sum (but don't change * sum). *

* @param y the number to be added to the sum. * @return sum + y. **********************************************************************/ public double Sum(double y) { Accumulator a = new Accumulator(this); a.Add(y); return a._s; } /** * Add a number to the accumulator. *

* @param y set sum += y. **********************************************************************/ public void Add(double y) { // Here's Shewchuk's solution... double u; // hold exact sum as [s, t, u] // Accumulate starting at least significant end { Pair r = GeoMath.sum(y, _t); y = r.first; u = r.second; } { Pair r = GeoMath.sum(y, _s); _s = r.first; _t = r.second; } // Start is _s, _t decreasing and non-adjacent. Sum is now (s + t + u) // exactly with s, t, u non-adjacent and in decreasing order (except for // possible zeros). The following code tries to normalize the result. // Ideally, we want _s = round(s+t+u) and _u = round(s+t+u - _s). The // following does an approximate job (and maintains the decreasing // non-adjacent property). Here are two "failures" using 3-bit floats: // // Case 1: _s is not equal to round(s+t+u) -- off by 1 ulp // [12, -1] - 8 -> [4, 0, -1] -> [4, -1] = 3 should be [3, 0] = 3 // // Case 2: _s+_t is not as close to s+t+u as it shold be // [64, 5] + 4 -> [64, 8, 1] -> [64, 8] = 72 (off by 1) // should be [80, -7] = 73 (exact) // // "Fixing" these problems is probably not worth the expense. The // representation inevitably leads to small errors in the accumulated // values. The additional errors illustrated here amount to 1 ulp of the // less significant word during each addition to the Accumulator and an // additional possible error of 1 ulp in the reported sum. // // Incidentally, the "ideal" representation described above is not // canonical, because _s = round(_s + _t) may not be true. For example, // with 3-bit floats: // // [128, 16] + 1 -> [160, -16] -- 160 = round(145). // But [160, 0] - 16 -> [128, 16] -- 128 = round(144). // if (_s == 0) // This implies t == 0, _s = u; // so result is u else _t += u; // otherwise just accumulate u to t. } /** * Negate an accumulator. *

* Set sum = −sum. **********************************************************************/ public void Negate() { _s = -_s; _t = -_t; } } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/Gnomonic.java0000644000771000077100000002667412602735126026031 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Gnomonic class * * Copyright (c) BMW Car IT GmbH (2014) and * licensed under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * Gnomonic projection. *

* Note: Gnomonic.java has been ported to Java from its C++ equivalent * Gnomonic.cpp, authored by C. F. F. Karney and licensed under MIT/X11 * license. The following documentation is mostly the same as for its C++ * equivalent, but has been adopted to apply to this Java implementation. *

* Gnomonic projection centered at an arbitrary position C on the * ellipsoid. This projection is derived in Section 8 of *

*

* The gnomonic projection of a point P on the ellipsoid is defined as * follows: compute the geodesic line from C to P; compute the * reduced length m12, geodesic scale M12, and ρ = * m12/M12; finally, this gives the coordinates x and * y of P in gnomonic projection with x = ρ sin * azi1; y = ρ cos azi1, where azi1 is the * azimuth of the geodesic at C. The method * {@link Gnomonic#Forward(double, double, double, double)} performs the * forward projection and * {@link Gnomonic#Reverse(double, double, double, double)} is the * inverse of the projection. The methods also return the azimuth * azi of the geodesic at P and reciprocal scale * rk in the azimuthal direction. The scale in the radial * direction is 1/rk2. *

* For a sphere, ρ reduces to a tan(s12/a), where * s12 is the length of the geodesic from C to P, and the * gnomonic projection has the property that all geodesics appear as straight * lines. For an ellipsoid, this property holds only for geodesics interesting * the centers. However geodesic segments close to the center are approximately * straight. *

* Consider a geodesic segment of length l. Let T be the point on * the geodesic (extended if necessary) closest to C, the center of the * projection, and t, be the distance CT. To lowest order, the * maximum deviation (as a true distance) of the corresponding gnomonic line * segment (i.e., with the same end points) from the geodesic is
*
* (K(T) - K(C)) l2 t / 32. *
*
* where K is the Gaussian curvature. *

* This result applies for any surface. For an ellipsoid of revolution, * consider all geodesics whose end points are within a distance r of * C. For a given r, the deviation is maximum when the latitude * of C is 45°, when endpoints are a distance r away, and * when their azimuths from the center are ± 45° or ± * 135°. To lowest order in r and the flattening f, the * deviation is f (r/2a)3 r. *

* The conversions all take place using a Geodesic object (by default * Geodesic::WGS84). For more information on geodesics see \ref geodesic. *

* CAUTION: The definition of this projection for a sphere is standard. * However, there is no standard for how it should be extended to an ellipsoid. * The choices are: *

    *
  • * Declare that the projection is undefined for an ellipsoid. *
  • *
  • * Project to a tangent plane from the center of the ellipsoid. This causes * great ellipses to appear as straight lines in the projection; i.e., it * generalizes the spherical great circle to a great ellipse. This was proposed * by independently by Bowring and Williams in 1997. *
  • *
  • * Project to the conformal sphere with the constant of integration chosen so * that the values of the latitude match for the center point and perform a * central projection onto the plane tangent to the conformal sphere at the * center point. This causes normal sections through the center point to appear * as straight lines in the projection; i.e., it generalizes the spherical * great circle to a normal section. This was proposed by I. G. Letoval'tsev, * Generalization of the gnomonic projection for a spheroid and the principal * geodetic problems involved in the alignment of surface routes, Geodesy and * Aerophotography (5), 271–274 (1963). *
  • *
  • * The projection given here. This causes geodesics close to the center point * to appear as straight lines in the projection; i.e., it generalizes the * spherical great circle to a geodesic. *
  • *
*

* Example of use: * *

 * // Example of using the Gnomonic.java class
 * import net.sf.geographiclib.Geodesic;
 * import net.sf.geographiclib.Gnomonic;
 * import net.sf.geographiclib.GnomonicData;
 * public class ExampleGnomonic {
 *   public static void main(String[] args) {
 *     Geodesic geod = Geodesic.WGS84;
 *     double lat0 = 48 + 50 / 60.0, lon0 = 2 + 20 / 60.0; // Paris
 *     Gnomonic gnom = new Gnomonic(geod);
 *     {
 *       // Sample forward calculation
 *       double lat = 50.9, lon = 1.8; // Calais
 *       GnomonicData proj = gnom.Forward(lat0, lon0, lat, lon);
 *       System.out.println(proj.x + " " + proj.y);
 *     }
 *     {
 *       // Sample reverse calculation
 *       double x = -38e3, y = 230e3;
 *       GnomonicData proj = gnom.Reverse(lat0, lon0, x, y);
 *       System.out.println(proj.lat + " " + proj.lon);
 *     }
 *   }
 * }
 * 
*/ public class Gnomonic { private static final double eps_ = 0.01 * Math.sqrt(GeoMath.epsilon); private static final int numit_ = 10; private Geodesic _earth; private double _a, _f; /** * Constructor for Gnomonic. *

* @param earth the {@link Geodesic} object to use for geodesic * calculations. By default the WGS84 ellipsoid should be used. */ public Gnomonic(Geodesic earth) { _earth = earth; _a = _earth.MajorRadius(); _f = _earth.Flattening(); } /** * Forward projection, from geographic to gnomonic. *

* @param lat0 latitude of center point of projection (degrees). * @param lon0 longitude of center point of projection (degrees). * @param lat latitude of point (degrees). * @param lon longitude of point (degrees). * @return {@link GnomonicData} object with the following fields: * lat0, lon0, lat, lon, x, y, * azi, rk. *

* lat0 and lat should be in the range [−90°, * 90°] and lon0 and lon should be in the range * [−540°, 540°). The scale of the projection is * 1/rk2 in the "radial" direction, azi clockwise * from true north, and is 1/rk in the direction perpendicular to * this. If the point lies "over the horizon", i.e., if rk ≤ 0, * then NaNs are returned for x and y (the correct values are * returned for azi and rk). A call to Forward followed by a * call to Reverse will return the original (lat, lon) (to * within roundoff) provided the point in not over the horizon. */ public GnomonicData Forward(double lat0, double lon0, double lat, double lon) { GeodesicData inv = _earth.Inverse(lat0, lon0, lat, lon, GeodesicMask.AZIMUTH | GeodesicMask.GEODESICSCALE | GeodesicMask.REDUCEDLENGTH); GnomonicData fwd = new GnomonicData(lat0, lon0, lat, lon, Double.NaN, Double.NaN, inv.azi2, inv.M12); if (inv.M12 > 0) { double rho = inv.m12 / inv.M12; Pair p = GeoMath.sincosd(inv.azi1); fwd.x = rho * p.first; fwd.y = rho * p.second; } return fwd; } /** * Reverse projection, from gnomonic to geographic. *

* @param lat0 latitude of center point of projection (degrees). * @param lon0 longitude of center point of projection (degrees). * @param x easting of point (meters). * @param y northing of point (meters). * @return {@link GnomonicData} object with the following fields: * lat0, lon0, lat, lon, x, y, * azi, rk. *

* lat0 should be in the range [−90°, 90°] and * lon0 should be in the range [−540°, 540°). * lat will be in the range [−90°, 90°] and lon * will be in the range [−180°, 180°). The scale of the * projection is 1/rk2 in the "radial" direction, * azi clockwise from true north, and is 1/rk in the direction * perpendicular to this. Even though all inputs should return a valid * lat and lon, it's possible that the procedure fails to * converge for very large x or y; in this case NaNs are * returned for all the output arguments. A call to Reverse followed by a * call to Forward will return the original (x, y) (to * roundoff). */ public GnomonicData Reverse(double lat0, double lon0, double x, double y) { GnomonicData rev = new GnomonicData(lat0, lon0, Double.NaN, Double.NaN, x, y, Double.NaN, Double.NaN); double azi0 = GeoMath.atan2d(x, y); double rho = Math.hypot(x, y); double s = _a * Math.atan(rho / _a); boolean little = rho <= _a; if (!little) rho = 1 / rho; GeodesicLine line = _earth.Line(lat0, lon0, azi0, GeodesicMask.LATITUDE | GeodesicMask.LONGITUDE | GeodesicMask.AZIMUTH | GeodesicMask.DISTANCE_IN | GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE); int count = numit_, trip = 0; GeodesicData pos = null; while (count-- > 0) { pos = line.Position(s, GeodesicMask.LONGITUDE | GeodesicMask.LATITUDE | GeodesicMask.AZIMUTH | GeodesicMask.DISTANCE_IN | GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE); if (trip > 0) break; double ds = little ? ((pos.m12 / pos.M12) - rho) * pos.M12 * pos.M12 : (rho - (pos.M12 / pos.m12)) * pos.m12 * pos.m12; s -= ds; if (Math.abs(ds) <= eps_ * _a) trip++; } if (trip == 0) return rev; rev.lat = pos.lat2; rev.lon = pos.lon2; rev.azi = pos.azi2; rev.rk = pos.M12; return rev; } /** * @return a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ public double MajorRadius() { return _a; } /** * @return f the flattening of the ellipsoid. This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ public double Flattening() { return _f; } } GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/package-info.java0000644000771000077100000002237412602735126026575 0ustar ckarneyckarney/** *

Geodesic routines from GeographicLib implemented in Java

* @author Charles F. F. Karney (charles@karney.com) * @version 1.45 * *

Abstract

*

* GeographicLib-Java is a Java implementation of the geodesic algorithms from * GeographicLib. This is a * self-contained library which makes it easy to do geodesic computations for * an ellipsoid of revolution in a Java program. It requires Java version 1.2 * or later. * *

Downloading

*

* Download either the source or the pre-built package as follows: * *

Obtaining the source

* GeographicLib-Java is part of GeographicLib which available for download at * *

* as either a compressed tar file (tar.gz) or a zip file. After unpacking * the source, the Java library can be found in GeographicLib-1.45/java. (This * library is completely independent from the rest of GeodegraphicLib.) The * library consists of the files in the src/main/java/net/sf/geographiclib * subdirectory. * *

The pre-built package

* GeographicLib-Java is available as a pre-built package on Maven Central * (thanks to Chris Bennight for help on this deployment). So, if you use * maven to build your code, you just * need to include the dependency
{@code
 *   
 *     net.sf.geographiclib
 *     GeographicLib-Java
 *     1.45
 *    }
* in your {@code pom.xml}. * *

Sample programs

*

* Included with the source are 3 small test programs *

    *
  • * {@code direct/src/main/java/Direct.java} is a simple command line utility * for solving the direct geodesic problem; *
  • * {@code inverse/src/main/java/Inverse.java} is a simple command line * utility for solving the inverse geodesic problem; *
  • * {@code planimeter/src/main/java/Planimeter.java} is a simple command line * utility for computing the area of a geodesic polygon given its vertices. *
*

* Here, for example, is {@code Inverse.java}

{@code
 * // Solve the inverse geodesic problem.
 *
 * // This program reads in lines with lat1, lon1, lat2, lon2 and prints
 * // out lines with azi1, azi2, s12 (for the WGS84 ellipsoid).
 *
 * import java.util.*;
 * import net.sf.geographiclib.*;
 * public class Inverse {
 *   public static void main(String[] args) {
 *     try {
 *       Scanner in = new Scanner(System.in);
 *       double lat1, lon1, lat2, lon2;
 *       while (true) {
 *         lat1 = in.nextDouble(); lon1 = in.nextDouble();
 *         lat2 = in.nextDouble(); lon2 = in.nextDouble();
 *         GeodesicData g = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2);
 *         System.out.println(g.azi1 + " " + g.azi2 + " " + g.s12);
 *       }
 *     }
 *     catch (Exception e) {}
 *   }
 * }}
* *

Compiling and running a sample program

*

* Three difference ways of compiling and running {@code Inverse.java} are * given. These differ in the degree to which they utilize * maven to manage your Java code and * its dependencies. (Thanks to Skip Breidbach for supplying the maven * support.) * *

Without using maven

* Compile and run as follows
 * cd inverse/src/main/java
 * javac -cp .:../../../../src/main/java Inverse.java
 * echo -30 0 29.5 179.5 | java -cp .:../../../../src/main/java Inverse 
* *

Using maven to package GeographicLib

* Use maven to create a jar file by * running (in the main java directory)
 * mvn package 
* (Your first run of maven may take a long time, because it needs to download * some additional packages to your local repository.) Then compile and run * Inverse.java with
 * cd inverse/src/main/java
 * javac -cp .:../../../../target/GeographicLib-Java-1.45.jar Inverse.java
 * echo -30 0 29.5 179.5 |
 *   java -cp .:../../../../target/GeographicLib-Java-1.45.jar Inverse 
* *

Using maven to build and run {@code Inverse.java}

* The sample code includes a {@code pom.xml} which specifies * GeographicLib-Jave as a dependency. You can build and install this * dependency by running (in the main java directory)
 * mvn install 
* Alternatively, you can let maven download it from Maven Central. You can * compile and run Inverse.java with
 * cd inverse
 * mvn compile
 * echo -30 0 29.5 179.5 | mvn -q exec:java 
* *

Using the library

*

*

    *
  • * Put
     *   import net.sf.geographiclib.*
    * in your source code. *
  • * Make calls to the geodesic routines from your code. *
  • * Compile and run in one of the ways described above. *
*

* The important classes are *

    *
  • * {@link net.sf.geographiclib.Geodesic}, for direct and inverse geodesic * calculations; *
  • * {@link net.sf.geographiclib.GeodesicLine}, an efficient way of * calculating multiple points on a single geodesic; *
  • * {@link net.sf.geographiclib.GeodesicData}, the object containing the * results of the geodesic calculations; *
  • * {@link net.sf.geographiclib.GeodesicMask}, the constants that let you * specify the variables to return in {@link * net.sf.geographiclib.GeodesicData} and the capabilities of a {@link * net.sf.geographiclib.GeodesicLine}; *
  • * {@link net.sf.geographiclib.Constants}, the parameters for the WGS84 * ellipsoid; *
  • * {@link net.sf.geographiclib.PolygonArea}, a class to compute the * perimeter and area of a geodesic polygon (returned as a {@link * net.sf.geographiclib.PolygonResult}). *
*

* The documentation is generated using javadoc when * {@code mvn package -P release} is run (the top of the documentation tree is * {@code target/apidocs/index.html}). This is also available on the web at * * http://geographiclib.sf.net/html/java/index.html. * *

External links

*

*

* *

Change log

*

*

    *
  • * Version 1.45 * (released 2015-09-30) *
      *
    • * The solution of the inverse problem now correctly returns NaNs if * one of the latitudes is a NaN. *
    • * Add implementation of the ellipsoidal * {@link net.sf.geographiclib.Gnomonic} (courtesy of Sebastian Mattheis). *
    • * Math.toRadians and Math.toDegrees are used instead of GeoMath.degree * (which is now removed). This requires Java 1.2 or later (released * 1998-12). *
    *
  • * Version 1.44 * (released 2015-08-14) *
      *
    • * 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 [−540°, 540°). *
    • * Enforce the restriction of latitude to [−90°, 90°] by * returning NaNs if the latitude is outside this range. *
    • * Geodesic.Inverse sets s12 to zero for coincident points at pole * (instead of returning a tiny quantity). *
    • * Geodesic.Inverse pays attentions to the GeodesicMask.LONG_UNROLL bit in * outmask. *
    *
**********************************************************************/ package net.sf.geographiclib; GeographicLib-1.45/java/src/main/java/net/sf/geographiclib/PolygonArea.java0000644000771000077100000003613112602735126026465 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.PolygonArea class * * Copyright (c) Charles Karney (2013-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ package net.sf.geographiclib; /** * Polygon areas. *

* This computes the area of a geodesic polygon using the method given * Section 6 of *

*

* This class lets you add vertices one at a time to the polygon. 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. There's an * option to treat the points as defining a polyline instead of a polygon; in * that case, only the perimeter is computed. *

* Example of use: *

 * {@code
 * // Compute the area of a geodesic polygon.
 *
 * // This program reads lines with lat, lon for each vertex of a polygon.
 * // At the end of input, the program prints the number of vertices,
 * // the perimeter of the polygon and its area (for the WGS84 ellipsoid).
 *
 * import java.util.*;
 * import net.sf.geographiclib.*;
 *
 * public class Planimeter {
 *   public static void main(String[] args) {
 *     PolygonArea p = new PolygonArea(Geodesic.WGS84, false);
 *     try {
 *       Scanner in = new Scanner(System.in);
 *       while (true) {
 *         double lat = in.nextDouble(), lon = in.nextDouble();
 *         p.AddPoint(lat, lon);
 *       }
 *     }
 *     catch (Exception e) {}
 *     PolygonResult r = p.Compute();
 *     System.out.println(r.num + " " + r.perimeter + " " + r.area);
 *   }
 * }}
**********************************************************************/ public class PolygonArea { private Geodesic _earth; private double _area0; // Full ellipsoid area private boolean _polyline; // Assume polyline (don't close and skip area) private int _mask; private int _num; private int _crossings; private Accumulator _areasum, _perimetersum; private double _lat0, _lon0, _lat1, _lon1; private static int transit(double lon1, double lon2) { // 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 = GeoMath.AngNormalize(lon1); lon2 = GeoMath.AngNormalize(lon2); double lon12 = GeoMath.AngDiff(lon1, lon2); int cross = lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 : (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0); return cross; } // an alternate version of transit to deal with longitudes in the direct // problem. private static int transitdirect(double lon1, double lon2) { // We want to compute exactly // int(floor(lon2 / 360)) - int(floor(lon1 / 360)) // Since we only need the parity of the result we can use std::remquo but // this is buggy with g++ 4.8.3 and requires C++11. So instead we do lon1 = lon1 % 720.0; lon2 = lon2 % 720.0; return ( ((lon2 >= 0 && lon2 < 360) || lon2 < -360 ? 0 : 1) - ((lon1 >= 0 && lon1 < 360) || lon1 < -360 ? 0 : 1) ); } /** * Constructor for PolygonArea. *

* @param earth the Geodesic object to use for geodesic calculations. * @param polyline if true that treat the points as defining a polyline * instead of a polygon. **********************************************************************/ public PolygonArea(Geodesic earth, boolean polyline) { _earth = earth; _area0 = _earth.EllipsoidArea(); _polyline = polyline; _mask = GeodesicMask.LATITUDE | GeodesicMask.LONGITUDE | GeodesicMask.DISTANCE | (_polyline ? GeodesicMask.NONE : GeodesicMask.AREA | GeodesicMask.LONG_UNROLL); _perimetersum = new Accumulator(0); if (!_polyline) _areasum = new Accumulator(0); Clear(); } /** * Clear PolygonArea, allowing a new polygon to be started. **********************************************************************/ public void Clear() { _num = 0; _crossings = 0; _perimetersum.Set(0); if (!_polyline) _areasum.Set(0); _lat0 = _lon0 = _lat1 = _lon1 = Double.NaN; } /** * Add a point to the polygon or polyline. *

* @param lat the latitude of the point (degrees). * @param lon the latitude of the point (degrees). *

* lat should be in the range [−90°, 90°]. **********************************************************************/ public void AddPoint(double lat, double lon) { lon = GeoMath.AngNormalize(lon); if (_num == 0) { _lat0 = _lat1 = lat; _lon0 = _lon1 = lon; } else { GeodesicData g = _earth.Inverse(_lat1, _lon1, lat, lon, _mask); _perimetersum.Add(g.s12); if (!_polyline) { _areasum.Add(g.S12); _crossings += transit(_lon1, lon); } _lat1 = lat; _lon1 = lon; } ++_num; } /** * Add an edge to the polygon or polyline. *

* @param azi azimuth at current point (degrees). * @param s distance from current point to next point (meters). *

* This does nothing if no points have been added yet. Use * PolygonArea.CurrentPoint to determine the position of the new vertex. **********************************************************************/ public void AddEdge(double azi, double s) { if (_num > 0) { // Do nothing if _num is zero GeodesicData g = _earth.Direct(_lat1, _lon1, azi, s, _mask); _perimetersum.Add(g.s12); if (!_polyline) { _areasum.Add(g.S12); _crossings += transitdirect(_lon1, g.lon2); } _lat1 = g.lat2; _lon1 = g.lon2; ++_num; } } /** * Return the results so far. *

* @return PolygonResult(num, perimeter, area) where * num is the number of vertices, perimeter is the perimeter * of the polygon or the length of the polyline (meters), and area * is the area of the polygon (meters2) or Double.NaN of * polyline is true in the constructor. *

* Counter-clockwise traversal counts as a positive area. **********************************************************************/ public PolygonResult Compute() { return Compute(false, true); } /** * Return the results so far. *

* @param reverse if true then clockwise (instead of counter-clockwise) * traversal counts as a positive area. * @param sign if true 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. * @return PolygonResult(num, perimeter, area) where * num is the number of vertices, perimeter is the perimeter * of the polygon or the length of the polyline (meters), and area * is the area of the polygon (meters2) or Double.NaN of * polyline is true in the constructor. *

* More points can be added to the polygon after this call. **********************************************************************/ public PolygonResult Compute(boolean reverse, boolean sign) { if (_num < 2) return new PolygonResult(_num, 0, _polyline ? Double.NaN : 0); if (_polyline) return new PolygonResult(_num, _perimetersum.Sum(), Double.NaN); GeodesicData g = _earth.Inverse(_lat1, _lon1, _lat0, _lon0, _mask); Accumulator tempsum = new Accumulator(_areasum); tempsum.Add(g.S12); int crossings = _crossings + transit(_lon1, _lon0); if ((crossings & 1) != 0) tempsum.Add((tempsum.Sum() < 0 ? 1 : -1) * _area0/2); // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) tempsum.Negate(); // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (tempsum.Sum() > _area0/2) tempsum.Add(-_area0); else if (tempsum.Sum() <= -_area0/2) tempsum.Add(+_area0); } else { if (tempsum.Sum() >= _area0) tempsum.Add(-_area0); else if (tempsum.Sum() < 0) tempsum.Add(+_area0); } return new PolygonResult(_num, _perimetersum.Sum(g.s12), 0 + tempsum.Sum()); } /** * 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 AddPoint and Compute are used. *

* @param lat the latitude of the test point (degrees). * @param lon the longitude of the test point (degrees). * @param reverse if true then clockwise (instead of counter-clockwise) * traversal counts as a positive area. * @param sign if true 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. * @return PolygonResult(num, perimeter, area) where * num is the number of vertices, perimeter is the perimeter * of the polygon or the length of the polyline (meters), and area * is the area of the polygon (meters2) or Double.NaN of * polyline is true in the constructor. *

* lat should be in the range [−90°, 90°]. **********************************************************************/ public PolygonResult TestPoint(double lat, double lon, boolean reverse, boolean sign) { if (_num == 0) return new PolygonResult(1, 0, _polyline ? Double.NaN : 0); double perimeter = _perimetersum.Sum(); double tempsum = _polyline ? 0 : _areasum.Sum(); int crossings = _crossings; int num = _num + 1; for (int i = 0; i < (_polyline ? 1 : 2); ++i) { GeodesicData g = _earth.Inverse(i == 0 ? _lat1 : lat, i == 0 ? _lon1 : lon, i != 0 ? _lat0 : lat, i != 0 ? _lon0 : lon, _mask); perimeter += g.s12; if (!_polyline) { tempsum += g.S12; crossings += transit(i == 0 ? _lon1 : lon, i != 0 ? _lon0 : lon); } } if (_polyline) return new PolygonResult(num, perimeter, Double.NaN); if ((crossings & 1) != 0) tempsum += (tempsum < 0 ? 1 : -1) * _area0/2; // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) tempsum *= -1; // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (tempsum > _area0/2) tempsum -= _area0; else if (tempsum <= -_area0/2) tempsum += _area0; } else { if (tempsum >= _area0) tempsum -= _area0; else if (tempsum < 0) tempsum += _area0; } return new PolygonResult(num, perimeter, 0 + tempsum); } /** * 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 AddPoint and Compute are used. *

* @param azi azimuth at current point (degrees). * @param s distance from current point to final test point (meters). * @param reverse if true then clockwise (instead of counter-clockwise) * traversal counts as a positive area. * @param sign if true 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. * @return PolygonResult(num, perimeter, area) where * num is the number of vertices, perimeter is the perimeter * of the polygon or the length of the polyline (meters), and area * is the area of the polygon (meters2) or Double.NaN of * polyline is true in the constructor. **********************************************************************/ public PolygonResult TestEdge(double azi, double s, boolean reverse, boolean sign) { if (_num == 0) // we don't have a starting point! return new PolygonResult(0, Double.NaN, Double.NaN); int num = _num + 1; double perimeter = _perimetersum.Sum() + s; if (_polyline) return new PolygonResult(num, perimeter, Double.NaN); double tempsum = _areasum.Sum(); int crossings = _crossings; { double lat, lon, s12, S12, t; GeodesicData g = _earth.Direct(_lat1, _lon1, azi, false, s, _mask); tempsum += g.S12; crossings += transitdirect(_lon1, g.lon2); g = _earth.Inverse(g.lat2, g.lon2, _lat0, _lon0, _mask); perimeter += g.s12; tempsum += g.S12; crossings += transit(g.lon2, _lon0); } if ((crossings & 1) != 0) tempsum += (tempsum < 0 ? 1 : -1) * _area0/2; // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) tempsum *= -1; // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (tempsum > _area0/2) tempsum -= _area0; else if (tempsum <= -_area0/2) tempsum += _area0; } else { if (tempsum >= _area0) tempsum -= _area0; else if (tempsum < 0) tempsum += _area0; } return new PolygonResult(num, perimeter, 0 + tempsum); } /** * @return a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ public double MajorRadius() { return _earth.MajorRadius(); } /** * @return f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ public double Flattening() { return _earth.Flattening(); } /** * Report the previous vertex added to the polygon or polyline. *

* @return Pair(lat, lon), the current latitude and longitude. *

* If no points have been added, then Double.NaN is returned. Otherwise, * lon will be in the range [−180°, 180°). **********************************************************************/ public Pair CurrentPoint() { return new Pair(_lat1, _lon1); } } GeographicLib-1.45/java/src/test/java/net/sf/geographiclib/GeodesicTest.java0000644000771000077100000005003412602735126026660 0ustar ckarneyckarneypackage net.sf.geographiclib.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; import net.sf.geographiclib.*; public class GeodesicTest { private static boolean isNaN(double x) { return x != x; } private static final PolygonArea polygon = new PolygonArea(Geodesic.WGS84, false); private static final PolygonArea polyline = new PolygonArea(Geodesic.WGS84, true); private static PolygonResult Planimeter(double points[][]) { polygon.Clear(); for (int i = 0; i < points.length; ++i) { polygon.AddPoint(points[i][0], points[i][1]); } return polygon.Compute(false, true); } private static PolygonResult PolyLength(double points[][]) { polyline.Clear(); for (int i = 0; i < points.length; ++i) { polyline.AddPoint(points[i][0], points[i][1]); } return polyline.Compute(false, true); } private static final double testcases[][] = { {35.60777, -139.44815, 111.098748429560326, -11.17491, -69.95921, 129.289270889708762, 8935244.5604818305, 80.50729714281974, 6273170.2055303837, 0.16606318447386067, 0.16479116945612937, 12841384694976.432}, {55.52454, 106.05087, 22.020059880982801, 77.03196, 197.18234, 109.112041110671519, 4105086.1713924406, 36.892740690445894, 3828869.3344387607, 0.80076349608092607, 0.80101006984201008, 61674961290615.615}, {-21.97856, 142.59065, -32.44456876433189, 41.84138, 98.56635, -41.84359951440466, 8394328.894657671, 75.62930491011522, 6161154.5773110616, 0.24816339233950381, 0.24930251203627892, -6637997720646.717}, {-66.99028, 112.2363, 173.73491240878403, -12.70631, 285.90344, 2.512956620913668, 11150344.2312080241, 100.278634181155759, 6289939.5670446687, -0.17199490274700385, -0.17722569526345708, -121287239862139.744}, {-17.42761, 173.34268, -159.033557661192928, -15.84784, 5.93557, -20.787484651536988, 16076603.1631180673, 144.640108810286253, 3732902.1583877189, -0.81273638700070476, -0.81299800519154474, 97825992354058.708}, {32.84994, 48.28919, 150.492927788121982, -56.28556, 202.29132, 48.113449399816759, 16727068.9438164461, 150.565799985466607, 3147838.1910180939, -0.87334918086923126, -0.86505036767110637, -72445258525585.010}, {6.96833, 52.74123, 92.581585386317712, -7.39675, 206.17291, 90.721692165923907, 17102477.2496958388, 154.147366239113561, 2772035.6169917581, -0.89991282520302447, -0.89986892177110739, -1311796973197.995}, {-50.56724, -16.30485, -105.439679907590164, -33.56571, -94.97412, -47.348547835650331, 6455670.5118668696, 58.083719495371259, 5409150.7979815838, 0.53053508035997263, 0.52988722644436602, 41071447902810.047}, {-58.93002, -8.90775, 140.965397902500679, -8.91104, 133.13503, 19.255429433416599, 11756066.0219864627, 105.755691241406877, 6151101.2270708536, -0.26548622269867183, -0.27068483874510741, -86143460552774.735}, {-68.82867, -74.28391, 93.774347763114881, -50.63005, -8.36685, 34.65564085411343, 3956936.926063544, 35.572254987389284, 3708890.9544062657, 0.81443963736383502, 0.81420859815358342, -41845309450093.787}, {-10.62672, -32.0898, -86.426713286747751, 5.883, -134.31681, -80.473780971034875, 11470869.3864563009, 103.387395634504061, 6184411.6622659713, -0.23138683500430237, -0.23155097622286792, 4198803992123.548}, {-21.76221, 166.90563, 29.319421206936428, 48.72884, 213.97627, 43.508671946410168, 9098627.3986554915, 81.963476716121964, 6299240.9166992283, 0.13965943368590333, 0.14152969707656796, 10024709850277.476}, {-19.79938, -174.47484, 71.167275780171533, -11.99349, -154.35109, 65.589099775199228, 2319004.8601169389, 20.896611684802389, 2267960.8703918325, 0.93427001867125849, 0.93424887135032789, -3935477535005.785}, {-11.95887, -116.94513, 92.712619830452549, 4.57352, 7.16501, 78.64960934409585, 13834722.5801401374, 124.688684161089762, 5228093.177931598, -0.56879356755666463, -0.56918731952397221, -9919582785894.853}, {-87.85331, 85.66836, -65.120313040242748, 66.48646, 16.09921, -4.888658719272296, 17286615.3147144645, 155.58592449699137, 2635887.4729110181, -0.90697975771398578, -0.91095608883042767, 42667211366919.534}, {1.74708, 128.32011, -101.584843631173858, -11.16617, 11.87109, -86.325793296437476, 12942901.1241347408, 116.650512484301857, 5682744.8413270572, -0.44857868222697644, -0.44824490340007729, 10763055294345.653}, {-25.72959, -144.90758, -153.647468693117198, -57.70581, -269.17879, -48.343983158876487, 9413446.7452453107, 84.664533838404295, 6356176.6898881281, 0.09492245755254703, 0.09737058264766572, 74515122850712.444}, {-41.22777, 122.32875, 14.285113402275739, -7.57291, 130.37946, 10.805303085187369, 3812686.035106021, 34.34330804743883, 3588703.8812128856, 0.82605222593217889, 0.82572158200920196, -2456961531057.857}, {11.01307, 138.25278, 79.43682622782374, 6.62726, 247.05981, 103.708090215522657, 11911190.819018408, 107.341669954114577, 6070904.722786735, -0.29767608923657404, -0.29785143390252321, 17121631423099.696}, {-29.47124, 95.14681, -163.779130441688382, -27.46601, -69.15955, -15.909335945554969, 13487015.8381145492, 121.294026715742277, 5481428.9945736388, -0.51527225545373252, -0.51556587964721788, 104679964020340.318}}; @Test public void InverseCheck() { for (int i = 0; i < testcases.length; ++i) { double lat1 = testcases[i][0], lon1 = testcases[i][1], azi1 = testcases[i][2], lat2 = testcases[i][3], lon2 = testcases[i][4], azi2 = testcases[i][5], s12 = testcases[i][6], a12 = testcases[i][7], m12 = testcases[i][8], M12 = testcases[i][9], M21 = testcases[i][10], S12 = testcases[i][11]; GeodesicData inv = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2, GeodesicMask.ALL | GeodesicMask.LONG_UNROLL); assertEquals(lon2, inv.lon2, 1e-13); assertEquals(azi1, inv.azi1, 1e-13); assertEquals(azi2, inv.azi2, 1e-13); assertEquals(s12, inv.s12, 1e-8); assertEquals(a12, inv.a12, 1e-13); assertEquals(m12, inv.m12, 1e-8); assertEquals(M12, inv.M12, 1e-15); assertEquals(M21, inv.M21, 1e-15); assertEquals(S12, inv.S12, 0.1); } } @Test public void DirectCheck() { for (int i = 0; i < testcases.length; ++i) { double lat1 = testcases[i][0], lon1 = testcases[i][1], azi1 = testcases[i][2], lat2 = testcases[i][3], lon2 = testcases[i][4], azi2 = testcases[i][5], s12 = testcases[i][6], a12 = testcases[i][7], m12 = testcases[i][8], M12 = testcases[i][9], M21 = testcases[i][10], S12 = testcases[i][11]; GeodesicData dir = Geodesic.WGS84.Direct(lat1, lon1, azi1, s12, GeodesicMask.ALL | GeodesicMask.LONG_UNROLL); assertEquals(lat2, dir.lat2, 1e-13); assertEquals(lon2, dir.lon2, 1e-13); assertEquals(azi2, dir.azi2, 1e-13); assertEquals(a12, dir.a12, 1e-13); assertEquals(m12, dir.m12, 1e-8); assertEquals(M12, dir.M12, 1e-15); assertEquals(M21, dir.M21, 1e-15); assertEquals(S12, dir.S12, 0.1); } } @Test public void ArcDirectCheck() { for (int i = 0; i < testcases.length; ++i) { double lat1 = testcases[i][0], lon1 = testcases[i][1], azi1 = testcases[i][2], lat2 = testcases[i][3], lon2 = testcases[i][4], azi2 = testcases[i][5], s12 = testcases[i][6], a12 = testcases[i][7], m12 = testcases[i][8], M12 = testcases[i][9], M21 = testcases[i][10], S12 = testcases[i][11]; GeodesicData dir = Geodesic.WGS84.ArcDirect(lat1, lon1, azi1, a12, GeodesicMask.ALL | GeodesicMask.LONG_UNROLL); assertEquals(lat2, dir.lat2, 1e-13); assertEquals(lon2, dir.lon2, 1e-13); assertEquals(azi2, dir.azi2, 1e-13); assertEquals(s12, dir.s12, 1e-8); assertEquals(m12, dir.m12, 1e-8); assertEquals(M12, dir.M12, 1e-15); assertEquals(M21, dir.M21, 1e-15); assertEquals(S12, dir.S12, 0.1); } } @Test public void GeodSolve0() { GeodesicData inv = Geodesic.WGS84.Inverse(40.6, -73.8, 49.01666667, 2.55); assertEquals(inv.azi1, 53.47022, 0.5e-5); assertEquals(inv.azi2, 111.59367, 0.5e-5); assertEquals(inv.s12, 5853226, 0.5); } @Test public void GeodSolve1() { GeodesicData dir = Geodesic.WGS84.Direct(40.63972222, -73.77888889, 53.5, 5850e3); assertEquals(dir.lat2, 49.01467, 0.5e-5); assertEquals(dir.lon2, 2.56106, 0.5e-5); assertEquals(dir.azi2, 111.62947, 0.5e-5); } @Test public void GeodSolve2() { // Check fix for antipodal prolate bug found 2010-09-04 Geodesic geod = new Geodesic(6.4e6, -1/150.0); GeodesicData inv = geod.Inverse(0.07476, 0, -0.07476, 180); assertEquals(inv.azi1, 90.00078, 0.5e-5); assertEquals(inv.azi2, 90.00078, 0.5e-5); assertEquals(inv.s12, 20106193, 0.5); inv = geod.Inverse(0.1, 0, -0.1, 180); assertEquals(inv.azi1, 90.00105, 0.5e-5); assertEquals(inv.azi2, 90.00105, 0.5e-5); assertEquals(inv.s12, 20106193, 0.5); } @Test public void GeodSolve4() { // Check fix for short line bug found 2010-05-21 GeodesicData inv = Geodesic.WGS84.Inverse(36.493349428792, 0, 36.49334942879201, .0000008); assertEquals(inv.s12, 0.072, 0.5e-3); } @Test public void GeodSolve5() { // Check fix for point2=pole bug found 2010-05-03 GeodesicData dir = Geodesic.WGS84.Direct(0.01777745589997, 30, 0, 10e6); assertEquals(dir.lat2, 90, 0.5e-5); if (dir.lon2 < 0) { assertEquals(dir.lon2, -150, 0.5e-5); assertEquals(dir.azi2, -180, 0.5e-5); } else { assertEquals(dir.lon2, 30, 0.5e-5); assertEquals(dir.azi2, 0, 0.5e-5); } } @Test public void GeodSolve6() { // Check fix for volatile sbet12a bug found 2011-06-25 (gcc 4.4.4 // x86 -O3). Found again on 2012-03-27 with tdm-mingw32 (g++ 4.6.1). GeodesicData inv = Geodesic.WGS84.Inverse(88.202499451857, 0, -88.202499451857, 179.981022032992859592); assertEquals(inv.s12, 20003898.214, 0.5e-3); inv = Geodesic.WGS84.Inverse(89.262080389218, 0, -89.262080389218, 179.992207982775375662); assertEquals(inv.s12, 20003925.854, 0.5e-3); inv = Geodesic.WGS84.Inverse(89.333123580033, 0, -89.333123580032997687, 179.99295812360148422); assertEquals(inv.s12, 20003926.881, 0.5e-3); } @Test public void GeodSolve9() { // Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) GeodesicData inv = Geodesic.WGS84.Inverse(56.320923501171, 0, -56.320923501171, 179.664747671772880215); assertEquals(inv.s12, 19993558.287, 0.5e-3); } @Test public void GeodSolve10() { // Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio // 10 rel + debug) GeodesicData inv = Geodesic.WGS84.Inverse(52.784459512564, 0, -52.784459512563990912, 179.634407464943777557); assertEquals(inv.s12, 19991596.095, 0.5e-3); } @Test public void GeodSolve11() { // Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio // 10 rel + debug) GeodesicData inv = Geodesic.WGS84.Inverse(48.522876735459, 0, -48.52287673545898293, 179.599720456223079643); assertEquals(inv.s12, 19989144.774, 0.5e-3); } @Test public void GeodSolve12() { // Check fix for inverse geodesics on extreme prolate/oblate // ellipsoids Reported 2012-08-29 Stefan Guenther // ; fixed 2012-10-07 Geodesic geod = new Geodesic(89.8, -1.83); GeodesicData inv = geod.Inverse(0, 0, -10, 160); assertEquals(inv.azi1, 120.27, 1e-2); assertEquals(inv.azi2, 105.15, 1e-2); assertEquals(inv.s12, 266.7, 1e-1); } @Test public void GeodSolve14() { // Check fix for inverse ignoring lon12 = nan GeodesicData inv = Geodesic.WGS84.Inverse(0, 0, 1, Double.NaN); assertTrue(isNaN(inv.azi1)); assertTrue(isNaN(inv.azi2)); assertTrue(isNaN(inv.s12)); } @Test public void GeodSolve15() { // Initial implementation of Math::eatanhe was wrong for e^2 < 0. This // checks that this is fixed. Geodesic geod = new Geodesic(6.4e6, -1/150.0); GeodesicData dir = geod.Direct(1, 2, 3, 4, GeodesicMask.AREA); assertEquals(dir.S12, 23700, 0.5); } @Test public void GeodSolve17() { // Check fix for LONG_UNROLL bug found on 2015-05-07 GeodesicData dir = Geodesic.WGS84.Direct(40, -75, -10, 2e7, GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat2, -39, 1); assertEquals(dir.lon2, -254, 1); assertEquals(dir.azi2, -170, 1); GeodesicLine line = Geodesic.WGS84.Line(40, -75, -10); dir = line.Position(2e7, GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat2, -39, 1); assertEquals(dir.lon2, -254, 1); assertEquals(dir.azi2, -170, 1); dir = Geodesic.WGS84.Direct(40, -75, -10, 2e7); assertEquals(dir.lat2, -39, 1); assertEquals(dir.lon2, 105, 1); assertEquals(dir.azi2, -170, 1); dir = line.Position(2e7); assertEquals(dir.lat2, -39, 1); assertEquals(dir.lon2, 105, 1); assertEquals(dir.azi2, -170, 1); } @Test public void GeodSolve26() { // Check 0/0 problem with area calculation on sphere 2015-09-08 Geodesic geod = new Geodesic(6.4e6, 0); GeodesicData inv = geod.Inverse(1, 2, 3, 4, GeodesicMask.AREA); assertEquals(inv.S12, 49911046115.0, 0.5); } @Test public void GeodSolve28() { // Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in // Java implementation fixed on 2015-05-19). Geodesic geod = new Geodesic(6.4e6, 0.1); GeodesicData dir = geod.Direct(1, 2, 10, 5e6); assertEquals(dir.a12, 48.55570690, 0.5e-8); } @Test public void GeodSolve29() { // Check longitude unrolling with inverse calculation 2015-09-16 GeodesicData dir = Geodesic.WGS84.Inverse(0, 539, 0, 181); assertEquals(dir.lon1, 179, 1e-10); assertEquals(dir.lon2, -179, 1e-10); assertEquals(dir.s12, 222639, 0.5); dir = Geodesic.WGS84.Inverse(0, 539, 0, 181, GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lon1, 539, 1e-10); assertEquals(dir.lon2, 541, 1e-10); assertEquals(dir.s12, 222639, 0.5); } @Test public void GeodSolve33() { // Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- // sind(-0.0) = +0.0 -- and in some version of Visual Studio -- // fmod(-0.0, 360.0) = +0.0. GeodesicData inv = Geodesic.WGS84.Inverse(0, 0, 0, 179); assertEquals(inv.azi1, 90.00000, 0.5e-5); assertEquals(inv.azi2, 90.00000, 0.5e-5); assertEquals(inv.s12, 19926189, 0.5); inv = Geodesic.WGS84.Inverse(0, 0, 0, 179.5); assertEquals(inv.azi1, 55.96650, 0.5e-5); assertEquals(inv.azi2, 124.03350, 0.5e-5); assertEquals(inv.s12, 19980862, 0.5); inv = Geodesic.WGS84.Inverse(0, 0, 0, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(inv.azi2, -180.00000, 0.5e-5); assertEquals(inv.s12, 20003931, 0.5); inv = Geodesic.WGS84.Inverse(0, 0, 1, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(inv.azi2, -180.00000, 0.5e-5); assertEquals(inv.s12, 19893357, 0.5); Geodesic geod = new Geodesic(6.4e6, 0); inv = geod.Inverse(0, 0, 0, 179); assertEquals(inv.azi1, 90.00000, 0.5e-5); assertEquals(inv.azi2, 90.00000, 0.5e-5); assertEquals(inv.s12, 19994492, 0.5); inv = geod.Inverse(0, 0, 0, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(inv.azi2, -180.00000, 0.5e-5); assertEquals(inv.s12, 20106193, 0.5); inv = geod.Inverse(0, 0, 1, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(inv.azi2, -180.00000, 0.5e-5); assertEquals(inv.s12, 19994492, 0.5); geod = new Geodesic(6.4e6, -1/300.0); inv = geod.Inverse(0, 0, 0, 179); assertEquals(inv.azi1, 90.00000, 0.5e-5); assertEquals(inv.azi2, 90.00000, 0.5e-5); assertEquals(inv.s12, 19994492, 0.5); inv = geod.Inverse(0, 0, 0, 180); assertEquals(inv.azi1, 90.00000, 0.5e-5); assertEquals(inv.azi2, 90.00000, 0.5e-5); assertEquals(inv.s12, 20106193, 0.5); inv = geod.Inverse(0, 0, 0.5, 180); assertEquals(inv.azi1, 33.02493, 0.5e-5); assertEquals(inv.azi2, 146.97364, 0.5e-5); assertEquals(inv.s12, 20082617, 0.5); inv = geod.Inverse(0, 0, 1, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(inv.azi2, -180.00000, 0.5e-5); assertEquals(inv.s12, 20027270, 0.5); } @Test public void GeodSolve55() { // Check fix for nan + point on equator or pole not returning all nans in // Geodesic::Inverse, found 2015-09-23. GeodesicData inv = Geodesic.WGS84.Inverse(Double.NaN, 0, 0, 90); assertTrue(isNaN(inv.azi1)); assertTrue(isNaN(inv.azi2)); assertTrue(isNaN(inv.s12)); inv = Geodesic.WGS84.Inverse(Double.NaN, 0, 90, 3); assertTrue(isNaN(inv.azi1)); assertTrue(isNaN(inv.azi2)); assertTrue(isNaN(inv.s12)); } @Test public void Planimeter0() { // Check fix for pole-encircling bug found 2011-03-16 double pa[][] = {{89, 0}, {89, 90}, {89, 180}, {89, 270}}; PolygonResult a = Planimeter(pa); assertEquals(a.perimeter, 631819.8745, 1e-4); assertEquals(a.area, 24952305678.0, 1); double pb[][] = {{-89, 0}, {-89, 90}, {-89, 180}, {-89, 270}}; a = Planimeter(pb); assertEquals(a.perimeter, 631819.8745, 1e-4); assertEquals(a.area, -24952305678.0, 1); double pc[][] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}}; a = Planimeter(pc); assertEquals(a.perimeter, 627598.2731, 1e-4); assertEquals(a.area, 24619419146.0, 1); double pd[][] = {{90, 0}, {0, 0}, {0, 90}}; a = Planimeter(pd); assertEquals(a.perimeter, 30022685, 1); assertEquals(a.area, 63758202715511.0, 1); a = PolyLength(pd); assertEquals(a.perimeter, 20020719, 1); assertTrue(isNaN(a.area)); } @Test public void Planimeter5() { // Check fix for Planimeter pole crossing bug found 2011-06-24 double points[][] = {{89, 0.1}, {89, 90.1}, {89, -179.9}}; PolygonResult a = Planimeter(points); assertEquals(a.perimeter, 539297, 1); assertEquals(a.area, 12476152838.5, 1); } @Test public void Planimeter6() { // Check fix for Planimeter lon12 rounding bug found 2012-12-03 double pa[][] = {{9, -0.00000000000001}, {9, 180}, {9, 0}}; PolygonResult a = Planimeter(pa); assertEquals(a.perimeter, 36026861, 1); assertEquals(a.area, 0, 1); double pb[][] = {{9, 0.00000000000001}, {9, 0}, {9, 180}}; a = Planimeter(pb); assertEquals(a.perimeter, 36026861, 1); assertEquals(a.area, 0, 1); double pc[][] = {{9, 0.00000000000001}, {9, 180}, {9, 0}}; a = Planimeter(pc); assertEquals(a.perimeter, 36026861, 1); assertEquals(a.area, 0, 1); double pd[][] = {{9, -0.00000000000001}, {9, 0}, {9, 180}}; a = Planimeter(pd); assertEquals(a.perimeter, 36026861, 1); assertEquals(a.area, 0, 1); } @Test public void Planimeter12() { // Area of arctic circle (not really -- adjunct to rhumb-area test) double points[][] = {{66.562222222, 0}, {66.562222222, 180}}; PolygonResult a = Planimeter(points); assertEquals(a.perimeter, 10465729, 1); assertEquals(a.area, 0, 1); } @Test public void Planimeter13() { // Check encircling pole twice double points[][] = {{89,-360}, {89,-240}, {89,-120}, {89,0}, {89,120}, {89,240}}; PolygonResult a = Planimeter(points); assertEquals(a.perimeter, 1160741, 1); assertEquals(a.area, 32415230256.0, 1); } } GeographicLib-1.45/java/planimeter/pom.xml0000644000771000077100000000506512602735126020430 0ustar ckarneyckarney 4.0.0 net.sf.geographiclib.example Planimeter Planimeter 1.45-SNAPSHOT jar . 1.6 2.9 UTF-8 2.3.2 2.4 2.8 3.0 net.sf.geographiclib GeographicLib-Java 1.45 org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} ${java.version} ${java.version} org.apache.maven.plugins maven-surefire-plugin ${surefire-plugin.version} false org.apache.maven.plugins maven-javadoc-plugin ${maven-javadoc.version} public true attach-javadocs jar org.codehaus.mojo exec-maven-plugin 1.2.1 Planimeter GeographicLib-1.45/java/planimeter/src/main/java/Planimeter.java0000644000771000077100000000170412602735126024506 0ustar ckarneyckarney/** * A test program for the GeographicLib.PolygonArea class **********************************************************************/ import java.util.*; import net.sf.geographiclib.*; /** * Compute the area of a geodesic polygon. * * This program reads lines with lat, lon for each vertex of a polygon. At the * end of input, the program prints the number of vertices, the perimeter of * the polygon and its area (for the WGS84 ellipsoid). **********************************************************************/ public class Planimeter { public static void main(String[] args) { PolygonArea p = new PolygonArea(Geodesic.WGS84, false); try { Scanner in = new Scanner(System.in); while (true) { double lat = in.nextDouble(), lon = in.nextDouble(); p.AddPoint(lat, lon); } } catch (Exception e) {} PolygonResult r = p.Compute(); System.out.println(r.num + " " + r.perimeter + " " + r.area); } } GeographicLib-1.45/NEWS0000644000771000077100000016216312602735126014534 0ustar ckarneyckarneyA reverse chronological list of changes to GeographicLib For more information, see http://geographiclib.sourceforge.net/ The current version of the library is 1.45. Changes between 1.45 (released 2015-09-30) and 1.44 versions: * Fix BUG in solution of inverse geodesic caused by misbehavior of some versions of Visual Studio on Windows (fmod(-0.0, 360.0) returns +0.0 instead of -0.0) and Octave (sind(-0.0) returns +0.0 instead of -0.0). These bugs were exposed because max(-0.0, +0.0) returns -0.0 for some languages. * Geodesic::Inverse now correctly returns NaNs if one of the latitudes is a NaN. * Changes to JavaScript package: + thanks to help from Yurij Mikhalevich, it is a now a node package that can be installed with npm; + make install now installs the node package in lib/node_modules/geographiclib; + add unit tests using mocha; + add documentation via JSDoc; + fix bug Geodesic.GenInverse (this bug, introduced in version 1.44, resulted in the wrong azimuth being reported for points at the pole). * Changes to Java package: + add implementation of ellipsoidal Gnomonic projection (courtesy of Sebastian Mattheis); + add unit tests using JUnit; + Math.toRadians and Math.toDegrees are used instead of GeoMath.degree (which is now removed), as a result... + Java version 1.2 (released 1998-12) or later is now required. * Changes to Python package: + add unit tests using the unittest framework; + fixed bug in normalization of the area. * Changes to MATLAB package: + fix array size mismatch in geoddistance by avoiding calls to subfunctions with zero-length arrays; + fix tranmerc_{fwd,inv} so that they work with arrays and mixed array/scalar arguments; + work around Octave problem which causes mgrs_fwd to return garbage with prec = 10 or 11; + add geographiclib_test.m to run a test suite. * Behavior of substituting 1/f for f if f > 1 is now deprecated. This behavior has been removed from the JavaScript, C, and Python implementations (it was never documented). Maxima, MATLAB, and Fortran implementations never included this behavior. * Other changes: + fix bug, introduced in version 1.42, in the C++ implementation to the computation of area which causes NaNs to be returned in the case of a sphere; + fixed bug, introduced in version 1.44, in the detection of C++11 math functions in configure.ac; + throw error on non-convergence in Gnomonic::Reverse if GEOGRAPHICLIB_PRECISION > 3; + add geod_polygon_clear to C library; + turn illegal latitudes into NaNs for Fortran library; + add test suites for the C and Fortran libraries. Changes between 1.44 (released 2015-08-14) and 1.43 versions: * Various changes to improve accuracy, e.g., by minimizing round-off errors: + Add Math::sincosd, Math::sind, Math::cosd which take their arguments in degrees. These functions do exact range reduction and thus they obey exactly the elementary properties of the trigonometric functions, e.g., sin 9d = cos 81d = - sin 123456789d. + Math::AngNormalize now works for any angles, instead of angles in the range [-540d, 540d); the function Math::AngNormalize2 is now deprecated. + This means that there is now no restriction on longitudes and azimuths; any values can be used. + Improve the accuracy of Math::atan2d. + DMS::Decode avoids unnecessary round-off errors; thus 7:33:36 and 7.56 result in identical values. DMS::Encode rounds ties to even. These changes have also been made to DMS.js. + More accurate rounding in MGRS::Reverse and mgrs_inv.m; this change only makes a difference at sub-meter precisions. + With MGRS::Forward and mgrs_fwd.m, ensure that digits in lower precision results match those at higher precision; as a result, strings of trailing 9s are less likely to be generated. This change only makes a difference at sub-meter precisions. + Replace the series for A2 in the Geodesic class with one with smaller truncation errors. + Geodesic::Inverse sets s12 to zero for coincident points at pole (instead of returning a tiny quantity). + Math::LatFix returns its argument if it is in [-90d, 90d]; if not, it returns NaN. + Using Math::LatFix, routines which don't check their arguments now interpret a latitude outside the legal range of [-90d, 90d] as a NaN; such routines will return NaNs instead of finite but incorrect results; caution: code that (dangerously) relied on the "reasonable" results being returned for values of the latitude outside the allowed range will now malfunction. * All the utility programs accept the -w option to swap the latitude-longitude order on input and output (and where appropriate on the command-line arguments). CartConvert now accepts the -p option to set the precision; now all of the utilities except GeoidEval accept -p. * Add classes for GARS, the Global Area Reference System, and for Georef, the World Geographic Reference System. * Changes to DMS::Decode and DMS.js: + tighten up the rules: o 30:70.0 and 30:60 are illegal (minutes and second must be strictly less than 60), however o 30:60.0 and 30:60. are legal (floating point 60 is OK, since it might have been generated by rounding 59.99...); + generalize a+b concept, introduced in version 1.42, to any number of pieces; thus 8+0:40-0:0:10 is interpreted as 8:39:50. * Documentation fixes: + update man pages to refer to GeoConvert(1) on handling of geographic coordinates; + document limitations of the series used for TransverseMercator; + hide the documentation of the computation of the gradient of the geoid height (now deprecated) in the Geoid class; + warn about the possible misinterpretation of 7.0E+1 by DMS::Decode; + swaplatlong optional argument of DMS::DecodeLatLon and various functions in the GeoCoords class is now called longfirst; + require Doxygen 1.8.7 or later. * More systematic treatment of version numbers: + Python: __init__.py defines __version__ and __version_info__; + JavaScript: o Math.js defines Constants.version and Constants.version_string; o version number included as comment in packed script geographiclib.js; o geod-calc.html and geod-google.html report the version number; o http://geographiclib.sourceforge.net/scripts/ gives access to earlier versions of geographiclib.js as geographiclib-m.nn.js; + Fortran: add geover subroutine to return version numbers; + Maxima: geodesic.mac defines geod_version; + CGI scripts: these report the version numbers of the utilities. * BUG FIXES: + NormalGravity now works properly for a sphere (omega = f = J2 = 0), instead of returning NaNs (problem found by htallon); + CassiniSoldner::Forward and cassini_fwd.m now returns the correct azimuth for points at the pole. * MATLAB-specific fixes: + mgrs_fwd now treats treats prec > 11 as prec = 11; + illegal letter combinations are now correctly detected by mgrs_inv; + fixed bug where mgrs_inv returned the wrong results for prec = 0 strings and center = 0; + mgrs_inv now decodes prec = 11 strings properly; + routines now return array results with the right shape; + routines now properly handle mixed scalar and array arguments. * Add Accumulator::operator*=(T y). * Geohash uses "invalid" instead of "nan" when the latitude or longitude is a nan. Changes between 1.43 (released 2015-05-23) and 1.42 versions: * Add the Enhanced Magnetic Model 2015, emm2015. This is valid for 2000 thru the end of 2019. This required some changes in the MagneticModel and MagneticCircle classes; so this model cannot be used with versions of GeographicLib prior to 1.43. * Fix BLUNDER in PolarStereographic constructor introduced in version 1.42. This affected UTMUPS conversions for UPS which could be incorrect by up to 0.5 km. * Changes in the LONG_NOWRAP option (added in version 1.39) in the Geodesic and GeodesicLine classes: + The option is now called LONG_UNROLL (a less negative sounding term); the original name, LONG_NOWRAP, is retained for backwards compatibility. + There were two bad BUGS in the implementation of this capability: (a) it gave incorrect results for west-going geodesics; (b) the option was ignored if used directly via the GeodesicLine class. The first bug affected the implementations in all languages. The second affected the implementation in C++ (GeodesicLine and GeodesicLineExact), JavaScript, Java, C, Python. These bugs have now been FIXED. + The GeodSolve utility now accepts a -u option, which turns on the LONG_UNROLL treatment. With this option lon1 is reported as entered and lon2 is given such that lon2 - lon1 indicates how often and in what sense the geodesic has encircled the earth. (This option also affects the value of longitude reported when an inverse calculation is run with the -f option.) + The inverse calculation with the JavaScript and python libraries similarly sets lon1 and lon2 in output dictionary respecting the LONG_UNROLL flag. + The online version of GeodSolve now offers an option to unroll the longitude. + To support these changes DMS::DecodeLatLon no longer reduces the longitude to the range [-180deg, 180deg) and Math::AngRound now coverts -0 to +0. * Add Math::polyval (also to C, Java, JavaScript, Fortran, python versions of the library; this is a built-in function for MATLAB/Octave). This evaluates a polynomial using Horner's method. The Maxima-generated code fragments for the evaluation of series in the Geodesic, TransverseMercator, and Rhumb classes and MATLAB routines for great ellipses have been replaced by Maxima-generated arrays of polynomial coefficients which are used as input to Math::polyval. * Add MGRS::Check() to verify that a, f, k_UTM, and k_UPS are consistent with the assumptions in the UTMUPS and MGRS classes. This is invoked with GeoConvert --version. (This function was added to document and check the assumptions used in the UTMUPS and MGRS classes in case they are extended to deal with ellipsoids other than WS84.) * MATLAB function mgrs_inv now takes an optional center argument and strips white space from both beginning and end of the string. * Minor internal changes: + GeodSolve sets the geodesic mask so that unnecessary calculations are avoided; + some routines have migrated into a math class for for python, Java, JavaScript libraries. * A reminder: because of changes in the installation directories for non-Windows systems introduced in version 1.42, you should remove the following directories from your system: + ${CMAKE_INSTALL_PREFIX}/share/cmake/GeographicLib* + ${CMAKE_INSTALL_PREFIX}/libexec/GeographicLib/matlab Changes between 1.42 (released 2015-04-28) and 1.41 versions: * DMS::Decode allows a single addition or subtraction operation, e.g., 70W+0:0:15. This affects the GeoCoords class and the utilities (which use the DMS class for reading coordinates). * Add Math::norm, Math::AngRound, Math::tand, Math::atan2d, Math::eatanhe, Math::taupf, Math::tauf, Math::fma and remove duplicated (but private) functionality from other classes. * On non-Windows systems, the cmake config-style find_package files are now installed under ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} instead of ${CMAKE_INSTALL_PREFIX}/share, because the files are architecture-specific. This change will let 32-bit and 64-bit versions coexist on the same machine (in lib and lib64). You should remove the versions in the old "share" location. * MATLAB changes: + provide native MATLAB implementations for compiled interface functions; + the compiled MATLAB interface is now deprecated and so the MATLAB_COMPILER option in the cmake build has been removed; + reorganize directories, so that o matlab/geographiclib contains the native matlab code; o matlab/geographiclib-legacy contains wrapper functions to mimic the previous compiled functionality; + the installed MATLAB code mirrors this layout, but the parent installation directory on non-Windows systems is ${CMAKE_INSTALL_PREFIX}/share (instead of ${CMAKE_INSTALL_PREFIX}/libexec), because the files are now architecture independent; + matlab/geographiclib is now packaged and distributed as MATLAB File Exchange package 50605 (this supersedes three earlier MATLAB packages); + point fix for geodarea.m to correct bug in area of polygons which encircle a pole multiple times (released as version 1.41.1 of MATLAB File Exchange package 39108, 2014-04-22). * artifactId for Java package changed from GeographicLib to GeographicLib-Java and the package is now deployed to Maven Central (thanks to Chris Bennight for help on this). * Fix autoconf mismatch of version numbers (which were inconsistent in versions 1.40 and 1.41). * Mark the computation of the gradient of the geoid height in the Geoid class and the GeoidEval utility as deprecated. * Work around the boost-quadmath bug with setprecision(0). * Deprecate use of Visual Studio 2005 "-vc8" project files in the windows directory. Changes between 1.41 (released 2015-03-09) and 1.40 versions: * Fix bug in Rhumb::Inverse (with exact = true) and related functions which causes the wrong distance to be reported if one of the end points is at a pole. Thanks to Thomas Murray for reporting this. * Add International Geomagnetic Reference Field (12th generation), which approximates the main magnetic field of the earth for the period 1900-2020. * Split information about Jacobi's conformal projection to a separate section and include more material. Changes between 1.40 (released 2014-12-18) and 1.39 versions: * Add the World Magnetic Model 2015, wmm2015. This is now the default magnetic model for MagneticField (replacing wmm2010 which is valid thru the end of 2014). * Geodesic::Inverse didn't return NaN if one of the longitudes was a NaN (bug introduced in version 1.25). Fixed in the C++, Java, JavaScript, C, Fortran, and Python implementations of the geodesic routines. This bug was not present in the Matlab version. * Fix bug in Utility::readarray and Utility::writearray which caused an exception in debug mode with zero-sized arrays. * Fix BLUNDER in OSGB::GridReference (found by kalderami) where the wrong result was returned if the easting or northing was negative. * OSGB::GridReference now returns "INVALID" if either coordinate is NaN. Similarly a grid reference starting with "IN" results in NaNs for the coordinates. * Default constructor for GeoCoords corresponds to an undefined position (latitude and longitude = NaN), instead of the north pole. * Add an online version of RhumbSolve at http://geographiclib.sourceforge.net/cgi-bin/RhumbSolve. * Additions to the documentation: + documentation on Jacobi's conformal projection; + a page on Auxiliary latitudes (actually, this was added in version 1.39); + document the use of two single quotes to stand for a double quote in DMS (this feature was introduced in version 1.13). * The Matlab function, geographiclibinterface, which compiles the wrapper routines for Matlab now works with Matlab 2014b on a Mac. Changes between 1.39 (released 2014-11-11) and 1.38 versions: * GeographicLib usually normalizes longitudes to the range [-180deg, 180deg). However, when solving the direct geodesic and rhumb line problems, it is sometimes necessary to know how many lines the line encircled the earth by returning the longitude "unwrapped". So the following changes have been made: + add a LONG_NOWRAP flag to mask enums for the outmask arguments for Geodesic, GeodesicLine, Rhumb, and RhumbLine; + similar changes have been made to the Python, Javascript, and Java implementations of the geodesic routines; + for the C, Fortran, and Matlab implementations the arcmode argument to the routines was generalized to allow a combination of ARCMODE and LONG_NOWRAP bits; + the Maxima version now returns the longitude unwrapped. These changes were necessary to fix the PolygonAreaT::AddEdge (see the next item). * Changes in area calculations: + fix BUG in PolygonAreaT::AddEdge (also in C, Java, Javascript, and Python implementations) which sometimes causes the wrong area to be returned if the edge spanned more than 180deg; + add area calculation to the Rhumb and RhumbLine classes and the RhumbSolve utility; + add PolygonAreaRhumb typedef for PolygonAreaT; + add -R option to Planimeter to use PolygonAreaRhumb (and -G option for the default geodesic polygon); + fix BLUNDER in area calculation in Matlab routine geodreckon; + add area calculation to Matlab/Octave routines for great ellipses. * Fix bad BUG in Geohash::Reverse; this was introduced in version 1.37 and affected all platforms where unsigned longs are 32-bits. Thanks to Christian Csar for reporting and diagnosing this. * Binary installers for Windows are now built with Visual Studio 11 2012 (instead of Visual Studio 10 2010). Compiled Matlab support still with version 2013a (64-bit). * Update GeographicLib.pro for builds with qmake to include all the source files. * Cmake updates: + include cross-compiling checks in cmake config file; + improve the way unsuitable versions are reported; + include_directories (${GeographicLib_INCLUDE_DIRS}) is no longer necessary with cmake 2.8.11 or later. * legacy/Fortran now includes drop-in replacements for the geodesic utilities from the NGS. * geographiclib-get-{geoids,gravity,magnetic} with no arguments now print the usage instead of loading the minimal sets. * Utility::date(const std::string&, int&, int&, int&) and hence the MagneticField utility accepts the string "now" as a legal time (meaning today). Changes between 1.38 (released 2014-10-02) and 1.37 versions: * On MacOSX, the installed package is relocatable (for cmake version 2.8.12 and later). * On Mac OSX, GeographicLib can be installed using homebrew. * In cmake builds under Windows, set the output directories so that binaries and shared libraries are together. * Accept the minus sign as a synonym for - in DMS.{cpp,js}. * The cmake configuration file geographiclib-depends.cmake has been renamed to geographiclib-targets.cmake. * Matlab/Octave routines for great ellipses added. * Provide man pages for geographiclib-get-{geoids,gravity,magnetic}. Changes between 1.37 (released 2014-08-08) and 1.36 versions: * Add support for high precision arithmetic. * INCOMPATIBLE CHANGE: the static instantiations of various classes for the WGS84 ellipsoid have been changed to a "construct on first use idiom". This avoids a lot of wasteful initialization before the user's code starts. Unfortunately it means that existing source code that relies on any of the following static variables will need to be changed to a function call: + AlbersEqualArea::AzimuthalEqualAreaNorth + AlbersEqualArea::AzimuthalEqualAreaSouth + AlbersEqualArea::CylindricalEqualArea + Ellipsoid::WGS84 + Geocentric::WGS84 + Geodesic::WGS84 + GeodesicExact::WGS84 + LambertConformalConic::Mercator + NormalGravity::GRS80 + NormalGravity::WGS84 + PolarStereographic::UPS + TransverseMercator::UTM + TransverseMercatorExact::UTM Thus, occurrences of, for example, const Geodesic& geod = Geodesic::WGS84; // version 1.36 and earlier need to be changed to const Geodesic& geod = Geodesic::WGS84(); // version 1.37 and later (note the parentheses!); alternatively use // works with all versions const Geodesic geod(Constants::WGS84_a(), Constants::WGS84_a()); * Incompatible change: the environment variables {GEOID,GRAVITY,MAGNETIC}_{NAME,PATH} are now prefixed with GEOGRAPHICLIB_. * Incompatible change for Windows XP: retire the Windows XP common data path. If you're still using Windows XP, then you might have to move the folder C:\Documents and Settings\All Users\Application Data\GeographicLib to C:\ProgramData\GeographicLib. * All macro names affecting the compilation now start with GEOGRAPHICLIB_; this applies to GEOID_DEFAULT_NAME, GRAVITY_DEFAULT_NAME, MAGNETIC_DEFAULT_NAME, PGM_PIXEL_WIDTH, HAVE_LONG_DOUBLE, STATIC_ASSERT, WORDS_BIGENDIAN. * Changes to PolygonArea: + introduce PolygonAreaT which takes a geodesic class as a parameter; + PolygonArea and PolygonAreaExact are typedef'ed to PolygonAreaT and PolygonAreaT; + add -E option to Planimeter to use PolygonAreaExact; + add -Q option to Planimeter to calculate the area on the authalic sphere. * Add -p option to Planimeter, ConicProj, GeodesicProj, TransverseMercatorProj. * Add Rhumb and RhumbLine classes and the RhumbSolve utility. * Minor changes to NormalGravity: + add J2ToFlattening and FlatteningToJ2; + use Newton's method to determine f from J2; + in constructor, allow omega = 0 (i.e., treat the spherical case). * Add grs80 GravityModel. * Make geographiclib-get-{geoids,gravity,magnetic} scripts work on MacOS. * Minor changes: + simplify cross-platform support for C++11 mathematical functions; + change way area coefficients are given in GeodesicExact to improve compile times; + enable searching the online documentation; + add macros GEOGRAPHICLIB_VERSION and GEOGRAPHICLIB_VERSION_NUM; + add solution and project files for Visual Studio Express 2010. Changes between 1.36 (released 2014-05-13) and 1.35 versions: * Changes to comply with NGA's prohibition of the use of the upper-case letters N/S to designate the hemisphere when displaying UTM/UPS coordinates: + UTMUPS::DecodeZone allows north/south as hemisphere designators (in addition to n/s); + UTMUPS::EncodeZone now encodes the hemisphere in lower case (to distinguish this use from a grid zone designator); + UTMUPS::EncodeZone takes an optional parameter abbrev to indicate whether to use n/s or north/south as the hemisphere designator; + GeoCoords::UTMUPSRepresentation and AltUTMUPSRepresentation similarly accept the abbrev parameter; + GeoConvert uses the flags -a and -l to govern whether UTM/UPS output uses n/s (the -a flag) or north/south (the -l flag) to denote the hemisphere; + Fixed a bug what allowed +3N to be accepted as an alternation UTM zone designation (instead of 3N). WARNING: The use of lower case n/s for the hemisphere might cause compatibility problems. However DecodeZone has always accepted either case; so the issue will only arise with other software reading the zone information. To avoid possible misinterpretation of the zone designator, consider calling EncodeZone with abbrev = false and GeoConvert with -l, so that north/south are used to denote the hemisphere. * MGRS::Forward with prec = -1 will produce a grid zone designation. Similarly MGRS::Reverse will decode a grid zone designation (and return prec = -1). * Stop using the throw() declaration specification which is deprecated in C++11. * Add missing std:: qualifications to copy in LocalCartesion and Geocentric headers (bug found by Clemens). Changes between 1.35 (released 2014-03-13) and 1.34 versions: * Fix blunder in UTMUPS::EncodeEPSG (found by Ben Adler). * Matlab wrapper routines geodesic{direct,inverse,line} switch to "exact" routes if |f| > 0.02. * GeodSolve.cgi allows ellipsoid to be set (and uses the -E option for GeodSolve). * Set title in HTML versions of man pages for the utility programs. * Changes in cmake support: + add _d to names of executables in debug mode of Visual Studio; + add support for Android (cmake-only), thanks to Pullan Yu; + check CPACK version numbers supplied on command line; + configured version of project-config.cmake.in is project-config.cmake (instead of geographiclib-config.cmake), to prevent find_package incorrectly using this file; + fix tests with multi-line output; + this release includes a file, pom.xml, which is used by an experimental build system (based on maven) at SRI. Changes between 1.34 (released 2013-12-11) and 1.33 versions: * Many changes in cmake support: + minimum version of cmake needed increased to 2.8.4 (which was released in 2011-02); + allow building both shared and static librarys with -D GEOGRAPHICLIB_LIB_TYPE=BOTH; + both shared and static libraries (Release plus Debug) included in binary installer; + find_package uses COMPONENTS and GeographicLib_USE_STATIC_LIBS to select the library to use; + find_package version checking allows nmake and Visual Studio generators to interoperate on Windows; + find_package (GeographicLib ...) requires that GeographicLib be capitalized correctly; + on Unix/Linux, don't include the version number in directory for the cmake configuration files; + defaults for GEOGRAPHICLIB_DOCUMENTATION and BUILD_NETGEOGRAPHICLIB are now OFF; + the GEOGRAPHICLIB_EXAMPLES configuration parameter is no longer used; cmake always configures to build the examples, but they are not built by default (instead build targets: exampleprograms and netexamples); + matlab-all target renamed to matlabinterface; + the configuration parameters PACKAGE_PATH and INSTALL_PATH are now deprecated (use CMAKE_INSTALL_PREFIX instead); + on Linux, the installed package is relocatable; + on MacOSX, the installed utilities can find the shared library. * Use a more precise value for OSGB::CentralScale(). * Add Arc routines to python interface. * The Geod utility has been removed; the same functionality lives on with GeodSolve (introduced in version 1.30). Changes between 1.33 (released 2013-10-08) and 1.32 versions: * Add NETGeographic .NET wrapper library (courtesy of Scott Heiman). * Make inspector functions in GeographicLib::Ellipsoid const. * Add Accumulator.cpp to instantiate GeographicLib::Accumulator. * Defer some of the initialization of GeographicLib::OSGB to when it is first called. * Fix bug in autoconf builds under MacOS. Changes between 1.32 (released 2013-07-12) and 1.31 versions: * Generalize C interface for polygon areas to allow vertices to be specified incrementally. * Fix way flags for C++11 support are determined. Changes between 1.31 (released 2013-07-01) and 1.30 versions: * Changes breaking binary compatibility (source compatibility is maintained): + overloaded versions of DMS::Encode, EllipticFunction::EllipticFunction, and GeoCoords::DMSRepresentation, have been eliminated by the use of optional arguments; + correct the declaration of first arg to UTMUPS::DecodeEPSG. * FIX BUG in GeographicLib::GravityCircle constructor (found by Mathieu Peyréga) which caused bogus results for the gravity disturbance and gravity anomaly vectors. (This only affected calculations using GravityCircle. GravityModel calculations did not suffer from this bug.) * Improvements to the build: + add macros GEOGRAPHICLIB_VERSION_{MAJOR,MINOR,PATCH} to Config.h; + fix documentation for new version of perlpod; + improving setting of runtime path for Unix-like systems with cmake; + install PDB files when compiling with Visual Studio to aid debugging; + Windows binary release now uses Matlab R2013a (64-bit) and uses the -largeArrayDims option. * Changes to the geodesic routines: + add Java implementation of the geodesic routines (thanks to Skip Breidbach for the maven support); + FIX BUG: avoid altering input args in Fortran implementation; + more systematic treatment of very short geodesic; + fixes to python port so that they work with version 3.x, in addition to 2.x (courtesy of Amato); + accumulate the perimeter and area of polygons via a double-wide accumulator in Fortran, C, and Matlab implementations (this is already included in the other implementations); + port PolygonArea::AddEdge and PolygonArea::TestEdge to JavaScript and python interfaces; + include documentation on short geodesics. * Unix scripts for downloading datasets, geographiclib-get-{geoids,gravity,magnetic}, skip already download models by default, unless the -f flag is given. * FIX BUGS: meridian convergence and scale returned by TransverseMercatorExact was wrong at a pole. * Improve efficiency of MGRS::Forward by avoiding the calculation of the latitude if possible (adapting an idea of Craig Rollins). * Fixes to the way the Matlab interface routines are built (thanks to Phil Miller and Chris F.). Changes between 1.30 (released 2013-02-27) and 1.29 versions: * Changes to geodesic routines: + fix BUG in fail-safe mechanisms in Geodesic::Inverse; + the command line utility Geod is now called GeodSolve; + allow addition of polygon edges in PolygonArea; + add full Maxima implementation of geodesic algorithms. Changes between 1.29 (released 2013-01-16) and 1.28 versions: * Changes to allow compilation with libc++ (courtesy of Kal Conley). * Add description of geodesics on triaxial ellipsoid to documentation. * Update journal reference for "Algorithms for geodesics". Changes between 1.28 (released 2012-12-11) and 1.27 versions: * Changes to geodesic routines: + compute longitude difference exactly; + hence fix BUG in area calculations for polygons with vertices very close to the prime meridian; + fix BUG is geoddistance.m where the value of m12 was wrong for meridional geodesics; + add Matlab implementations of the geodesic projections; + remove unneeded special code for geodesics which start at a pole; + include polygon area routine in C and Fortran implementations; + add doxygen documentation for C and Fortran libraries. Changes between 1.27 (released 2012-11-29) and 1.26 versions: * Changes to geodesic routines: + add native Matlab implementations: geoddistance.m, geodreckon.m, geodarea.m; + add C and Fortran implementations; + improve the solution of the direct problem so that the series solution is accurate to round off for |f| < 1/50; + tighten up the convergence criteria for solution of the inverse problem; + no longer signal failures of convergence with NaNs (a slightly less accurate answer is returned instead). * Fix DMS::Decode double rounding BUG. * On MacOSX platforms with the cmake configuration, universal binaries are built. Changes between 1.26 (released 2012-10-22) and 1.25 versions: * Replace the series used for geodesic areas by one with better convergence (this only makes an appreciable difference if |f| > 1/150). Changes between 1.25 (released 2012-10-16) and 1.24 versions: * Changes to geodesic calculations: + restart Newton's method in Geodesic::Inverse when it goes awry; + back up Newton's method with the bisection method; + Geodesic::Inverse now converges for any value of f; + add GeodesicExact and GeodesicLineExact which are formulated in terms of elliptic integrals and thus yield accurate results even for very eccentric ellipsoids. + the -E option to Geod invokes these exact classes. * Add functionality to EllipticFunction: + add all the traditional elliptic integrals; + remove restrictions on argument range for incomplete elliptic integrals; + allow imaginary modulus for elliptic integrals and elliptic functions; + make interface to the symmetric elliptic integrals public. * Allow GeographicLib::Ellipsoid to be copied. * Changes to the build tools: + cmake uses folders in Visual Studio to reduce clutter; + allow precision of reals to be set in cmake; + fail gracefully in the absence of pod documentation tools; + remove support for maintainer tasks in Makefile.mk; + upgrade to automake 1.11.6 to fix the "make distcheck" security vulnerability; see http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-3386 Changes between 1.24 (released 2012-09-22) and 1.23 versions: * Allow the specification of the hemisphere in UTM coordinates in order to provide continuity across the equator: + add UTMUPS::Transfer; + add GeoCoords::UTMUPSRepresentation(bool, int) and GeoCoords::AltUTMUPSRepresentation(bool, int); + use the hemisphere letter in, e.g., GeoConvert -u -z 31N. * Add UTMUPS::DecodeEPSG and UTMUPS::EncodeEPSG. * cmake changes: + restore support for cmake 2.4.x; + explicitly check version of doxygen. * Fix building under cygwin. * Document restrictions on f in the Introduction. * Fix python interface to work with version 2.6.x. Changes between 1.23 (released 2012-07-17) and 1.22 versions: * Documentation changes: + remove html documentation from distribution and use web links if doxygen is not available; + use doxygen tags to document exceptions; + begin migrating the documentation to using Greek letters where appropriate (requires doxygen 1.8.1.2 or later). * Add Math::AngNormalize and Math::AngNormalize2; the allowed range for longitudes and azimuths widened to [-540d, 540d). * DMS::Decode understands more unicode symbols. * Geohash uses geohash code "nan" to stand for not a number. * Add Ellipsoid::NormalCurvatureRadius. * Various fixes in LambertConformalConic, TransverseMercator, PolarStereographic, and Ellipsoid to handle reverse projections of points near infinity. * Fix programming blunder in LambertConformalConic::Forward (incorrect results were returned if the tangent latitude was negative). Changes between 1.22 (released 2012-05-27) and 1.21 versions: * Add Geohash and Ellipsoid classes. * Fix bug in AlbersEqualArea of very prolate ellipsoids (b^2 > 2 a^2). * cmake changes: + optionally use PACKAGE_PATH and INSTALL_PATH to determine CMAKE_INSTALL_PREFIX; + use COMMON_INSTALL_PATH to determine layout of installation directories; + as a consequence, the installation paths for the documentation, and python and matlab interfaces are shortened for Windows; + zip source distribution now uses DOS line endings; + the tests work in debug mode for Windows; + default setting of GEOGRAPHICLIB_DATA does not depend on CMAKE_INSTALL_PREFIX; + add a cmake configuration for build tree. Changes between 1.21 (released 2012-04-25) and 1.20 versions: * Support colon-separated DMS output: + DMS::Encode and GeoCoords::DMSRepresentation generalized; + GeoConvert and Geod now accept a -: option. * GeoidEval does not print the gradient of the geoid height by default (because it's subject to large errors); give the -g option to get the gradient printed. * Work around optimization BUG in GeographicLib::Geodesic::Inverse with tdm mingw g++ version 4.6.1. * autoconf fixed to ensure that that out-of-sources builds work; document this as the preferred method of using autoconf. * cmake tweaks: + simplify the configuration of doxygen; + allow the Matlab compiler to be specified with the MATLAB_COMPILER option. Changes between 1.20 (released 2012-03-23) and 1.19 versions: * cmake tweaks: + improve find_package's matching of compiler versions; + CMAKE_INSTALL_PREFIX set from CMAKE_PREFIX_PATH if available; + add "x64" to the package name for the 64-bit binary installer; + fix cmake warning with Visual Studio Express. * Fix SphericalEngine to deal with aggressive iterator checking by Visual Studio. * Fix transcription BUG is Geodesic.js. Changes between 1.19 (released 2012-03-13) and 1.18 versions: * Slight improvement in Geodesic::Inverse for very short lines. * Fix argument checking tests in MGRS::Forward. * Add --comment-delimiter and --line-separator options to the utility programs. * Add installer for 64-bit Windows; the compiled Matlab interface is supplied with the Windows 64-bit installer only. Changes between 1.18 (released 2012-02-18) and 1.17 versions: * Improve documentation on configuration with cmake. * cmake's find_package ensures that the compiler versions match on Windows. * Improve documentation on compiling Matlab interface. * Binary installer for Windows installs under C:/pkg-vc10 by default. Changes between 1.17 (released 2012-01-21) and 1.16 versions: * Work around optimization BUG in Geodesic::Inverse with g++ version 4.4.0 (mingw). * Fix BUG in argument checking with OSGB::GridReference. * Fix missing include file in SphericalHarmonic2. * Add simple examples of usage for each class. * Add internal documenation to the cmake configuration files. Changes between 1.16 (released 2011-12-07) and 1.15 versions: * Add calculation of the earth's gravitational field: + add NormalGravity GravityModel and GravityCircle classes; + add command line utility Gravity; + add Gravity models; + add Constants::WGS84_GM(), Constants::WGS84_omega(), and similarly for GRS80. * Build uses GEOGRAPHICLIB_DATA to specify a common parent directory for geoid, gravity, and magnetic data (instead of GEOGRAPHICLIB_GEOID_PATH, etc.); similarly, GeoidEval, Gravity, and MagneticField, look at the environment variable GEOGRAPHICLIB_DATA to locate the data. * Spherical harmonic software changes: + capitalize enums SphericalHarmonic::FULL and SphericalHarmonic::SCHMIDT (the lower case names are retained but deprecated); + optimize the sum by using a static table of square roots which is updated by SphericalEngine::RootTable; + avoid overflow for high degree models. * Magnetic software fixes: + fix documentation BUG in MagneticModel::Circle; + make MagneticModel constructor explicit; + provide default MagneticCircle constructor; + add additional inspector functions to MagneticCircle; + add -c option to MagneticField; + default height to zero in MagneticField. Changes between 1.15 (released 2011-11-08) and 1.14 versions: * Add calculation of the earth's magnetic field: + add MagneticModel and MagneticCircle classes; + add command line utility MagneticField; + add Magnetic models; + add Installing the magnetic field models; + add The format of the magnetic model files; + add classes SphericalEngine, CircularEngine, SphericalHarmonic, SphericalHarmonic1, and SphericalHarmonic2. which sum spherical harmonic series. * Add Utility class to support I/O and date manipulation. * Cmake configuration includes a _d suffix on the library built in debug mode. * For the Python package, include manifest and readme files; don't install setup.py for non-Windows systems. * Include Doxygen tag file in distribution as doc/html/Geographic.tag. Changes between 1.14 (released 2011-09-30) and 1.13 versions: * Ensure that geographiclib-config.cmake is relocatable. * Allow more unicode symbols to be used in DMS::Decode. * Modify GeoidEval so that it can be used to convert the height datum for LIDAR data. * Modest speed-up of Geodesic::Inverse. * Changes in python interface: + FIX BUG in transcription of Geodesic::Inverse; + include setup.py for easy installation; + python only distribution is available at http://pypi.python.org/pypi/geographiclib * Supply a minimal Qt qmake project file for library src/Geographic.pro. Changes between 1.13 (released 2011-08-13) and 1.12 versions: * Changes to I/O: + allow : (colon) to be used as a DMS separator in DMS::Decode; + also accept Unicode symbols for degrees, minutes, and seconds (coded as UTF-8); + provide optional swaplatlong argument to various DMS and GeoCoords functions to make longitude precede latitude; + GeoConvert now has a -w option to make longitude precede latitude on input and output; + include a JavaScript version of DMS. * Slight improvement in starting guess for solution of geographic latitude in terms of conformal latitude in TransverseMercator, TransverseMercatorExact, and LambertConformalConic. * For most classes, get rid of const member variables so that the default copy assignment works. * Put Math and Accumulator in their own header files. * Remove unused "fast" GeographicLib::Accumulator method. * Reorganize the Python interface. * Withdraw some deprecated routines. * cmake changes: + include FindGeographic.cmake in distribution; + building with cmake creates and installs geographiclib-config.cmake; + better support for building a shared library under Windows. Changes between 1.12 (released 2011-07-21) and 1.11 versions: * Change license to MIT/X11. * Add GeographicLib::PolygonArea class and equivalent Matlab function. * Provide JavaScript and Python implementations of geodesic routines. * Fix Windows installer to include runtime dlls for Matlab. * Fix (innocuous) unassigned variable in Geodesic::GenInverse. * Geodesic routines in Matlab return a12 as first column of aux return value (incompatible change). * A couple of code changes to enable compilation with Visual Studio 2003. Changes between 1.11 (released 2011-06-27) and 1.10 versions: * Changes to Planimeter: + add -l flag to Planimeter for polyline calculations; + trim precision of area to 3 decimal places; + FIX BUG with pole crossing edges (due to compiler optimization). * Geod no longer reports the reduced length by default; however the -f flag still reports this and in addition gives the geodesic scales and the geodesic area. * FIX BUGS (compiler-specific) in inverse geodesic calculations. * FIX BUG: accommodate tellg() returning -1 at end of string. * Change way flattening of the ellipsoid is specified: + constructors take f argument which is taken to be the flattening if f < 1 and the inverse flattening otherwise (this is a compatible change for spheres and oblate ellipsoids, but it is an INCOMPATIBLE change for prolate ellipsoids); + the -e arguments to the Utility Programs are handled similarly; in addition, simple fractions, e.g., 1/297, can be used for the flattening; + introduce Constants::WGS84_f() for the WGS84 flattening (and deprecate Constants::WGS84_r() for the inverse flattening); + most classes have a Flattening() member function; + InverseFlattening() has been deprecated (and now returns inf for a sphere, instead of 0). Changes between 1.10 (released 2011-06-11) and 1.9 versions: * Improvements to Matlab/Octave interface: + add {geocentric,localcartesian}{forward,reverse}; + make geographiclibinterface more general; + install the source for the interface; + cmake compiles the interface if ENABLE_MATLAB=ON; + include compiled interface with Windows binary installer. * Fix various configuration issues + autoconf did not install Config.h; + cmake installed in man/man1 instead of share/man/man1; + cmake did not set the rpath on the tools. Changes between 1.9 (released 2011-05-28) and 1.8 versions: * FIX BUG in area returned by Planimeter for pole encircling polygons. * FIX BUG in error message reported when DMS::Decode reads the string "5d.". * FIX BUG in AlbersEqualArea::Reverse (lon0 not being used). * Ensure that all exceptions thrown in the Utility Programs are caught. * Avoid using catch within GeographicLib::DMS. * Move Accumulator class from Planimeter.cpp to Constants.hpp. * Add Math::sq. * Simplify Installing the geoid datasets + add geographiclib-get-geoids for Unix-like systems; + add installers for Windows. * Provide cmake support: + build binary installer for Windows; + include regression tests; + add --input-string, --input-file, --output-file options to the Utility Programs to support tests. * Rename utility EquidistantTest as GeodesicProj and TransverseMercatorTest as TransverseMercatorProj. * Add ConicProj. * Reverse the initial sense of the -s option for Planimeter. * Migrate source from subversion to git. Changes between 1.8 (released 2011-02-22) and 1.7 versions: * Optionally return rotation matrix from GeographicLib::Geocentric and GeographicLib::LocalCartesian. * For the Utility Programs, supply man pages, -h prints the synopsis, --help prints the man page, --version prints the version. * Use accurate summation in Planimeter. * Add 64-bit targets for Visual Studio 2010. * Use templates for defining math functions and some constants. * GeographicLib::Geoid updates + Add GeographicLib::Geoid::DefaultGeoidPath and GeographicLib::Geoid::DefaultGeoidName; + GeoidEval uses environment variable GEOID_NAME as the default geoid; + Add --msltohae and --haetomsl as GeoidEval options (and don't document the single hyphen versions). * Remove documentation that duplicates papers on transverse Mercator and geodesics. Changes between 1.7 (released 2010-12-21) and 1.6 versions: * FIX BUG in scale returned by GeographicLib::LambertConformalConic::Reverse. * Add GeographicLib::AlbersEqualArea projection. * Library created by Visual Studio is Geographic.lib instead of GeographicLib.lib (compatible with makefiles). * Make classes NaN aware. * Use cell arrays for MGRS strings in Matlab. * Add solution/project files for Visual Studio 2010 (32-bit only). * Use C++11 static_assert and math functions, if available. Change between 1.6 (released 2010-11-23) and 1.5 versions: * FIX BUG introduced in GeographicLib::Geoid in version 1.5 (found by Dave Edwards). Changes between 1.5 (released 2010-11-19) and 1.4 versions: * Improve area calculations for small polygons. * Add -s and -r flags to Planimeter utility. * Improve the accuracy of GeographicLib::LambertConformalConic using divided differences. * FIX BUG in meridian convergence returned by LambertConformalConic::Forward. * Add optional threadsafe parameter to GeographicLib::Geoid constructor. WARNING: This changes may break binary compatibility with previous versions of GeographicLib. However, the library is source compatible. * Add GeographicLib::OSGB. * Matlab and Octave interfaces to GeographicLib::UTMUPS, GeographicLib::MGRS, GeographicLib::Geoid, GeographicLib::Geodesic provided. * Minor changes + explicitly turn on optimization in Visual Studio 2008 projects; + add missing dependencies in some Makefiles; + move pi() and degree() from GeographicLib::Constants to GeographicLib::Math; + introduce GeographicLib::Math::extended type to aid testing; + add GeographicLib::Math::epi() and GeographicLib::Math::edegree(). + fixes to compile under cygwin; + tweak expression used to find latitude from conformal latitude. Changes between 1.4 (released 2010-09-12) and 1.3 versions: * Changes to GeographicLib::Geodesic and GeographicLib::GeodesicLine: + FIX BUG in Geodesic::Inverse with prolate ellipsoids; + add area computations to Geodesic::Direct and Geodesic::Inverse; + add geodesic areas to geodesic test set; + make GeodesicLine constructor public; + change longitude series in Geodesic into Helmert-like form; + ensure that equatorial geodesics have cos(alpha0) = 0 identically; + generalize interface for Geodesic and GeodesicLine; + split GeodesicLine and Geodesic into different files; + signal convergence failure in Geodesic::Inverse with NaNs; + deprecate one function in Geodesic and two functions in GeodesicLine; + deprecate -n option for Geod. WARNING: These changes may break binary compatibility with previous versions of GeographicLib. However, the library is source compatible (with the proviso that GeographicLib/GeodesicLine.hpp may now need to be included). * Add the Planimeter utility for computing the areas of geodesic polygons. * Improve iterative solution of GeographicLib::Gnomonic::Reverse. * Add GeographicLib::Geoid::ConvertHeight. * Add -msltohae, -haetomsl, and -z options to GeoidEval. * Constructors check that minor radius is positive. * Add overloaded Forward and Reverse functions to the projection classes which don't return the convergence (or azimuth) and scale. * Document function parameters and return values consistently. Changes between 1.3 (released 2010-07-21) and 1.2 versions: * Add GeographicLib::Gnomonic, the ellipsoid generalization of the gnomonic projection. * Add -g and -e options to Equidistanttest. * Use fixed-point notation for output from Cartconvert, Equidistanttest, Transversemercatortest. * PolarStereographic: + Improved conversion to conformal coordinates; + Fix bug with scale at opposite pole; + Complain if latitude out of range in SetScale. * Add GeographicLib::Math::NaN(). * Add long double version of hypot for Windows. * Add EllipticFunction::E(real). * Update references to Geotrans in MGRS documentation. * Speed up tmseries.mac. Changes between 1.2 (released 2010-05-21) and 1.1 versions: * FIX BUGS in GeographicLib::Geodesic, + wrong azimuth returned by Direct if point 2 is on a pole; + Inverse sometimes fails with very close points. * Improve calculation of scale in GeographicLib::CassiniSoldner, + add GeodesicLine::Scale, GeodesicLine::EquatorialAzimuth, and GeodesicLine::EquatorialArc; + break friend connection between CassiniSoldner and Geodesic. * Add DMS::DecodeAngle and DMS::DecodeAzimuth. Extend DMS::Decode and DMS::Encode to deal with distances. * Code and documentation changes in Geodesic and Geocentric for consistency with the forthcoming paper on geodesics. * Increase order of series using in Geodesic to 6 (full accuracy maintained for ellipsoid flattening < 0.01). * Macro __NO_LONG_DOUBLE_MATH to disable use of long double. * Correct declaration of Math::isfinite to return a bool. * Changes in the Utility Programs, + improve error reporting when parsing command line arguments; + accept latitudes and longitudes in decimal degrees or degrees, minutes, and seconds, with optional hemisphere designators; + GeoConvert -z accepts zone or zone+hemisphere; + GeoidEval accepts any of the input formats used by GeoConvert; + CartConvert allows the ellipsoid to be specified with -e. Changes between 1.1 (released 2010-02-09) and 1.0 versions: * FIX BUG (introduced in 2009-03) in EllipticFunction::E(sn,cn,dn). * Increase accuracy of scale calculation in TransverseMercator and TransverseMercatorExact. * Code and documentation changes for consistency with arXiv:1002.1417 Changes between 1.0 (released 2010-01-07) and 2009-11 versions: * Add autoconf configuration files. * BUG FIX: Improve initial guess for Newton's method in PolarStereographic::Reverse. (Previously this failed to converge when the co-latitude exceeded about 130 deg.) * Constructors for TransverseMercator, TransverseMercatorExact, PolarStereographic, Geocentric, and Geodesic now check for obvious problems with their arguments and throw an exception if necessary. * Most classes now include inspector functions such as MajorRadius() so that you can determine how instances were constructed. * Add GeographicLib::LambertConformalConic class. * Add GeographicLib::PolarStereographic::SetScale to allow the latitude of true scale to be specified. * Add solution and project files for Visual Studio 2008. * Add GeographicLib::GeographicErr for exceptions. * GeographicLib::Geoid changes: + BUG FIX: fix typo in GeographicLib::Geoid::Cache which could cause a segmentation fault in some cases when the cached area spanned the prime meridian. + Include sufficient edge data to allow heights to be returned for cached area without disk reads; + Add inspector functions to query the extent of the cache. Changes between 2009-11 and 2009-10 versions: * Allow specification of "closest UTM zone" in GeographicLib::UTMUPS and GeoConvert (via -t option). * Utilities now complain is there are too many tokens on input lines. * Include real-to-real versions of GeographicLib::DMS::Decode and GeographicLib::DMS::Encode. * More house-cleaning changes: + Ensure that functions which return results through reference arguments do not alter the arguments when an exception is thrown. + Improve accuracy of GeographicLib::MGRS::Forward. + Include more information in some error messages. + Improve accuracy of inverse hyperbolic functions. + Fix the way GeographicLib::Math functions handle different precisions. Changes between 2009-10 and 2009-09 versions: * Change web site to http://geographiclib.sourceforge.net * Several house-cleaning changes: + Change from the a flat directory structure to a more easily maintained one. + Introduce Math class for common mathematical functions (in Constants.hpp). + Use Math::real as the type for all real quantities. By default this is typedef'ed to double; and the library should be installed this way. + Eliminate const reference members of AzimuthalEquidistant, CassiniSoldner and LocalCartesian so that they may be copied. + Make several constructors explicit. Disallow some constructors. Disallow copy constructor/assignment for Geoid. + Document least square formulas in Geoid.cpp. + Use unsigned long long for files positions of geoid files in Geoid. + Introduce optional mgrslimits argument in UTMUPS::Forward and UTMUPS::Reverse to enforce stricter MGRS limits on eastings and northings.in + Add 64-bit targets in Visual Studio project files. Changes between 2009-09 and 2009-08 versions: * Add GeographicLib::Geoid and GeoidEval utility. Changes between 2009-08 and 2009-07 versions: * Add GeographicLib::CassiniSoldner class and EquidistantTest utility. * Fix bug in GeographicLib::Geodesic::Inverse where NaNs were sometimes returned. * INCOMPATIBLE CHANGE: AzimuthalEquidistant now returns the reciprocal of the azimuthal scale instead of the reduced length. * Add -n option to GeoConvert. Changes between 2009-07 and 2009-06 versions: * Speed up the series inversion code in tmseries.mac and geod.mac. * Reference Borkowski in section on Geocentric coordinates. Changes between 2009-06 and 2009-05 versions: * Add routines to decode and encode zone+hemisphere to GeographicLib::UTMUPS. * Clean up code in GeographicLib::Geodesic. Changes between 2009-05 and 2009-04 versions: * Improvements to GeographicLib::Geodesic: + more economical series expansions, + return reduced length (as does the Geod utility), + improved calculation of starting point for inverse method, + use reduced length to give derivative for Newton's method. * Add AzimuthalEquidistant class. + Make GeographicLib::Geocentric, GeographicLib::TransverseMercator, and GeographicLib::PolarStereographic classes work with prolate ellipsoids. * CartConvert checks its inputs more carefully. * Remove reference to defunct Constants.cpp from GeographicLib.vcproj. Changes between 2009-04 and 2009-03 versions: * Use compile-time constants to select the order of series in GeographicLib::TransverseMercator. * 2x unroll of Clenshaw summation to avoid data shuffling. * Simplification of GeographicLib::EllipticFunction::E. * Use STATIC_ASSERT for compile-time checking of constants. * Improvements to GeographicLib::Geodesic: + compile-time option to change order of series used, + post maxima code for generating the series, + tune the order of series for double, + improvements in the selection of starting points for Newton's method, + accept and return spherical arc lengths, + works with both oblate and prolate spheroids, + add -a, -e, -b options to the Geod utility. Changes between 2009-03 and 2009-02 versions: * Add GeographicLib::Geodesic and the Geod utility. * Declare when no exceptions are thrown by functions. * Minor changes to GeographicLib::DMS class. * Use invf = 0 to mean a sphere in constructors to some classes. * The makefile creates a library and includes an install target. * Rename GeographicLib::ECEF to GeographicLib::Geocentric, ECEFConvert to CartConvert. * Use inline functions to define constant doubles in Constants.hpp. Changes between 2009-02 and 2009-01 versions: * Fix documentation of constructors (flattening -> inverse flattening). * Use std versions of math functions. * Add ECEF and LocalCartesian classes and ECEFConvert utility. * Gather the documentation on the utility programs onto one page. GeographicLib-1.45/legacy/C/00README.txt0000644000771000077100000000137712602735126017320 0ustar ckarneyckarneyThis is a C implementation of the geodesic algorithms described in C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); https://dx.doi.org/10.1007/s00190-012-0578-z Addenda: http://geographiclib.sf.net/geod-addenda.html For documentation, see http://geographiclib.sourceforge.net/html/C/ The code in this directory is entirely self-contained. In particular, it does not depend on the C++ classes. You can compile and link the example programs directly with something like: cc -o inverse inverse.c geodesic.c -lm echo 30 0 29.5 179.5 | ./inverse Alternatively, you can build the examples using cmake. For example, on Linux systems you might do: mkdir BUILD cd BUILD cmake .. make echo 30 0 29.5 179.5 | ./inverse GeographicLib-1.45/legacy/C/planimeter.c0000644000771000077100000000203212602735126017753 0ustar ckarneyckarney/** * @file planimeter.c * @brief A test program for geod_polygon_compute() **********************************************************************/ #include #include "geodesic.h" #if defined(_MSC_VER) /* Squelch warnings about scanf */ # pragma warning (disable: 4996) #endif /** * A simple program to compute the area of a geodesic polygon. * * This program reads in lines with lat, lon for each vertex * of a polygon. At the end of input, the program prints the number of * vertices, the perimeter of the polygon and its area (for the WGS84 * ellipsoid). **********************************************************************/ int main() { double a = 6378137, f = 1/298.257223563; /* WGS84 */ double lat, lon, A, P; int n; struct geod_geodesic g; struct geod_polygon p; geod_init(&g, a, f); geod_polygon_init(&p, 0); while (scanf("%lf %lf", &lat, &lon) == 2) geod_polygon_addpoint(&g, &p, lat, lon); n = geod_polygon_compute(&g, &p, 0, 1, &A, &P); printf("%d %.8f %.3f\n", n, P, A); return 0; } GeographicLib-1.45/legacy/C/CMakeLists.txt0000644000771000077100000000157512602735126020222 0ustar ckarneyckarneycmake_minimum_required (VERSION 2.8.4) project (GeographicLib-legacy-C C) # 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 () # Make the compiler more picky. if (WIN32) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-array-bounds -pedantic") if (NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi") endif () endif () set (TOOLS direct inverse planimeter geodtest) foreach (TOOL ${TOOLS}) add_executable (${TOOL} ${TOOL}.c geodesic.c geodesic.h) if (NOT WIN32) target_link_libraries (${TOOL} m) endif () endforeach () # Turn on testing enable_testing () # Run the test suite add_test (NAME geodtest COMMAND geodtest) GeographicLib-1.45/legacy/C/direct.c0000644000771000077100000000163312602735126017073 0ustar ckarneyckarney/** * @file direct.c * @brief A test program for geod_direct() **********************************************************************/ #include #include "geodesic.h" #if defined(_MSC_VER) /* Squelch warnings about scanf */ # pragma warning (disable: 4996) #endif /** * A simple program to solve the direct geodesic problem. * * This program reads in lines with lat1, lon1, azi1, s12 and prints out lines * with lat2, lon2, azi2 (for the WGS84 ellipsoid). **********************************************************************/ int main() { double a = 6378137, f = 1/298.257223563; /* WGS84 */ double lat1, lon1, azi1, lat2, lon2, azi2, s12; struct geod_geodesic g; geod_init(&g, a, f); while (scanf("%lf %lf %lf %lf", &lat1, &lon1, &azi1, &s12) == 4) { geod_direct(&g, lat1, lon1, azi1, s12, &lat2, &lon2, &azi2); printf("%.15f %.15f %.15f\n", lat2, lon2, azi2); } return 0; } GeographicLib-1.45/legacy/C/geodesic.h0000644000771000077100000011275012602735126017413 0ustar ckarneyckarney/** * \file geodesic.h * \brief Header 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-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * This library was distributed with * GeographicLib 1.45. **********************************************************************/ #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 45 /** * 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(__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() 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 */ /**< @cond SKIP */ double b, c2, f1, salp0, calp0, k2, salp1, calp1, 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_init(struct geod_geodesic* g, double a, double f); /** * 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). **********************************************************************/ void geod_lineinit(struct geod_geodesicline* l, const struct geod_geodesic* g, double lat1, double lon1, double azi1, unsigned caps); /** * 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 between point 1 and 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_direct(const struct geod_geodesic* g, double lat1, double lon1, double azi1, double s12, double* plat2, double* plon2, double* pazi2); /** * 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 between point 1 and 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_inverse(const struct geod_geodesic* g, double lat1, double lon1, double lat2, double lon2, double* ps12, double* pazi1, double* pazi2); /** * 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 between point 1 and 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 to geod_lineinit() with \e * caps |= GEOD_DISTANCE_IN. 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 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); geod_lineinit(&l, &g, 40.64, -73.78, azi1, 0); for (i = 0; i < 101; ++i) { geod_position(&l, i * s12 * 0.01, lat + i, lon + i, 0); printf("%.5f %.5f\n", lat[i], lon[i]); } @endcode **********************************************************************/ void geod_position(const struct geod_geodesicline* l, 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 * between point 1 and point 2 (meters); otherwise it is the arc length * between point 1 and 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 between point 1 and 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 of between point 1 and 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_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); /** * 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 between point 1 and 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 of between point 1 and 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_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); /** * 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 between point 1 and point 2 (meters); otherwise it is the * arc length between point 1 and 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 between point 1 and 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 of between point 1 and 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 space in distance). This is * faster than using geod_position() would be appropriate if drawing the path * on a map. @code{.c} struct geod_geodesic g; struct geod_geodesicline l; double a12, azi1, lat[101], lon[101]; int i; geod_init(&g, 6378137, 1/298.257223563); a12 = geod_geninverse(&g, 40.64, -73.78, 1.36, 103.99, 0, &azi1, 0, 0, 0, 0, 0); geod_lineinit(&l, &g, 40.64, -73.78, azi1, GEOD_LATITUDE | GEOD_LONGITUDE); for (i = 0; i < 101; ++i) { geod_genposition(&l, 1, i * a12 * 0.01, lat + i, lon + i, 0, 0, 0, 0, 0, 0); printf("%.5f %.5f\n", lat[i], lon[i]); } @endcode **********************************************************************/ double 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); /** * 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_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_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_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_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. Only simple polygons (which are not self-intersecting) are * allowed. 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_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_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_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°]. * * Only simple polygons (which are not self-intersecting) are allowed. * 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_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 */ /**< @cond SKIP */ GEOD_LONG_NOWRAP = GEOD_LONG_UNROLL /* For backward compatibility only */ /**< @endcond */ }; #if defined(__cplusplus) } #endif #endif GeographicLib-1.45/legacy/C/inverse.c0000644000771000077100000000163712602735126017300 0ustar ckarneyckarney/** * @file inverse.c * @brief A test program for geod_inverse() **********************************************************************/ #include #include "geodesic.h" #if defined(_MSC_VER) /* Squelch warnings about scanf */ # pragma warning (disable: 4996) #endif /** * A simple program to solve the inverse geodesic problem. * * This program reads in lines with lat1, lon1, lat2, lon2 and prints out lines * with azi1, azi2, s12 (for the WGS84 ellipsoid). **********************************************************************/ int main() { double a = 6378137, f = 1/298.257223563; /* WGS84 */ double lat1, lon1, azi1, lat2, lon2, azi2, s12; struct geod_geodesic g; geod_init(&g, a, f); while (scanf("%lf %lf %lf %lf", &lat1, &lon1, &lat2, &lon2) == 4) { geod_inverse(&g, lat1, lon1, lat2, lon2, &s12, &azi1, &azi2); printf("%.15f %.15f %.10f\n", azi1, azi2, s12); } return 0; } GeographicLib-1.45/legacy/C/geodesic.c0000644000771000077100000020273012602735126017404 0ustar ckarneyckarney/** * \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://dx.doi.org/10.1007/s00190-012-0578-z * Addenda: http://geographiclib.sf.net/geod-addenda.html * * See the comments in geodesic.h for documentation. * * Copyright (c) Charles Karney (2012-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ */ #include "geodesic.h" #include #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() { if (!init) { #if defined(__DBL_MANT_DIG__) digits = __DBL_MANT_DIG__; #else digits = 53; #endif #if defined(__DBL_EPSILON__) epsilon = __DBL_EPSILON__; #else epsilon = pow(0.5, digits - 1); #endif #if defined(__DBL_MIN__) realmin = __DBL_MIN__; #else realmin = pow(0.5, 1022); #endif #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 = sqrt(-1.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 log1px(real x) { volatile real y = 1 + x, z = y - 1; /* Here's the explanation for this magic: y = 1 + z, exactly, and z * approx x, thus log(y)/z (which is nearly constant near z = 0) returns * a good approximation to the true log(1 + x)/x. The multiplication x * * (log(y)/z) introduces little additional error. */ return z == 0 ? x : x * log(y) / z; } static real atanhx(real x) { real y = fabs(x); /* Enforce odd parity */ y = log1px(2 * y/(1 - y))/2; return x < 0 ? -y : y; } static real hypotx(real x, real y) { return sqrt(x * x + y * y); } static real cbrtx(real x) { real y = pow(fabs(x), 1/(real)(3)); /* Return the real cube root */ return x < 0 ? -y : y; } 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; *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) { real r = hypotx(*sinx, *cosx); *sinx /= r; *cosx /= r; } static real AngNormalize(real x) { x = fmod(x, (real)(360)); return x < -180 ? x + 360 : (x < 180 ? x : x - 360); } static real LatFix(real x) { return fabs(x) > 90 ? NaN : x; } static real AngDiff(real x, real y) { 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 (d == 180 && t < 0 ? -180 : d) - t; } static real AngRound(real x) { const real z = 1/(real)(16); volatile real y = fabs(x); /* The compiler mustn't "simplify" z - (z - y) to y */ y = y < z ? z - (z - y) : y; return x < 0 ? 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; r = fmod(x, (real)(360)); q = (int)(floor(r / 90 + (real)(0.5))); r -= 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 = 0 - s; break; case 2U: *sinx = 0 - s; *cosx = 0 - c; break; default: *sinx = 0 - c; *cosx = s; break; /* case 3U */ } } 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; } 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* 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* 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[]); 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 ? atanhx(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); } void geod_lineinit(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, 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 = AngNormalize(azi1); /* Guard against underflow in salp0 */ sincosdx(AngRound(l->azi1), &l->salp1, &l->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 = hypotx(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); } } 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 : 0U) | (plon2 ? GEOD_LONGITUDE : 0U) | (pazi2 ? GEOD_AZIMUTH : 0U) | (ps12 ? GEOD_DISTANCE : 0U) | (pm12 ? GEOD_REDUCEDLENGTH : 0U) | (pM12 || pM21 ? GEOD_GEODESICSCALE : 0U) | (pS12 ? GEOD_AREA : 0U); outmask &= l->caps & OUT_ALL; if (!( TRUE /*Init()*/ && (flags & GEOD_ARCMODE || (l->caps & GEOD_DISTANCE_IN & OUT_ALL)) )) /* Uninitialized or 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 ssig2 = l->ssig1 * csig12 + l->csig1 * ssig12, csig2 = l->csig1 * csig12 - l->ssig1 * ssig12, serr; 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 = hypotx(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) { int E = l->salp0 < 0 ? -1 : 1; /* 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; /* 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 * l->calp1; calp12 = -1; } } 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); } if (outmask & GEOD_LATITUDE) *plat2 = lat2; if (outmask & GEOD_LONGITUDE) *plon2 = lon2; if (outmask & GEOD_AZIMUTH) *pazi2 = azi2; 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; return flags & GEOD_ARCMODE ? s12_a12 : sig12 / degree; } void geod_position(const struct geod_geodesicline* l, real s12, real* plat2, real* plon2, real* pazi2) { geod_genposition(l, FALSE, s12, plat2, plon2, pazi2, 0, 0, 0, 0, 0); } 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 : 0U) | (plon2 ? GEOD_LONGITUDE : 0U) | (pazi2 ? GEOD_AZIMUTH : 0U) | (ps12 ? GEOD_DISTANCE : 0U) | (pm12 ? GEOD_REDUCEDLENGTH : 0U) | (pM12 || pM21 ? GEOD_GEODESICSCALE : 0U) | (pS12 ? GEOD_AREA : 0U); 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, 0, 0, 0, 0, 0); } 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 s12 = 0, azi1 = 0, azi2 = 0, m12 = 0, M12 = 0, M21 = 0, S12 = 0; real lon12; 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; real omg12 = 0; unsigned outmask = (ps12 ? GEOD_DISTANCE : 0U) | (pazi1 || pazi2 ? GEOD_AZIMUTH : 0U) | (pm12 ? GEOD_REDUCEDLENGTH : 0U) | (pM12 || pM21 ? GEOD_GEODESICSCALE : 0U) | (pS12 ? GEOD_AREA : 0U); 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. */ /* If very close to being on the same half-meridian, then make it so. */ lon12 = AngRound(AngDiff(lon1, lon2)); /* Make longitude difference positive. */ lonsign = lon12 >= 0 ? 1 : -1; lon12 *= lonsign; /* 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)); lam12 = lon12 * degree; sincosdx(lon12, &slam12, &clam12); 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, 0, outmask & GEOD_GEODESICSCALE ? &M12 : 0, outmask & GEOD_GEODESICSCALE ? &M21 : 0, 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) 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 || lam12 <= pi - g->f * pi)) { /* 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, &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; unsigned numit = 0; /* Bracketing range */ real salp1a = tiny, calp1a = 1, salp1b = tiny, calp1b = -1; boolx tripn, tripb; for (tripn = FALSE, tripb = FALSE; 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, &salp2, &calp2, &sig12, &ssig1, &csig1, &ssig2, &csig2, &eps, &omg12, numit < maxit1, &dv, Ca) - lam12); /* 2 * tol0 is approximately 1 ulp for a number in [0, pi]. */ /* Reversed test to allow escape with NaNs */ if (tripb || !(fabs(v) >= (tripn ? 8 : 2) * 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 postive 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, 0, outmask & GEOD_GEODESICSCALE ? &M12 : 0, outmask & GEOD_GEODESICSCALE ? &M21 : 0, Ca); m12x *= g->b; s12x *= g->b; a12 = sig12 / degree; omg12 = lam12 - omg12; } } 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 = hypotx(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 && omg12 < (real)(0.75) * pi && /* Long difference too big */ sbet2 - sbet1 < (real)(1.75)) { /* Lat difference 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 somg12 = sin(omg12), domg12 = 1 + cos(omg12), 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 (outmask & GEOD_AZIMUTH) { /* minus signs give range [-180, 180). 0- converts -0 to +0. */ azi1 = atan2dx(salp1, calp1); azi2 = atan2dx(salp2, calp2); } if (outmask & GEOD_DISTANCE) *ps12 = s12; if (outmask & GEOD_AZIMUTH) { if (pazi1) *pazi1 = azi1; if (pazi2) *pazi2 = azi2; } 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; } 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, 0, 0, 0, 0); } 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. cbrtx always returns the real root. cbrtx(-8) = -2. */ T = cbrtx(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* 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 omg12 = lam12, somg12, comg12, ssig12, csig12; #if defined(__GNUC__) && __GNUC__ == 4 && \ (__GNUC_MINOR__ < 6 || defined(__MINGW32__)) /* Volatile declaration needed to fix inverse cases * 88.202499451857 0 -88.202499451857 179.981022032992859592 * 89.262080389218 0 -89.262080389218 179.992207982775375662 * 89.333123580033 0 -89.333123580032997687 179.99295812360148422 * which otherwise fail with g++ 4.4.4 x86 -O3 (Linux) * and g++ 4.4.0 (mingw) and g++ 4.6.1 (tdm mingw). */ { volatile real xx1 = sbet2 * cbet1; volatile real xx2 = cbet2 * sbet1; sbet12a = xx1 + xx2; } #else sbet12a = sbet2 * cbet1 + cbet2 * sbet1; #endif if (shortline) { real sbetm2 = sq(sbet1 + sbet2); /* 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 /= g->f1 * dnm; } somg12 = sin(omg12); comg12 = cos(omg12); salp1 = cbet2 * somg12; calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * sq(somg12) / (1 - comg12); ssig12 = hypotx(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; 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 = (lam12 - pi) / 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, 0, &m12b, &m0, 0, 0, Ca); x = -1 + m12b / (cbet1 * cbet2 * m0 * pi); betscale = x < -(real)(0.01) ? sbet12a / x : -g->f * sq(cbet1) * pi; lamscale = betscale / cbet1; y = (lam12 - pi) / 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* 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, omg12, lam12; real B312, h0, 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 = hypotx(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] */ omg12 = atan2(maxx((real)(0), comg1 * somg2 - somg1 * comg2), comg1 * comg2 + somg1 * somg2); 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)); h0 = -g->f * A3f(g, eps); domg12 = salp0 * h0 * (sig12 + B312); lam12 = omg12 + 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, 0, &dlam12, 0, 0, 0, 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] thru 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] thru 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); return lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 : (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0); } int transitdirect(real lon1, real lon2) { lon1 = fmod(lon1, (real)(720)); lon2 = fmod(lon2, (real)(720)); return ( ((lon2 >= 0 && lon2 < 360) || lon2 < -360 ? 0 : 1) - ((lon1 >= 0 && lon1 < 360) || lon1 < -360 ? 0 : 1) ); } 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 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; geod_geninverse(g, p->lat, p->lon, lat, lon, &s12, 0, 0, 0, 0, 0, p->polyline ? 0 : &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 */ real lat, lon, S12; geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s, &lat, &lon, 0, 0, 0, 0, 0, p->polyline ? 0 : &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], area0; int crossings; 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, 0, 0, 0, 0, 0, &S12); if (pP) *pP = accsum(p->P, s12); acccopy(p->A, t); accadd(t, S12); crossings = p->crossings + transit(p->lon, p->lon0); area0 = 4 * pi * g->c2; if (crossings & 1) accadd(t, (t[0] < 0 ? 1 : -1) * area0/2); /* area is with the clockwise sense. If !reverse convert to * counter-clockwise convention. */ if (!reverse) accneg(t); /* If sign put area in (-area0/2, area0/2], else put area in [0, area0) */ if (sign) { if (t[0] > area0/2) accadd(t, -area0); else if (t[0] <= -area0/2) accadd(t, +area0); } else { if (t[0] >= area0) accadd(t, -area0); else if (t[0] < 0) accadd(t, +area0); } if (pA) *pA = 0 + t[0]; 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, area0; 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; geod_geninverse(g, i == 0 ? p->lat : lat, i == 0 ? p->lon : lon, i != 0 ? p->lat0 : lat, i != 0 ? p->lon0 : lon, &s12, 0, 0, 0, 0, 0, p->polyline ? 0 : &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; area0 = 4 * pi * g->c2; if (crossings & 1) tempsum += (tempsum < 0 ? 1 : -1) * area0/2; /* area is with the clockwise sense. If !reverse convert to * counter-clockwise convention. */ if (!reverse) tempsum *= -1; /* If sign put area in (-area0/2, area0/2], else put area in [0, area0) */ if (sign) { if (tempsum > area0/2) tempsum -= area0; else if (tempsum <= -area0/2) tempsum += area0; } else { if (tempsum >= area0) tempsum -= area0; else if (tempsum < 0) tempsum += area0; } if (pA) *pA = 0 + tempsum; 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, area0; 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; { real lat, lon, s12, S12; geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s, &lat, &lon, 0, 0, 0, 0, 0, &S12); tempsum += S12; crossings += transitdirect(p->lon, lon); geod_geninverse(g, lat, lon, p->lat0, p->lon0, &s12, 0, 0, 0, 0, 0, &S12); perimeter += s12; tempsum += S12; crossings += transit(lon, p->lon0); } area0 = 4 * pi * g->c2; if (crossings & 1) tempsum += (tempsum < 0 ? 1 : -1) * area0/2; /* area is with the clockwise sense. If !reverse convert to * counter-clockwise convention. */ if (!reverse) tempsum *= -1; /* If sign put area in (-area0/2, area0/2], else put area in [0, area0) */ if (sign) { if (tempsum > area0/2) tempsum -= area0; else if (tempsum <= -area0/2) tempsum += area0; } else { if (tempsum >= area0) tempsum -= area0; else if (tempsum < 0) tempsum += area0; } if (pP) *pP = perimeter; if (pA) *pA = 0 + tempsum; 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); } /** @endcond */ GeographicLib-1.45/legacy/C/geodtest.c0000644000771000077100000006027612602735126017447 0ustar ckarneyckarney/** * \file geodtest.c * \brief Test suite for the geodesic routines in C * * Run these tests by configuring with cmake and running "make test". * * Copyright (c) Charles Karney (2015) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ /** @cond SKIP */ #include "geodesic.h" #include #include double wgs84_a = 6378137, wgs84_f = 1/298.257223563; /* WGS84 */ int assertEquals(double x, double y, double d) { if (fabs(x - y) <= d) return 0; printf("assertEquals fails: %.7g != %.7g +/- %.7g\n", x, y, d); return 1; } const int ncases = 20; double testcases[20][12] = { {35.60777, -139.44815, 111.098748429560326, -11.17491, -69.95921, 129.289270889708762, 8935244.5604818305, 80.50729714281974, 6273170.2055303837, 0.16606318447386067, 0.16479116945612937, 12841384694976.432}, {55.52454, 106.05087, 22.020059880982801, 77.03196, 197.18234, 109.112041110671519, 4105086.1713924406, 36.892740690445894, 3828869.3344387607, 0.80076349608092607, 0.80101006984201008, 61674961290615.615}, {-21.97856, 142.59065, -32.44456876433189, 41.84138, 98.56635, -41.84359951440466, 8394328.894657671, 75.62930491011522, 6161154.5773110616, 0.24816339233950381, 0.24930251203627892, -6637997720646.717}, {-66.99028, 112.2363, 173.73491240878403, -12.70631, 285.90344, 2.512956620913668, 11150344.2312080241, 100.278634181155759, 6289939.5670446687, -0.17199490274700385, -0.17722569526345708, -121287239862139.744}, {-17.42761, 173.34268, -159.033557661192928, -15.84784, 5.93557, -20.787484651536988, 16076603.1631180673, 144.640108810286253, 3732902.1583877189, -0.81273638700070476, -0.81299800519154474, 97825992354058.708}, {32.84994, 48.28919, 150.492927788121982, -56.28556, 202.29132, 48.113449399816759, 16727068.9438164461, 150.565799985466607, 3147838.1910180939, -0.87334918086923126, -0.86505036767110637, -72445258525585.010}, {6.96833, 52.74123, 92.581585386317712, -7.39675, 206.17291, 90.721692165923907, 17102477.2496958388, 154.147366239113561, 2772035.6169917581, -0.89991282520302447, -0.89986892177110739, -1311796973197.995}, {-50.56724, -16.30485, -105.439679907590164, -33.56571, -94.97412, -47.348547835650331, 6455670.5118668696, 58.083719495371259, 5409150.7979815838, 0.53053508035997263, 0.52988722644436602, 41071447902810.047}, {-58.93002, -8.90775, 140.965397902500679, -8.91104, 133.13503, 19.255429433416599, 11756066.0219864627, 105.755691241406877, 6151101.2270708536, -0.26548622269867183, -0.27068483874510741, -86143460552774.735}, {-68.82867, -74.28391, 93.774347763114881, -50.63005, -8.36685, 34.65564085411343, 3956936.926063544, 35.572254987389284, 3708890.9544062657, 0.81443963736383502, 0.81420859815358342, -41845309450093.787}, {-10.62672, -32.0898, -86.426713286747751, 5.883, -134.31681, -80.473780971034875, 11470869.3864563009, 103.387395634504061, 6184411.6622659713, -0.23138683500430237, -0.23155097622286792, 4198803992123.548}, {-21.76221, 166.90563, 29.319421206936428, 48.72884, 213.97627, 43.508671946410168, 9098627.3986554915, 81.963476716121964, 6299240.9166992283, 0.13965943368590333, 0.14152969707656796, 10024709850277.476}, {-19.79938, -174.47484, 71.167275780171533, -11.99349, -154.35109, 65.589099775199228, 2319004.8601169389, 20.896611684802389, 2267960.8703918325, 0.93427001867125849, 0.93424887135032789, -3935477535005.785}, {-11.95887, -116.94513, 92.712619830452549, 4.57352, 7.16501, 78.64960934409585, 13834722.5801401374, 124.688684161089762, 5228093.177931598, -0.56879356755666463, -0.56918731952397221, -9919582785894.853}, {-87.85331, 85.66836, -65.120313040242748, 66.48646, 16.09921, -4.888658719272296, 17286615.3147144645, 155.58592449699137, 2635887.4729110181, -0.90697975771398578, -0.91095608883042767, 42667211366919.534}, {1.74708, 128.32011, -101.584843631173858, -11.16617, 11.87109, -86.325793296437476, 12942901.1241347408, 116.650512484301857, 5682744.8413270572, -0.44857868222697644, -0.44824490340007729, 10763055294345.653}, {-25.72959, -144.90758, -153.647468693117198, -57.70581, -269.17879, -48.343983158876487, 9413446.7452453107, 84.664533838404295, 6356176.6898881281, 0.09492245755254703, 0.09737058264766572, 74515122850712.444}, {-41.22777, 122.32875, 14.285113402275739, -7.57291, 130.37946, 10.805303085187369, 3812686.035106021, 34.34330804743883, 3588703.8812128856, 0.82605222593217889, 0.82572158200920196, -2456961531057.857}, {11.01307, 138.25278, 79.43682622782374, 6.62726, 247.05981, 103.708090215522657, 11911190.819018408, 107.341669954114577, 6070904.722786735, -0.29767608923657404, -0.29785143390252321, 17121631423099.696}, {-29.47124, 95.14681, -163.779130441688382, -27.46601, -69.15955, -15.909335945554969, 13487015.8381145492, 121.294026715742277, 5481428.9945736388, -0.51527225545373252, -0.51556587964721788, 104679964020340.318}}; int testinverse() { double lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12; double azi1a, azi2a, s12a, a12a, m12a, M12a, M21a, S12a; struct geod_geodesic g; int i, result = 0; geod_init(&g, wgs84_a, wgs84_f); for (i = 0; i < ncases; ++i) { lat1 = testcases[i][0]; lon1 = testcases[i][1]; azi1 = testcases[i][2]; lat2 = testcases[i][3]; lon2 = testcases[i][4]; azi2 = testcases[i][5]; s12 = testcases[i][6]; a12 = testcases[i][7]; m12 = testcases[i][8]; M12 = testcases[i][9]; M21 = testcases[i][10]; S12 = testcases[i][11]; a12a = geod_geninverse(&g, lat1, lon1, lat2, lon2, &s12a, &azi1a, &azi2a, &m12a, &M12a, &M21a, &S12a); result += assertEquals(azi1, azi1a, 1e-13); result += assertEquals(azi2, azi2a, 1e-13); result += assertEquals(s12, s12a, 1e-8); result += assertEquals(a12, a12a, 1e-13); result += assertEquals(m12, m12a, 1e-8); result += assertEquals(M12, M12a, 1e-15); result += assertEquals(M21, M21a, 1e-15); result += assertEquals(S12, S12a, 0.1); } return result; } int testdirect() { double lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12; double lat2a, lon2a, azi2a, a12a, m12a, M12a, M21a, S12a; struct geod_geodesic g; int i, result = 0; unsigned flags = GEOD_LONG_UNROLL; geod_init(&g, wgs84_a, wgs84_f); for (i = 0; i < ncases; ++i) { lat1 = testcases[i][0]; lon1 = testcases[i][1]; azi1 = testcases[i][2]; lat2 = testcases[i][3]; lon2 = testcases[i][4]; azi2 = testcases[i][5]; s12 = testcases[i][6]; a12 = testcases[i][7]; m12 = testcases[i][8]; M12 = testcases[i][9]; M21 = testcases[i][10]; S12 = testcases[i][11]; a12a = geod_gendirect(&g, lat1, lon1, azi1, flags, s12, &lat2a, &lon2a, &azi2a, 0, &m12a, &M12a, &M21a, &S12a); result += assertEquals(lat2, lat2a, 1e-13); result += assertEquals(lon2, lon2a, 1e-13); result += assertEquals(azi2, azi2a, 1e-13); result += assertEquals(a12, a12a, 1e-13); result += assertEquals(m12, m12a, 1e-8); result += assertEquals(M12, M12a, 1e-15); result += assertEquals(M21, M21a, 1e-15); result += assertEquals(S12, S12a, 0.1); } return result; } int testarcdirect() { double lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12; double lat2a, lon2a, azi2a, s12a, m12a, M12a, M21a, S12a; struct geod_geodesic g; int i, result = 0; unsigned flags = GEOD_ARCMODE | GEOD_LONG_UNROLL; geod_init(&g, wgs84_a, wgs84_f); for (i = 0; i < ncases; ++i) { lat1 = testcases[i][0]; lon1 = testcases[i][1]; azi1 = testcases[i][2]; lat2 = testcases[i][3]; lon2 = testcases[i][4]; azi2 = testcases[i][5]; s12 = testcases[i][6]; a12 = testcases[i][7]; m12 = testcases[i][8]; M12 = testcases[i][9]; M21 = testcases[i][10]; S12 = testcases[i][11]; geod_gendirect(&g, lat1, lon1, azi1, flags, a12, &lat2a, &lon2a, &azi2a, &s12a, &m12a, &M12a, &M21a, &S12a); result += assertEquals(lat2, lat2a, 1e-13); result += assertEquals(lon2, lon2a, 1e-13); result += assertEquals(azi2, azi2a, 1e-13); result += assertEquals(s12, s12a, 1e-8); result += assertEquals(m12, m12a, 1e-8); result += assertEquals(M12, M12a, 1e-15); result += assertEquals(M21, M21a, 1e-15); result += assertEquals(S12, S12a, 0.1); } return result; } int GeodSolve0() { double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 40.6, -73.8, 49.01666667, 2.55, &s12, &azi1, &azi2); result += assertEquals(azi1, 53.47022, 0.5e-5); result += assertEquals(azi2, 111.59367, 0.5e-5); result += assertEquals(s12, 5853226, 0.5); return result; } int GeodSolve1() { double lat2, lon2, azi2; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_direct(&g, 40.63972222, -73.77888889, 53.5, 5850e3, &lat2, &lon2, &azi2); result += assertEquals(lat2, 49.01467, 0.5e-5); result += assertEquals(lon2, 2.56106, 0.5e-5); result += assertEquals(azi2, 111.62947, 0.5e-5); return result; } int GeodSolve2() { /* Check fix for antipodal prolate bug found 2010-09-04 */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, 6.4e6, -1/150.0); geod_inverse(&g, 0.07476, 0, -0.07476, 180, &s12, &azi1, &azi2); result += assertEquals(azi1, 90.00078, 0.5e-5); result += assertEquals(azi2, 90.00078, 0.5e-5); result += assertEquals(s12, 20106193, 0.5); geod_inverse(&g, 0.1, 0, -0.1, 180, &s12, &azi1, &azi2); result += assertEquals(azi1, 90.00105, 0.5e-5); result += assertEquals(azi2, 90.00105, 0.5e-5); result += assertEquals(s12, 20106193, 0.5); return result; } int GeodSolve4() { /* Check fix for short line bug found 2010-05-21 */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 36.493349428792, 0, 36.49334942879201, .0000008, &s12, 0, 0); result += assertEquals(s12, 0.072, 0.5e-3); return result; } int GeodSolve5() { /* Check fix for point2=pole bug found 2010-05-03 */ double lat2, lon2, azi2; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_direct(&g, 0.01777745589997, 30, 0, 10e6, &lat2, &lon2, &azi2); result += assertEquals(lat2, 90, 0.5e-5); if (lon2 < 0) { result += assertEquals(lon2, -150, 0.5e-5); result += assertEquals(azi2, -180, 0.5e-5); } else { result += assertEquals(lon2, 30, 0.5e-5); result += assertEquals(azi2, 0, 0.5e-5); } return result; } int GeodSolve6() { /* Check fix for volatile sbet12a bug found 2011-06-25 (gcc 4.4.4 * x86 -O3). Found again on 2012-03-27 with tdm-mingw32 (g++ 4.6.1). */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 88.202499451857, 0, -88.202499451857, 179.981022032992859592, &s12, 0, 0); result += assertEquals(s12, 20003898.214, 0.5e-3); geod_inverse(&g, 89.262080389218, 0, -89.262080389218, 179.992207982775375662, &s12, 0, 0); result += assertEquals(s12, 20003925.854, 0.5e-3); geod_inverse(&g, 89.333123580033, 0, -89.333123580032997687, 179.99295812360148422, &s12, 0, 0); result += assertEquals(s12, 20003926.881, 0.5e-3); return result; } int GeodSolve9() { /* Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 56.320923501171, 0, -56.320923501171, 179.664747671772880215, &s12, 0, 0); result += assertEquals(s12, 19993558.287, 0.5e-3); return result; } int GeodSolve10() { /* Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio * 10 rel + debug) */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 52.784459512564, 0, -52.784459512563990912, 179.634407464943777557, &s12, 0, 0); result += assertEquals(s12, 19991596.095, 0.5e-3); return result; } int GeodSolve11() { /* Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio * 10 rel + debug) */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 48.522876735459, 0, -48.52287673545898293, 179.599720456223079643, &s12, 0, 0); result += assertEquals(s12, 19989144.774, 0.5e-3); return result; } int GeodSolve12() { /* Check fix for inverse geodesics on extreme prolate/oblate * ellipsoids Reported 2012-08-29 Stefan Guenther * ; fixed 2012-10-07 */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, 89.8, -1.83); geod_inverse(&g, 0, 0, -10, 160, &s12, &azi1, &azi2); result += assertEquals(azi1, 120.27, 1e-2); result += assertEquals(azi2, 105.15, 1e-2); result += assertEquals(s12, 266.7, 1e-1); return result; } int GeodSolve14() { /* Check fix for inverse ignoring lon12 = nan */ double azi1, azi2, s12, nan = sqrt(-1.0); struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 0, 0, 1, nan, &s12, &azi1, &azi2); result += azi1 == azi1 ? 1 : 0; result += azi2 == azi2 ? 1 : 0; result += s12 == s12 ? 1 : 0; return result; } int GeodSolve15() { /* Initial implementation of Math::eatanhe was wrong for e^2 < 0. This * checks that this is fixed. */ double S12; struct geod_geodesic g; int result = 0; geod_init(&g, 6.4e6, -1/150.0); geod_gendirect(&g, 1, 2, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, &S12); result += assertEquals(S12, 23700, 0.5); return result; } int GeodSolve17() { /* Check fix for LONG_UNROLL bug found on 2015-05-07 */ double lat2, lon2, azi2; struct geod_geodesic g; struct geod_geodesicline l; int result = 0; unsigned flags = GEOD_LONG_UNROLL; geod_init(&g, wgs84_a, wgs84_f); geod_gendirect(&g, 40, -75, -10, flags, 2e7, &lat2, &lon2, &azi2, 0, 0, 0, 0, 0); result += assertEquals(lat2, -39, 1); result += assertEquals(lon2, -254, 1); result += assertEquals(azi2, -170, 1); geod_lineinit(&l, &g, 40, -75, -10, 0); geod_genposition(&l, flags, 2e7, &lat2, &lon2, &azi2, 0, 0, 0, 0, 0); result += assertEquals(lat2, -39, 1); result += assertEquals(lon2, -254, 1); result += assertEquals(azi2, -170, 1); geod_direct(&g, 40, -75, -10, 2e7, &lat2, &lon2, &azi2); result += assertEquals(lat2, -39, 1); result += assertEquals(lon2, 105, 1); result += assertEquals(azi2, -170, 1); geod_position(&l, 2e7, &lat2, &lon2, &azi2); result += assertEquals(lat2, -39, 1); result += assertEquals(lon2, 105, 1); result += assertEquals(azi2, -170, 1); return result; } int GeodSolve26() { /* Check 0/0 problem with area calculation on sphere 2015-09-08 */ double S12; struct geod_geodesic g; int result = 0; geod_init(&g, 6.4e6, 0); geod_geninverse(&g, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, &S12); result += assertEquals(S12, 49911046115.0, 0.5); return result; } int GeodSolve28() { /* Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in * Java implementation fixed on 2015-05-19). */ double a12; struct geod_geodesic g; int result = 0; geod_init(&g, 6.4e6, 0.1); a12 = geod_gendirect(&g, 1, 2, 10, 0, 5e6, 0, 0, 0, 0, 0, 0, 0, 0); result += assertEquals(a12, 48.55570690, 0.5e-8); return result; } int GeodSolve33() { /* Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- * sind(-0.0) = +0.0 -- and in some version of Visual Studio -- * fmod(-0.0, 360.0) = +0.0. */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 0, 0, 0, 179, &s12, &azi1, &azi2); result += assertEquals(azi1, 90.00000, 0.5e-5); result += assertEquals(azi2, 90.00000, 0.5e-5); result += assertEquals(s12, 19926189, 0.5); geod_inverse(&g, 0, 0, 0, 179.5, &s12, &azi1, &azi2); result += assertEquals(azi1, 55.96650, 0.5e-5); result += assertEquals(azi2, 124.03350, 0.5e-5); result += assertEquals(s12, 19980862, 0.5); geod_inverse(&g, 0, 0, 0, 180, &s12, &azi1, &azi2); result += assertEquals(azi1, 0.00000, 0.5e-5); result += assertEquals(azi2, -180.00000, 0.5e-5); result += assertEquals(s12, 20003931, 0.5); geod_inverse(&g, 0, 0, 1, 180, &s12, &azi1, &azi2); result += assertEquals(azi1, 0.00000, 0.5e-5); result += assertEquals(azi2, -180.00000, 0.5e-5); result += assertEquals(s12, 19893357, 0.5); geod_init(&g, 6.4e6, 0); geod_inverse(&g, 0, 0, 0, 179, &s12, &azi1, &azi2); result += assertEquals(azi1, 90.00000, 0.5e-5); result += assertEquals(azi2, 90.00000, 0.5e-5); result += assertEquals(s12, 19994492, 0.5); geod_inverse(&g, 0, 0, 0, 180, &s12, &azi1, &azi2); result += assertEquals(azi1, 0.00000, 0.5e-5); result += assertEquals(azi2, -180.00000, 0.5e-5); result += assertEquals(s12, 20106193, 0.5); geod_inverse(&g, 0, 0, 1, 180, &s12, &azi1, &azi2); result += assertEquals(azi1, 0.00000, 0.5e-5); result += assertEquals(azi2, -180.00000, 0.5e-5); result += assertEquals(s12, 19994492, 0.5); geod_init(&g, 6.4e6, -1/300.0); geod_inverse(&g, 0, 0, 0, 179, &s12, &azi1, &azi2); result += assertEquals(azi1, 90.00000, 0.5e-5); result += assertEquals(azi2, 90.00000, 0.5e-5); result += assertEquals(s12, 19994492, 0.5); geod_inverse(&g, 0, 0, 0, 180, &s12, &azi1, &azi2); result += assertEquals(azi1, 90.00000, 0.5e-5); result += assertEquals(azi2, 90.00000, 0.5e-5); result += assertEquals(s12, 20106193, 0.5); geod_inverse(&g, 0, 0, 0.5, 180, &s12, &azi1, &azi2); result += assertEquals(azi1, 33.02493, 0.5e-5); result += assertEquals(azi2, 146.97364, 0.5e-5); result += assertEquals(s12, 20082617, 0.5); geod_inverse(&g, 0, 0, 1, 180, &s12, &azi1, &azi2); result += assertEquals(azi1, 0.00000, 0.5e-5); result += assertEquals(azi2, -180.00000, 0.5e-5); result += assertEquals(s12, 20027270, 0.5); return result; } int GeodSolve55() { /* Check fix for nan + point on equator or pole not returning all nans in * Geodesic::Inverse, found 2015-09-23. */ double azi1, azi2, s12, nan = sqrt(-1.0); struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, nan, 0, 0, 90, &s12, &azi1, &azi2); result += azi1 == azi1 ? 1 : 0; result += azi2 == azi2 ? 1 : 0; result += s12 == s12 ? 1 : 0; geod_inverse(&g, nan, 0, 90, 9, &s12, &azi1, &azi2); result += azi1 == azi1 ? 1 : 0; result += azi2 == azi2 ? 1 : 0; result += s12 == s12 ? 1 : 0; return result; } void planimeter(const struct geod_geodesic* g, double points[][2], int N, double* perimeter, double* area) { struct geod_polygon p; int i; geod_polygon_init(&p, 0); for (i = 0; i < N; ++i) geod_polygon_addpoint(g, &p, points[i][0], points[i][1]); geod_polygon_compute(g, &p, 0, 1, area, perimeter); } void polylength(const struct geod_geodesic* g, double points[][2], int N, double* perimeter) { struct geod_polygon p; int i; geod_polygon_init(&p, 1); for (i = 0; i < N; ++i) geod_polygon_addpoint(g, &p, points[i][0], points[i][1]); geod_polygon_compute(g, &p, 0, 1, 0, perimeter); } int Planimeter0() { /* Check fix for pole-encircling bug found 2011-03-16 */ double pa[4][2] = {{89, 0}, {89, 90}, {89, 180}, {89, 270}}; double pb[4][2] = {{-89, 0}, {-89, 90}, {-89, 180}, {-89, 270}}; double pc[4][2] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}}; double pd[3][2] = {{90, 0}, {0, 0}, {0, 90}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, pa, 4, &perimeter, &area); result += assertEquals(perimeter, 631819.8745, 1e-4); result += assertEquals(area, 24952305678.0, 1); planimeter(&g, pb, 4, &perimeter, &area); result += assertEquals(perimeter, 631819.8745, 1e-4); result += assertEquals(area, -24952305678.0, 1); planimeter(&g, pc, 4, &perimeter, &area); result += assertEquals(perimeter, 627598.2731, 1e-4); result += assertEquals(area, 24619419146.0, 1); planimeter(&g, pd, 3, &perimeter, &area); result += assertEquals(perimeter, 30022685, 1); result += assertEquals(area, 63758202715511.0, 1); polylength(&g, pd, 3, &perimeter); result += assertEquals(perimeter, 20020719, 1); return result; } int Planimeter5() { /* Check fix for Planimeter pole crossing bug found 2011-06-24 */ double points[3][2] = {{89, 0.1}, {89, 90.1}, {89, -179.9}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, points, 3, &perimeter, &area); result += assertEquals(perimeter, 539297, 1); result += assertEquals(area, 12476152838.5, 1); return result; } int Planimeter6() { /* Check fix for Planimeter lon12 rounding bug found 2012-12-03 */ double pa[3][2] = {{9, -0.00000000000001}, {9, 180}, {9, 0}}; double pb[3][2] = {{9, 0.00000000000001}, {9, 0}, {9, 180}}; double pc[3][2] = {{9, 0.00000000000001}, {9, 180}, {9, 0}}; double pd[3][2] = {{9, -0.00000000000001}, {9, 0}, {9, 180}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, pa, 3, &perimeter, &area); result += assertEquals(perimeter, 36026861, 1); result += assertEquals(area, 0, 1); planimeter(&g, pb, 3, &perimeter, &area); result += assertEquals(perimeter, 36026861, 1); result += assertEquals(area, 0, 1); planimeter(&g, pc, 3, &perimeter, &area); result += assertEquals(perimeter, 36026861, 1); result += assertEquals(area, 0, 1); planimeter(&g, pd, 3, &perimeter, &area); result += assertEquals(perimeter, 36026861, 1); result += assertEquals(area, 0, 1); return result; } int Planimeter12() { /* Area of arctic circle (not really -- adjunct to rhumb-area test) */ double points[2][2] = {{66.562222222, 0}, {66.562222222, 180}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, points, 2, &perimeter, &area); result += assertEquals(perimeter, 10465729, 1); result += assertEquals(area, 0, 1); return result; } int Planimeter13() { /* Check encircling pole twice */ double points[6][2] = {{89,-360}, {89,-240}, {89,-120}, {89,0}, {89,120}, {89,240}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, points, 6, &perimeter, &area); result += assertEquals(perimeter, 1160741, 1); result += assertEquals(area, 32415230256.0, 1); return result; } int main() { int n = 0, i; if ((i = testinverse())) {++n; printf("testinverse fail: %d\n", i);} if ((i = testdirect())) {++n; printf("testdirect fail: %d\n", i);} if ((i = testarcdirect())) {++n; printf("testarcdirect fail: %d\n", i);} if ((i = GeodSolve0())) {++n; printf("GeodSolve0 fail: %d\n", i);} if ((i = GeodSolve1())) {++n; printf("GeodSolve1 fail: %d\n", i);} if ((i = GeodSolve2())) {++n; printf("GeodSolve2 fail: %d\n", i);} if ((i = GeodSolve4())) {++n; printf("GeodSolve4 fail: %d\n", i);} if ((i = GeodSolve5())) {++n; printf("GeodSolve5 fail: %d\n", i);} if ((i = GeodSolve6())) {++n; printf("GeodSolve6 fail: %d\n", i);} if ((i = GeodSolve9())) {++n; printf("GeodSolve9 fail: %d\n", i);} if ((i = GeodSolve10())) {++n; printf("GeodSolve10 fail: %d\n", i);} if ((i = GeodSolve11())) {++n; printf("GeodSolve11 fail: %d\n", i);} if ((i = GeodSolve12())) {++n; printf("GeodSolve12 fail: %d\n", i);} if ((i = GeodSolve14())) {++n; printf("GeodSolve14 fail: %d\n", i);} if ((i = GeodSolve15())) {++n; printf("GeodSolve15 fail: %d\n", i);} if ((i = GeodSolve17())) {++n; printf("GeodSolve17 fail: %d\n", i);} if ((i = GeodSolve26())) {++n; printf("GeodSolve26 fail: %d\n", i);} if ((i = GeodSolve28())) {++n; printf("GeodSolve28 fail: %d\n", i);} if ((i = GeodSolve33())) {++n; printf("GeodSolve33 fail: %d\n", i);} if ((i = GeodSolve55())) {++n; printf("GeodSolve55 fail: %d\n", i);} if ((i = Planimeter0())) {++n; printf("Planimeter0 fail: %d\n", i);} if ((i = Planimeter5())) {++n; printf("Planimeter5 fail: %d\n", i);} if ((i = Planimeter6())) {++n; printf("Planimeter6 fail: %d\n", i);} if ((i = Planimeter12())) {++n; printf("Planimeter12 fail: %d\n", i);} if ((i = Planimeter13())) {++n; printf("Planimeter13 fail: %d\n", i);} return n; } /** @endcond */ GeographicLib-1.45/legacy/Fortran/geoddirect.for0000644000771000077100000000162712602735126021532 0ustar ckarneyckarney*> @file geoddirect.for *! @brief A test program for direct() *> A simple program to solve the direct geodesic problem. *! *! This program reads in lines with lat1, lon1, azi1, s12 and prints out *! lines with lat2, lon2, azi2 (for the WGS84 ellipsoid). program geoddirect implicit none include 'geodesic.inc' double precision a, f, lat1, lon1, azi1, lat2, lon2, azi2, s12, + dummy1, dummy2, dummy3, dummy4, dummy5 integer flags, omask * WGS84 values a = 6378137d0 f = 1/298.257223563d0 flags = 0 omask = 0 10 continue read(*, *, end=90, err=90) lat1, lon1, azi1, s12 call direct(a, f, lat1, lon1, azi1, s12, flags, + lat2, lon2, azi2, omask, + dummy1, dummy2, dummy3, dummy4, dummy5) print 20, lat2, lon2, azi2 20 format(1x, f20.15, 1x, f20.15, 1x, f20.15) go to 10 90 continue stop end GeographicLib-1.45/legacy/Fortran/geodesic.for0000644000771000077100000021262012602735126021200 0ustar ckarneyckarney* The subroutines in this files are documented at * http://geographiclib.sourceforge.net/html/Fortran/ * *> @file geodesic.for *! @brief Implementation of geodesic routines in Fortran *! *! This is a Fortran implementation 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 *! subroutine direct(). *! - the inverse problem -- given \e lat1, \e lon1, \e lat2, \e lon2, *! determine \e s12, \e azi1, and \e azi2. This is solved by the *! subroutine invers(). *! *! 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 SS12 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 geodesic 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 MM12 and \e MM21 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 MM12 \e dt at point 2. \e MM21 *! is defined similarly (with the geodesics being parallel to one *! another at point 2). On a flat surface, we have \e MM12 = \e MM21 *! = 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 SS13 = \e SS12 + \e SS23 *! - \e m13 = \e m12 \e MM23 + \e m23 \e MM21 *! - \e MM13 = \e MM12 \e MM23 − (1 − \e MM12 \e MM21) \e *! m23 / \e m12 *! - \e MM31 = \e MM32 \e MM21 − (1 − \e MM23 \e MM32) \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 MM12, \e MM21] → [\e *! MM21, \e MM12], \e SS12 → −\e SS12. (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 SS12 → −\e SS12. (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. *! Because of the limitations of Fortran 77, the classes have been *! replaced by simple subroutines with no attempt to save "state" across *! subroutine calls. 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 Fortran code since this may make *! porting fixes from the C++ code more difficult. *! *! Copyright (c) Charles Karney (2012-2015) and *! licensed under the MIT/X11 License. For more information, see *! http://geographiclib.sourceforge.net/ *! *! This library was distributed with *! GeographicLib 1.45. *> Solve the direct geodesic problem *! *! @param[in] a the equatorial radius (meters). *! @param[in] f the flattening of the ellipsoid. Setting \e f = 0 gives *! a sphere. Negative \e f gives a prolate 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] s12a12 if \e arcmode is not set, this is the distance *! between point 1 and point 2 (meters); otherwise it is the arc *! length between point 1 and point 2 (degrees); it can be negative. *! @param[in] flags a bitor'ed combination of the \e arcmode and \e *! unroll flags. *! @param[out] lat2 latitude of point 2 (degrees). *! @param[out] lon2 longitude of point 2 (degrees). *! @param[out] azi2 (forward) azimuth at point 2 (degrees). *! @param[in] omask a bitor'ed combination of mask values *! specifying which of the following parameters should be set. *! @param[out] a12s12 if \e arcmode is not set, this is the arc length *! between point 1 and point 2 (degrees); otherwise it is the distance *! between point 1 and point 2 (meters). *! @param[out] m12 reduced length of geodesic (meters). *! @param[out] MM12 geodesic scale of point 2 relative to point 1 *! (dimensionless). *! @param[out] MM21 geodesic scale of point 1 relative to point 2 *! (dimensionless). *! @param[out] SS12 area under the geodesic (meters2). *! *! \e flags is an integer in [0, 4) whose binary bits are interpreted *! as follows *! - 1 the \e arcmode flag *! - 2 the \e unroll flag *! . *! If \e arcmode is not set, \e s12a12 is \e s12 and \e a12s12 is \e *! a12; otherwise, \e s12a12 is \e a12 and \e a12s12 is \e s12. It \e *! unroll is not set, the value \e lon2 returned is in the range *! [−180°, 180°); if unroll is set, the longitude variable *! is "unrolled" so that \e lon2 − \e lon1 indicates how many *! times and in what sense the geodesic encircles the ellipsoid. *! *! \e omask is an integer in [0, 16) whose binary bits are interpreted *! as follows *! - 1 return \e a12 *! - 2 return \e m12 *! - 4 return \e MM12 and \e MM21 *! - 8 return \e SS12 *! *! \e lat1 should be in the range [−90°, 90°]. The value *! \e azi2 returned is in the range [−180°, 180°). *! *! If either point is at a pole, the azimuth is defined by keeping the *! longitude fixed, writing \e lat = \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 of use: *! \include geoddirect.for subroutine direct(a, f, lat1, lon1, azi1, s12a12, flags, + lat2, lon2, azi2, omask, a12s12, m12, MM12, MM21, SS12) * input double precision a, f, lat1, lon1, azi1, s12a12 integer flags, omask * output double precision lat2, lon2, azi2 * optional output double precision a12s12, m12, MM12, MM21, SS12 integer ord, nC1, nC1p, nC2, nA3, nA3x, nC3, nC3x, nC4, nC4x parameter (ord = 6, nC1 = ord, nC1p = ord, + nC2 = ord, nA3 = ord, nA3x = nA3, + nC3 = ord, nC3x = (nC3 * (nC3 - 1)) / 2, + nC4 = ord, nC4x = (nC4 * (nC4 + 1)) / 2) double precision A3x(0:nA3x-1), C3x(0:nC3x-1), C4x(0:nC4x-1), + C1a(nC1), C1pa(nC1p), C2a(nC2), C3a(nC3-1), C4a(0:nC4-1) double precision atanhx, hypotx, + AngNm, AngRnd, TrgSum, A1m1f, A2m1f, A3f, atn2dx, LatFix logical arcmod, unroll, arcp, redlp, scalp, areap double precision e2, f1, ep2, n, b, c2, + salp0, calp0, k2, eps, + salp1, calp1, ssig1, csig1, cbet1, sbet1, dn1, somg1, comg1, + salp2, calp2, ssig2, csig2, sbet2, cbet2, dn2, somg2, comg2, + ssig12, csig12, salp12, calp12, omg12, lam12, lon12, + sig12, stau1, ctau1, tau12, t, s, c, serr, E, + A1m1, A2m1, A3c, A4, AB1, AB2, + B11, B12, B21, B22, B31, B41, B42, J12 double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init if (.not.init) call geoini e2 = f * (2 - f) ep2 = e2 / (1 - e2) f1 = 1 - f n = f / (2 - f) b = a * f1 c2 = 0 arcmod = mod(flags/1, 2) .eq. 1 unroll = mod(flags/2, 2) .eq. 1 arcp = mod(omask/1, 2) .eq. 1 redlp = mod(omask/2, 2) .eq. 1 scalp = mod(omask/4, 2) .eq. 1 areap = mod(omask/8, 2) .eq. 1 if (areap) then if (e2 .eq. 0) then c2 = a**2 else if (e2 .gt. 0) then c2 = (a**2 + b**2 * atanhx(sqrt(e2)) / sqrt(e2)) / 2 else c2 = (a**2 + b**2 * atan(sqrt(abs(e2))) / sqrt(abs(e2))) / 2 end if end if call A3cof(n, A3x) call C3cof(n, C3x) if (areap) call C4cof(n, C4x) * Guard against underflow in salp0 call sncsdx(AngRnd(azi1), salp1, calp1) call sncsdx(AngRnd(LatFix(lat1)), sbet1, cbet1) sbet1 = f1 * sbet1 call norm2(sbet1, cbet1) * Ensure cbet1 = +dbleps at poles cbet1 = max(tiny, cbet1) dn1 = sqrt(1 + ep2 * sbet1**2) * Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), * alp0 in [0, pi/2 - |bet1|] salp0 = salp1 * cbet1 * Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following * is slightly better (consider the case salp1 = 0). calp0 = hypotx(calp1, 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 = +dbleps. * With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi. ssig1 = sbet1 somg1 = salp0 * sbet1 if (sbet1 .ne. 0 .or. calp1 .ne. 0) then csig1 = cbet1 * calp1 else csig1 = 1 end if comg1 = csig1 * sig1 in (-pi, pi] call norm2(ssig1, csig1) * norm2(somg1, comg1); -- don't need to normalize! k2 = calp0**2 * ep2 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2) A1m1 = A1m1f(eps) call C1f(eps, C1a) B11 = TrgSum(.true., ssig1, csig1, C1a, nC1) s = sin(B11) c = cos(B11) * tau1 = sig1 + B11 stau1 = ssig1 * c + csig1 * s ctau1 = csig1 * c - ssig1 * s * Not necessary because C1pa reverts C1a * B11 = -TrgSum(true, stau1, ctau1, C1pa, nC1p) if (.not. arcmod) call C1pf(eps, C1pa) if (redlp .or. scalp) then A2m1 = A2m1f(eps) call C2f(eps, C2a) B21 = TrgSum(.true., ssig1, csig1, C2a, nC2) else * Suppress bogus warnings about unitialized variables A2m1 = 0 B21 = 0 end if call C3f(eps, C3x, C3a) A3c = -f * salp0 * A3f(eps, A3x) B31 = TrgSum(.true., ssig1, csig1, C3a, nC3-1) if (areap) then call C4f(eps, C4x, C4a) * Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) A4 = a**2 * calp0 * salp0 * e2 B41 = TrgSum(.false., ssig1, csig1, C4a, nC4) else * Suppress bogus warnings about unitialized variables A4 = 0 B41 = 0 end if if (arcmod) then * Interpret s12a12 as spherical arc length sig12 = s12a12 * degree call sncsdx(s12a12, ssig12, csig12) * Suppress bogus warnings about unitialized variables B12 = 0 else * Interpret s12a12 as distance tau12 = s12a12 / (b * (1 + A1m1)) s = sin(tau12) c = cos(tau12) * tau2 = tau1 + tau12 B12 = - TrgSum(.true., + stau1 * c + ctau1 * s, ctau1 * c - stau1 * s, C1pa, nC1p) sig12 = tau12 - (B12 - B11) ssig12 = sin(sig12) csig12 = cos(sig12) if (abs(f) .gt. 0.01d0) then * 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 ssig2 = ssig1 * csig12 + csig1 * ssig12 csig2 = csig1 * csig12 - ssig1 * ssig12 B12 = TrgSum(.true., ssig2, csig2, C1a, nC1) serr = (1 + A1m1) * (sig12 + (B12 - B11)) - s12a12 / b sig12 = sig12 - serr / sqrt(1 + k2 * ssig2**2) ssig12 = sin(sig12) csig12 = cos(sig12) * Update B12 below end if end if * sig2 = sig1 + sig12 ssig2 = ssig1 * csig12 + csig1 * ssig12 csig2 = csig1 * csig12 - ssig1 * ssig12 dn2 = sqrt(1 + k2 * ssig2**2) if (arcmod .or. abs(f) .gt. 0.01d0) + B12 = TrgSum(.true., ssig2, csig2, C1a, nC1) AB1 = (1 + A1m1) * (B12 - B11) * sin(bet2) = cos(alp0) * sin(sig2) sbet2 = calp0 * ssig2 * Alt: cbet2 = hypot(csig2, salp0 * ssig2) cbet2 = hypotx(salp0, calp0 * csig2) if (cbet2 .eq. 0) then * I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case cbet2 = tiny csig2 = cbet2 end if * tan(omg2) = sin(alp0) * tan(sig2) * No need to normalize somg2 = salp0 * ssig2 comg2 = csig2 * tan(alp0) = cos(sig2)*tan(alp2) * No need to normalize salp2 = salp0 calp2 = calp0 * csig2 * East or west going? E = sign(1d0, salp0) * omg12 = omg2 - omg1 if (unroll) then omg12 = E * (sig12 + - (atan2( ssig2, csig2) - atan2( ssig1, csig1)) + + (atan2(E * somg2, comg2) - atan2(E * somg1, comg1))) else omg12 = atan2(somg2 * comg1 - comg2 * somg1, + comg2 * comg1 + somg2 * somg1) end if lam12 = omg12 + A3c * + ( sig12 + (TrgSum(.true., ssig2, csig2, C3a, nC3-1) + - B31)) lon12 = lam12 / degree if (unroll) then lon2 = lon1 + lon12 else lon2 = AngNm(AngNm(lon1) + AngNm(lon12)) end if lat2 = atn2dx(sbet2, f1 * cbet2) * minus signs give range [-180, 180). 0- converts -0 to +0. azi2 = atn2dx(salp2, calp2) if (redlp .or. scalp) then B22 = TrgSum(.true., ssig2, csig2, C2a, nC2) AB2 = (1 + A2m1) * (B22 - B21) J12 = (A1m1 - A2m1) * sig12 + (AB1 - AB2) end if * Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure * accurate cancellation in the case of coincident points. if (redlp) m12 = b * ((dn2 * (csig1 * ssig2) - + dn1 * (ssig1 * csig2)) - csig1 * csig2 * J12) if (scalp) then t = k2 * (ssig2 - ssig1) * (ssig2 + ssig1) / (dn1 + dn2) MM12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1 MM21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2 end if if (areap) then B42 = TrgSum(.false., ssig2, csig2, C4a, nC4) if (calp0 .eq. 0 .or. salp0 .eq. 0) then * alp12 = alp2 - alp1, used in atan2 so no need to normalize 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 .eq. 0 .and. calp12 .lt. 0) then salp12 = tiny * calp1 calp12 = -1 end if 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 if (csig12 .le. 0) then salp12 = csig1 * (1 - csig12) + ssig12 * ssig1 else salp12 = ssig12 * (csig1 * ssig12 / (1 + csig12) + ssig1) end if salp12 = calp0 * salp0 * salp12 calp12 = salp0**2 + calp0**2 * csig1 * csig2 end if SS12 = c2 * atan2(salp12, calp12) + A4 * (B42 - B41) end if if (arcp) then if (arcmod) then a12s12 = b * ((1 + A1m1) * sig12 + AB1) else a12s12 = sig12 / degree end if end if return end *> Solve the inverse geodesic problem. *! *! @param[in] a the equatorial radius (meters). *! @param[in] f the flattening of the ellipsoid. Setting \e f = 0 gives *! a sphere. Negative \e f gives a prolate 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] s12 distance between point 1 and point 2 (meters). *! @param[out] azi1 azimuth at point 1 (degrees). *! @param[out] azi2 (forward) azimuth at point 2 (degrees). *! @param[in] omask a bitor'ed combination of mask values *! specifying which of the following parameters should be set. *! @param[out] a12 arc length of between point 1 and point 2 (degrees). *! @param[out] m12 reduced length of geodesic (meters). *! @param[out] MM12 geodesic scale of point 2 relative to point 1 *! (dimensionless). *! @param[out] MM21 geodesic scale of point 1 relative to point 2 *! (dimensionless). *! @param[out] SS12 area under the geodesic (meters2). *! *! \e omask is an integer in [0, 16) whose binary bits are interpreted *! as follows *! - 1 return \e a12 *! - 2 return \e m12 *! - 4 return \e MM12 and \e MM21 *! - 8 return \e SS12 *! *! \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°). *! *! 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 of use: *! \include geodinverse.for subroutine invers(a, f, lat1, lon1, lat2, lon2, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) * input double precision a, f, lat1, lon1, lat2, lon2 integer omask * output double precision s12, azi1, azi2 * optional output double precision a12, m12, MM12, MM21, SS12 integer ord, nA3, nA3x, nC3, nC3x, nC4, nC4x, nC parameter (ord = 6, nA3 = ord, nA3x = nA3, + nC3 = ord, nC3x = (nC3 * (nC3 - 1)) / 2, + nC4 = ord, nC4x = (nC4 * (nC4 + 1)) / 2, + nC = ord) double precision A3x(0:nA3x-1), C3x(0:nC3x-1), C4x(0:nC4x-1), + Ca(nC) double precision atanhx, hypotx, + AngDif, AngRnd, TrgSum, Lam12f, InvSta, atn2dx, LatFix integer latsgn, lonsgn, swapp, numit logical arcp, redlp, scalp, areap, merid, tripn, tripb double precision e2, f1, ep2, n, b, c2, + lat1x, lat2x, salp0, calp0, k2, eps, + salp1, calp1, ssig1, csig1, cbet1, sbet1, dbet1, dn1, + salp2, calp2, ssig2, csig2, sbet2, cbet2, dbet2, dn2, + slam12, clam12, salp12, calp12, omg12, lam12, lon12, + salp1a, calp1a, salp1b, calp1b, + dalp1, sdalp1, cdalp1, nsalp1, alp12, somg12, domg12, + sig12, v, dv, dnm, dummy, + A4, B41, B42, s12x, m12x, a12x double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2, lmask logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init if (.not.init) call geoini f1 = 1 - f e2 = f * (2 - f) ep2 = e2 / f1**2 n = f / ( 2 - f) b = a * f1 c2 = 0 arcp = mod(omask/1, 2) .eq. 1 redlp = mod(omask/2, 2) .eq. 1 scalp = mod(omask/4, 2) .eq. 1 areap = mod(omask/8, 2) .eq. 1 if (scalp) then lmask = 16 + 2 + 4 else lmask = 16 + 2 end if if (areap) then if (e2 .eq. 0) then c2 = a**2 else if (e2 .gt. 0) then c2 = (a**2 + b**2 * atanhx(sqrt(e2)) / sqrt(e2)) / 2 else c2 = (a**2 + b**2 * atan(sqrt(abs(e2))) / sqrt(abs(e2))) / 2 end if end if call A3cof(n, A3x) call C3cof(n, C3x) if (areap) call C4cof(n, C4x) * 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. * If very close to being on the same half-meridian, then make it so. lon12 = AngRnd(AngDif(lon1, lon2)) * Make longitude difference positive. if (lon12 .ge. 0) then lonsgn = 1 else lonsgn = -1 end if lon12 = lon12 * lonsgn * If really close to the equator, treat as on equator. lat1x = AngRnd(LatFix(lat1)) lat2x = AngRnd(LatFix(lat2)) * Swap points so that point with higher (abs) latitude is point 1 * If one latitude is a nan, then it becomes lat1. if (abs(lat1x) .lt. abs(lat2x)) then swapp = -1 else swapp = 1 end if if (swapp .lt. 0) then lonsgn = -lonsgn call swap(lat1x, lat2x) end if * Make lat1 <= 0 if (lat1x .lt. 0) then latsgn = 1 else latsgn = -1 end if lat1x = lat1x * latsgn lat2x = lat2x * latsgn * Now we have * * 0 <= lon12 <= 180 * -90 <= lat1 <= 0 * lat1 <= lat2 <= -lat1 * * longsign, swapp, latsgn 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. call sncsdx(lat1x, sbet1, cbet1) sbet1 = f1 * sbet1 call norm2(sbet1, cbet1) * Ensure cbet1 = +dbleps at poles cbet1 = max(tiny, cbet1) call sncsdx(lat2x, sbet2, cbet2) sbet2 = f1 * sbet2 call norm2(sbet2, cbet2) * Ensure cbet2 = +dbleps at poles cbet2 = max(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 .lt. -sbet1) then if (cbet2 .eq. cbet1) sbet2 = sign(sbet1, sbet2) else if (abs(sbet2) .eq. -sbet1) cbet2 = cbet1 end if dn1 = sqrt(1 + ep2 * sbet1**2) dn2 = sqrt(1 + ep2 * sbet2**2) lam12 = lon12 * degree call sncsdx(lon12, slam12, clam12) * Suppress bogus warnings about unitialized variables a12x = 0 merid = lat1x .eq. -90 .or. slam12 .eq. 0 if (merid) then * Endpoints are on a single full meridian, so the geodesic might lie on * a meridian. * Head to the target longitude calp1 = clam12 salp1 = slam12 * At the target we're heading north calp2 = 1 salp2 = 0 * tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1 csig1 = calp1 * cbet1 ssig2 = sbet2 csig2 = calp2 * cbet2 * sig12 = sig2 - sig1 sig12 = atan2(0d0 + max(0d0, csig1 * ssig2 - ssig1 * csig2), + csig1 * csig2 + ssig1 * ssig2) call Lengs(n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, lmask, + s12x, m12x, dummy, MM12, MM21, ep2, 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 .lt. 1 .or. m12x .ge. 0) then if (sig12 .lt. 3 * tiny) then sig12 = 0 m12x = 0 s12x = 0 end if m12x = m12x * b s12x = s12x * b a12x = sig12 / degree else * m12 < 0, i.e., prolate and too close to anti-podal merid = .false. end if end if * Mimic the way Lambda12 works with calp1 = 0 if (.not. merid .and. sbet1 .eq. 0 .and. + (f .le. 0 .or. lam12 .le. pi - f * pi)) then * Geodesic runs along equator calp1 = 0 calp2 = 0 salp1 = 1 salp2 = 1 s12x = a * lam12 sig12 = lam12 / f1 omg12 = sig12 m12x = b * sin(sig12) if (scalp) then MM12 = cos(sig12) MM21 = MM12 end if a12x = lon12 / f1 else if (.not. merid) then * 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 sig12 = InvSta(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, + f, A3x, salp1, calp1, salp2, calp2, dnm, Ca) if (sig12 .ge. 0) then * Short lines (InvSta sets salp2, calp2, dnm) s12x = sig12 * b * dnm m12x = dnm**2 * b * sin(sig12 / dnm) if (scalp) then MM12 = cos(sig12 / dnm) MM21 = MM12 end if a12x = sig12 / degree omg12 = lam12 / (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. * Bracketing range salp1a = tiny calp1a = 1 salp1b = tiny calp1b = -1 tripn = .false. tripb = .false. do 10 numit = 0, maxit2-1 * the WGS84 test set: mean = 1.47, sd = 1.25, max = 16 * WGS84 and random input: mean = 2.85, sd = 0.60 v = Lam12f(sbet1, cbet1, dn1, sbet2, cbet2, dn2, + salp1, calp1, f, A3x, C3x, salp2, calp2, sig12, + ssig1, csig1, ssig2, csig2, + eps, omg12, numit .lt. maxit1, dv, + Ca) - lam12 * 2 * tol0 is approximately 1 ulp for a number in [0, pi]. * Reversed test to allow escape with NaNs if (tripn) then dummy = 8 else dummy = 2 end if if (tripb .or. .not. (abs(v) .ge. dummy * tol0)) + go to 20 * Update bracketing values if (v .gt. 0 .and. (numit .gt. maxit1 .or. + calp1/salp1 .gt. calp1b/salp1b)) then salp1b = salp1 calp1b = calp1 else if (v .lt. 0 .and. (numit .gt. maxit1 .or. + calp1/salp1 .lt. calp1a/salp1a)) then salp1a = salp1 calp1a = calp1 end if if (numit .lt. maxit1 .and. dv .gt. 0) then dalp1 = -v/dv sdalp1 = sin(dalp1) cdalp1 = cos(dalp1) nsalp1 = salp1 * cdalp1 + calp1 * sdalp1 if (nsalp1 .gt. 0 .and. abs(dalp1) .lt. pi) then calp1 = calp1 * cdalp1 - salp1 * sdalp1 salp1 = nsalp1 call norm2(salp1, calp1) * In some regimes we don't get quadratic convergence because * slope -> 0. So use convergence conditions based on dbleps * instead of sqrt(dbleps). tripn = abs(v) .le. 16 * tol0 go to 10 end if end if * Either dv was not postive 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 call norm2(salp1, calp1) tripn = .false. tripb = abs(salp1a - salp1) + (calp1a - calp1) .lt. tolb + .or. abs(salp1 - salp1b) + (calp1 - calp1b) .lt. tolb 10 continue 20 continue call Lengs(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, lmask, + s12x, m12x, dummy, MM12, MM21, ep2, Ca) m12x = m12x * b s12x = s12x * b a12x = sig12 / degree omg12 = lam12 - omg12 end if end if * Convert -0 to 0 s12 = 0 + s12x if (redlp) m12 = 0 + m12x if (areap) then * From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1 calp0 = hypotx(calp1, salp1 * sbet1) if (calp0 .ne. 0 .and. salp0 .ne. 0) then * From Lambda12: tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1 csig1 = calp1 * cbet1 ssig2 = sbet2 csig2 = calp2 * cbet2 k2 = calp0**2 * ep2 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2) * Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = a**2 * calp0 * salp0 * e2 call norm2(ssig1, csig1) call norm2(ssig2, csig2) call C4f(eps, C4x, Ca) B41 = TrgSum(.false., ssig1, csig1, Ca, nC4) B42 = TrgSum(.false., ssig2, csig2, Ca, nC4) SS12 = A4 * (B42 - B41) else * Avoid problems with indeterminate sig1, sig2 on equator SS12 = 0 end if if (.not. merid .and. omg12 .lt. 0.75d0 * pi + .and. sbet2 - sbet1 .lt. 1.75d0) then * 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)) somg12 = sin(omg12) domg12 = 1 + cos(omg12) 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 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 .eq. 0 .and. calp12 .lt. 0) then salp12 = tiny * calp1 calp12 = -1 end if alp12 = atan2(salp12, calp12) end if SS12 = SS12 + c2 * alp12 SS12 = SS12 * swapp * lonsgn * latsgn * Convert -0 to 0 SS12 = 0 + SS12 end if * Convert calp, salp to azimuth accounting for lonsgn, swapp, latsgn. if (swapp .lt. 0) then call swap(salp1, salp2) call swap(calp1, calp2) if (scalp) call swap(MM12, MM21) end if salp1 = salp1 * swapp * lonsgn calp1 = calp1 * swapp * latsgn salp2 = salp2 * swapp * lonsgn calp2 = calp2 * swapp * latsgn * minus signs give range [-180, 180). 0- converts -0 to +0. azi1 = atn2dx(salp1, calp1) azi2 = atn2dx(salp2, calp2) if (arcp) a12 = a12x return end *> Determine the area of a geodesic polygon *! *! @param[in] a the equatorial radius (meters). *! @param[in] f the flattening of the ellipsoid. Setting \e f = 0 gives *! a sphere. Negative \e f gives a prolate ellipsoid. *! @param[in] lats an array of the latitudes of the vertices (degrees). *! @param[in] lons an array of the longitudes of the vertices (degrees). *! @param[in] n the number of vertices. *! @param[out] AA the (signed) area of the polygon (meters2). *! @param[out] PP the perimeter of the polygon. *! *! \e lats should be in the range [−90°, 90°]. *! *! Only simple polygons (which are not self-intersecting) are allowed. *! 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. subroutine area(a, f, lats, lons, n, AA, PP) * input integer n double precision a, f, lats(n), lons(n) * output double precision AA, PP integer i, omask, cross, trnsit double precision s12, azi1, azi2, dummy, SS12, b, e2, c2, area0, + atanhx, Aacc(2), Pacc(2) double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init omask = 8 call accini(Aacc) call accini(Pacc) cross = 0 do 10 i = 0, n-1 call invers(a, f, lats(i+1), lons(i+1), + lats(mod(i+1,n)+1), lons(mod(i+1,n)+1), + s12, azi1, azi2, omask, dummy, dummy, dummy, dummy, SS12) call accadd(Pacc, s12) call accadd(Aacc, -SS12) cross = cross + trnsit(lons(i+1), lons(mod(i+1,n)+1)) 10 continue PP = Pacc(1) b = a * (1 - f) e2 = f * (2 - f) if (e2 .eq. 0) then c2 = a**2 else if (e2 .gt. 0) then c2 = (a**2 + b**2 * atanhx(sqrt(e2)) / sqrt(e2)) / 2 else c2 = (a**2 + b**2 * atan(sqrt(abs(e2))) / sqrt(abs(e2))) / 2 end if area0 = 4 * pi * c2 if (mod(abs(cross), 2) .eq. 1) then if (Aacc(1) .lt. 0) then call accadd(Aacc, +area0/2) else call accadd(Aacc, -area0/2) end if end if if (Aacc(1) .gt. area0/2) then call accadd(Aacc, -area0) else if (Aacc(1) .le. -area0/2) then call accadd(Aacc, +area0) end if AA = Aacc(1) return end *> Return the version numbers for this package. *! *! @param[out] major the major version number. *! @param[out] minor the minor version number. *! @param[out] patch the patch number. *! *! This subroutine was added with version 1.44. subroutine geover(major, minor, patch) * output integer major, minor, patch major = 1 minor = 45 patch = 0 return end *> @cond SKIP block data geodat double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init data init /.false./ common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init end subroutine geoini double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init digits = 53 dblmin = 0.5d0**1022 dbleps = 0.5d0**(digits-1) pi = atan2(0d0, -1d0) degree = pi/180 * This is about cbrt(dblmin). With other implementations, sqrt(dblmin) * is used. The larger value is used here to avoid complaints about a * IEEE_UNDERFLOW_FLAG IEEE_DENORMAL signal. This is triggered when * invers is called with points at opposite poles. tiny = 0.5d0**((1022+2)/3) tol0 = dbleps * 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 xthrsh = 1000 * tol2 maxit1 = 20 maxit2 = maxit1 + digits + 10 init = .true. return end subroutine Lengs(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, omask, + s12b, m12b, m0, MM12, MM21, ep2, Ca) * input double precision eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, ep2 integer omask * optional output double precision s12b, m12b, m0, MM12, MM21 * temporary storage double precision Ca(*) integer ord, nC1, nC2 parameter (ord = 6, nC1 = ord, nC2 = ord) double precision A1m1f, A2m1f, TrgSum double precision m0x, J12, A1, A2, B1, B2, csig12, t, Cb(nC2) logical distp, redlp, scalp integer l * Return m12b = (reduced length)/b; also calculate s12b = distance/b, * and m0 = coefficient of secular term in expression for reduced length. distp = (mod(omask/16, 2) .eq. 1) redlp = (mod(omask/2, 2) .eq. 1) scalp = (mod(omask/4, 2) .eq. 1) * Suppress compiler warnings m0x = 0 J12 = 0 A1 = 0 A2 = 0 if (distp .or. redlp .or. scalp) then A1 = A1m1f(eps) call C1f(eps, Ca) if (redlp .or. scalp) then A2 = A2m1f(eps) call C2f(eps, Cb) m0x = A1 - A2 A2 = 1 + A2 end if A1 = 1 + A1 end if if (distp) then B1 = TrgSum(.true., ssig2, csig2, Ca, nC1) - + TrgSum(.true., ssig1, csig1, Ca, nC1) * Missing a factor of b s12b = A1 * (sig12 + B1) if (redlp .or. scalp) then B2 = Trgsum(.true., ssig2, csig2, Cb, nC2) - + TrgSum(.true., ssig1, csig1, Cb, nC2) J12 = m0x * sig12 + (A1 * B1 - A2 * B2) end if else if (redlp .or. scalp) then * Assume here that nC1 >= nC2 do 10 l = 1, nC2 Cb(l) = A1 * Ca(l) - A2 * Cb(l) 10 continue J12 = m0x * sig12 + (TrgSum(.true., ssig2, csig2, Cb, nC2) - + TrgSum(.true., ssig1, csig1, Cb, nC2)) end if if (redlp) then m0 = m0x * Missing a factor of b. * Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure * accurate cancellation in the case of coincident points. m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - + csig1 * csig2 * J12 end if if (scalp) then csig12 = csig1 * csig2 + ssig1 * ssig2 t = ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2) MM12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1 MM21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2 end if return end double precision function Astrd(x, 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. * input double precision x, y double precision cbrt double precision k, p, q, r, S, r2, r3, disc, u, + T3, T, ang, v, uv, w p = x**2 q = y**2 r = (p + q - 1) / 6 if ( .not. (q .eq. 0 .and. r .lt. 0) ) then * Avoid possible division by zero when r = 0 by multiplying equations * for s and t by r^3 and r, resp. * S = r^3 * s S = p * q / 4 r2 = r**2 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) u = r if (disc .ge. 0) then T3 = S + r3 * 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 = (r * t)^3 if (T3 .lt. 0) then disc = -sqrt(disc) else disc = sqrt(disc) end if T3 = T3 + disc * N.B. cbrt always returns the real root. cbrt(-8) = -2. * T = r * t T = cbrt(T3) * T can be zero; but then r2 / T -> 0. if (T .ne. 0) u = u + T + r2 / T else * T is complex, but the way u is defined the result is 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 = u + 2 * r * cos(ang / 3) end if * guaranteed positive v = sqrt(u**2 + q) * Avoid loss of accuracy when u < 0. * u+v, guaranteed positive if (u .lt. 0) then uv = q / (v - u) else uv = u + v end if * positive? w = (uv - q) / (2 * v) * Rearrange expression for k to avoid loss of accuracy due to * subtraction. Division by 0 not possible because uv > 0, w >= 0. * guaranteed positive k = uv / (sqrt(uv + w**2) + w) 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 end if Astrd = k return end double precision function InvSta(sbet1, cbet1, dn1, + sbet2, cbet2, dn2, lam12, f, A3x, + salp1, calp1, salp2, calp2, dnm, + Ca) * 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, calp2, and dnm and function value is sig12. * input double precision sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, + f, A3x(*) * output double precision salp1, calp1, salp2, calp2, dnm * temporary double precision Ca(*) double precision hypotx, A3f, Astrd logical shortp double precision f1, e2, ep2, n, etol2, k2, eps, sig12, + sbet12, cbet12, sbt12a, omg12, somg12, comg12, ssig12, csig12, + x, y, lamscl, betscl, cbt12a, bt12a, m12b, m0, dummy, + k, omg12a, sbetm2 double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init f1 = 1 - f e2 = f * (2 - f) ep2 = e2 / (1 - e2) n = f / (2 - f) * 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. etol2 = 0.1d0 * tol2 / + sqrt( max(0.001d0, abs(f)) * min(1d0, 1 - f/2) / 2 ) * Return value sig12 = -1 * bet12 = bet2 - bet1 in [0, pi); bt12a = bet2 + bet1 in (-pi, 0] sbet12 = sbet2 * cbet1 - cbet2 * sbet1 cbet12 = cbet2 * cbet1 + sbet2 * sbet1 sbt12a = sbet2 * cbet1 + cbet2 * sbet1 shortp = cbet12 .ge. 0 .and. sbet12 .lt. 0.5d0 .and. + cbet2 * lam12 .lt. 0.5d0 omg12 = lam12 if (shortp) then sbetm2 = (sbet1 + sbet2)**2 * sin((bet1+bet2)/2)^2 * = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) sbetm2 = sbetm2 / (sbetm2 + (cbet1 + cbet2)**2) dnm = sqrt(1 + ep2 * sbetm2) omg12 = omg12 / (f1 * dnm) end if somg12 = sin(omg12) comg12 = cos(omg12) salp1 = cbet2 * somg12 if (comg12 .ge. 0) then calp1 = sbet12 + cbet2 * sbet1 * somg12**2 / (1 + comg12) else calp1 = sbt12a - cbet2 * sbet1 * somg12**2 / (1 - comg12) end if ssig12 = hypotx(salp1, calp1) csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12 if (shortp .and. ssig12 .lt. etol2) then * really short lines salp2 = cbet1 * somg12 if (comg12 .ge. 0) then calp2 = somg12**2 / (1 + comg12) else calp2 = 1 - comg12 end if calp2 = sbet12 - cbet1 * sbet2 * calp2 call norm2(salp2, calp2) * Set return value sig12 = atan2(ssig12, csig12) else if (abs(n) .gt. 0.1d0 .or. csig12 .ge. 0 .or. + ssig12 .ge. 6 * abs(n) * pi * cbet1**2) then * Nothing to do, zeroth order spherical approximation is OK continue 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. if (f .ge. 0) then * x = dlong, y = dlat k2 = sbet1**2 * ep2 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2) lamscl = f * cbet1 * A3f(eps, A3x) * pi betscl = lamscl * cbet1 x = (lam12 - pi) / lamscl y = sbt12a / betscl else * f < 0: x = dlat, y = dlong cbt12a = cbet2 * cbet1 - sbet2 * sbet1 bt12a = atan2(sbt12a, cbt12a) * In the case of lon12 = 180, this repeats a calculation made in * Inverse. call Lengs(n, pi + bt12a, + sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, 2, + dummy, m12b, m0, dummy, dummy, ep2, Ca) x = -1 + m12b / (cbet1 * cbet2 * m0 * pi) if (x .lt. -0.01d0) then betscl = sbt12a / x else betscl = -f * cbet1**2 * pi end if lamscl = betscl / cbet1 y = (lam12 - pi) / lamscl end if if (y .gt. -tol1 .and. x .gt. -1 - xthrsh) then * strip near cut if (f .ge. 0) then salp1 = min(1d0, -x) calp1 = - sqrt(1 - salp1**2) else if (x .gt. -tol1) then calp1 = 0 else calp1 = 1 end if calp1 = max(calp1, x) salp1 = sqrt(1 - calp1**2) end if 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 k = Astrd(x, y) if (f .ge. 0) then omg12a = -x * k/(1 + k) else omg12a = -y * (1 + k)/k end if omg12a = lamscl * omg12a somg12 = sin(omg12a) comg12 = -cos(omg12a) * Update spherical estimate of alp1 using omg12 instead of lam12 salp1 = cbet2 * somg12 calp1 = sbt12a - cbet2 * sbet1 * somg12**2 / (1 - comg12) end if end if * Sanity check on starting guess. Backwards check allows NaN through. if (.not. (salp1 .le. 0)) then call norm2(salp1, calp1) else salp1 = 1 calp1 = 0 end if InvSta = sig12 return end double precision function Lam12f(sbet1, cbet1, dn1, + sbet2, cbet2, dn2, salp1, calp1, f, A3x, C3x, salp2, calp2, + sig12, ssig1, csig1, ssig2, csig2, eps, domg12, diffp, dlam12, + Ca) * input double precision sbet1, cbet1, dn1, sbet2, cbet2, dn2, + salp1, calp1, f, A3x(*), C3x(*) logical diffp * output double precision salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, + eps, domg12 * optional output double precision dlam12 * temporary double precision Ca(*) integer ord, nC3 parameter (ord = 6, nC3 = ord) double precision hypotx, A3f, TrgSum double precision f1, e2, ep2, salp0, calp0, + somg1, comg1, somg2, comg2, omg12, lam12, B312, h0, k2, dummy double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init f1 = 1 - f e2 = f * (2 - f) ep2 = e2 / (1 - e2) * Break degeneracy of equatorial line. This case has already been * handled. if (sbet1 .eq. 0 .and. calp1 .eq. 0) calp1 = -tiny * sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1 * calp0 > 0 calp0 = hypotx(calp1, salp1 * sbet1) * tan(bet1) = tan(sig1) * cos(alp1) * tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1) ssig1 = sbet1 somg1 = salp0 * sbet1 csig1 = calp1 * cbet1 comg1 = csig1 call 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) if (cbet2 .ne. cbet1) then salp2 = salp0 / cbet2 else salp2 = salp1 end if * 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]). if (cbet2 .ne. cbet1 .or. abs(sbet2) .ne. -sbet1) then if (cbet1 .lt. -sbet1) then calp2 = (cbet2 - cbet1) * (cbet1 + cbet2) else calp2 = (sbet1 - sbet2) * (sbet1 + sbet2) end if calp2 = sqrt((calp1 * cbet1)**2 + calp2) / cbet2 else calp2 = abs(calp1) end if * tan(bet2) = tan(sig2) * cos(alp2) * tan(omg2) = sin(alp0) * tan(sig2). ssig2 = sbet2 somg2 = salp0 * sbet2 csig2 = calp2 * cbet2 comg2 = csig2 call norm2(ssig2, csig2) * norm2(somg2, comg2); -- don't need to normalize! * sig12 = sig2 - sig1, limit to [0, pi] sig12 = atan2(0d0 + max(0d0, csig1 * ssig2 - ssig1 * csig2), + csig1 * csig2 + ssig1 * ssig2) * omg12 = omg2 - omg1, limit to [0, pi] omg12 = atan2(0d0 + max(0d0, comg1 * somg2 - somg1 * comg2), + comg1 * comg2 + somg1 * somg2) k2 = calp0**2 * ep2 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2) call C3f(eps, C3x, Ca) B312 = (TrgSum(.true., ssig2, csig2, Ca, nC3-1) - + TrgSum(.true., ssig1, csig1, Ca, nC3-1)) h0 = -f * A3f(eps, A3x) domg12 = salp0 * h0 * (sig12 + B312) lam12 = omg12 + domg12 if (diffp) then if (calp2 .eq. 0) then dlam12 = - 2 * f1 * dn1 / sbet1 else call Lengs(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, 2, + dummy, dlam12, dummy, dummy, dummy, ep2, Ca) dlam12 = dlam12 * f1 / (calp2 * cbet2) end if end if Lam12f = lam12 return end double precision function A3f(eps, A3x) * Evaluate A3 integer ord, nA3, nA3x parameter (ord = 6, nA3 = ord, nA3x = nA3) * input double precision eps * output double precision A3x(0: nA3x-1) double precision polval A3f = polval(nA3 - 1, A3x, eps) return end subroutine C3f(eps, C3x, c) * Evaluate C3 coeffs * Elements c[1] thru c[nC3-1] are set integer ord, nC3, nC3x parameter (ord = 6, nC3 = ord, nC3x = (nC3 * (nC3 - 1)) / 2) * input double precision eps, C3x(0:nC3x-1) * output double precision c(nC3-1) integer o, m, l double precision mult, polval mult = 1 o = 0 do 10 l = 1, nC3 - 1 m = nC3 - l - 1 mult = mult * eps c(l) = mult * polval(m, C3x(o), eps) o = o + m + 1 10 continue return end subroutine C4f(eps, C4x, c) * Evaluate C4 * Elements c[0] thru c[nC4-1] are set integer ord, nC4, nC4x parameter (ord = 6, nC4 = ord, nC4x = (nC4 * (nC4 + 1)) / 2) * input double precision eps, C4x(0:nC4x-1) *output double precision c(0:nC4-1) integer o, m, l double precision mult, polval mult = 1 o = 0 do 10 l = 0, nC4 - 1 m = nC4 - l - 1 c(l) = mult * polval(m, C4x(o), eps) o = o + m + 1 mult = mult * eps 10 continue return end double precision function A1m1f(eps) * The scale factor A1-1 = mean value of (d/dsigma)I1 - 1 * input double precision eps double precision t integer ord, nA1, o, m parameter (ord = 6, nA1 = ord) double precision polval, coeff(nA1/2 + 2) data coeff /1, 4, 64, 0, 256/ o = 1 m = nA1/2 t = polval(m, coeff(o), eps**2) / coeff(o + m + 1) A1m1f = (t + eps) / (1 - eps) return end subroutine C1f(eps, c) * The coefficients C1[l] in the Fourier expansion of B1 integer ord, nC1 parameter (ord = 6, nC1 = ord) * input double precision eps * output double precision c(nC1) double precision eps2, d integer o, m, l double precision polval, coeff((nC1**2 + 7*nC1 - 2*(nC1/2))/4) data coeff / + -1, 6, -16, 32, + -9, 64, -128, 2048, + 9, -16, 768, + 3, -5, 512, + -7, 1280, + -7, 2048/ eps2 = eps**2 d = eps o = 1 do 10 l = 1, nC1 m = (nC1 - l) / 2 c(l) = d * polval(m, coeff(o), eps2) / coeff(o + m + 1) o = o + m + 2 d = d * eps 10 continue return end subroutine C1pf(eps, c) * The coefficients C1p[l] in the Fourier expansion of B1p integer ord, nC1p parameter (ord = 6, nC1p = ord) * input double precision eps * output double precision c(nC1p) double precision eps2, d integer o, m, l double precision polval, coeff((nC1p**2 + 7*nC1p - 2*(nC1p/2))/4) data coeff / + 205, -432, 768, 1536, + 4005, -4736, 3840, 12288, + -225, 116, 384, + -7173, 2695, 7680, + 3467, 7680, + 38081, 61440/ eps2 = eps**2 d = eps o = 1 do 10 l = 1, nC1p m = (nC1p - l) / 2 c(l) = d * polval(m, coeff(o), eps2) / coeff(o + m + 1) o = o + m + 2 d = d * eps 10 continue return end * The scale factor A2-1 = mean value of (d/dsigma)I2 - 1 double precision function A2m1f(eps) * input double precision eps double precision t integer ord, nA2, o, m parameter (ord = 6, nA2 = ord) double precision polval, coeff(nA2/2 + 2) data coeff /-11, -28, -192, 0, 256/ o = 1 m = nA2/2 t = polval(m, coeff(o), eps**2) / coeff(o + m + 1) A2m1f = (t - eps) / (1 + eps) return end subroutine C2f(eps, c) * The coefficients C2[l] in the Fourier expansion of B2 integer ord, nC2 parameter (ord = 6, nC2 = ord) * input double precision eps * output double precision c(nC2) double precision eps2, d integer o, m, l double precision polval, coeff((nC2**2 + 7*nC2 - 2*(nC2/2))/4) data coeff / + 1, 2, 16, 32, + 35, 64, 384, 2048, + 15, 80, 768, + 7, 35, 512, + 63, 1280, + 77, 2048/ eps2 = eps**2 d = eps o = 1 do 10 l = 1, nC2 m = (nC2 - l) / 2 c(l) = d * polval(m, coeff(o), eps2) / coeff(o + m + 1) o = o + m + 2 d = d * eps 10 continue return end subroutine A3cof(n, A3x) * The scale factor A3 = mean value of (d/dsigma)I3 integer ord, nA3, nA3x parameter (ord = 6, nA3 = ord, nA3x = nA3) * input double precision n * output double precision A3x(0:nA3x-1) integer o, m, k, j double precision polval, coeff((nA3**2 + 7*nA3 - 2*(nA3/2))/4) data coeff / + -3, 128, + -2, -3, 64, + -1, -3, -1, 16, + 3, -1, -2, 8, + 1, -1, 2, + 1, 1/ o = 1 k = 0 do 10 j = nA3 - 1, 0, -1 m = min(nA3 - j - 1, j) A3x(k) = polval(m, coeff(o), n) / coeff(o + m + 1) k = k + 1 o = o + m + 2 10 continue return end subroutine C3cof(n, C3x) * The coefficients C3[l] in the Fourier expansion of B3 integer ord, nC3, nC3x parameter (ord = 6, nC3 = ord, nC3x = (nC3 * (nC3 - 1)) / 2) * input double precision n * output double precision C3x(0:nC3x-1) integer o, m, l, j, k double precision polval, + coeff(((nC3-1)*(nC3**2 + 7*nC3 - 2*(nC3/2)))/8) data coeff / + 3, 128, + 2, 5, 128, + -1, 3, 3, 64, + -1, 0, 1, 8, + -1, 1, 4, + 5, 256, + 1, 3, 128, + -3, -2, 3, 64, + 1, -3, 2, 32, + 7, 512, + -10, 9, 384, + 5, -9, 5, 192, + 7, 512, + -14, 7, 512, + 21, 2560/ o = 1 k = 0 do 20 l = 1, nC3 - 1 do 10 j = nC3 - 1, l, -1 m = min(nC3 - j - 1, j) C3x(k) = polval(m, coeff(o), n) / coeff(o + m + 1) k = k + 1 o = o + m + 2 10 continue 20 continue return end subroutine C4cof(n, C4x) * The coefficients C4[l] in the Fourier expansion of I4 integer ord, nC4, nC4x parameter (ord = 6, nC4 = ord, nC4x = (nC4 * (nC4 + 1)) / 2) * input double precision n * output double precision C4x(0:nC4x-1) integer o, m, l, j, k double precision polval, coeff((nC4 * (nC4 + 1) * (nC4 + 5)) / 6) data coeff / + 97, 15015, 1088, 156, 45045, -224, -4784, 1573, 45045, + -10656, 14144, -4576, -858, 45045, + 64, 624, -4576, 6864, -3003, 15015, + 100, 208, 572, 3432, -12012, 30030, 45045, + 1, 9009, -2944, 468, 135135, 5792, 1040, -1287, 135135, + 5952, -11648, 9152, -2574, 135135, + -64, -624, 4576, -6864, 3003, 135135, + 8, 10725, 1856, -936, 225225, -8448, 4992, -1144, 225225, + -1440, 4160, -4576, 1716, 225225, + -136, 63063, 1024, -208, 105105, + 3584, -3328, 1144, 315315, + -128, 135135, -2560, 832, 405405, 128, 99099/ o = 1 k = 0 do 20 l = 0, nC4 - 1 do 10 j = nC4 - 1, l, -1 m = nC4 - j - 1 C4x(k) = polval(m, coeff(o), n) / coeff(o + m + 1) k = k + 1 o = o + m + 2 10 continue 20 continue return end double precision function sumx(u, v, t) * input double precision u, v * output double precision t double precision up, vpp sumx = u + v up = sumx - v vpp = sumx - up up = up - u vpp = vpp - v t = -(up + vpp) return end double precision function AngNm(x) * input double precision x AngNm = mod(x, 360d0) if (AngNm .lt. -180) then AngNm = AngNm + 360 else if (AngNm .ge. 180) then AngNm = AngNm - 360 end if return end double precision function LatFix(x) * input double precision x LatFix = x if (.not. (abs(x) .gt. 90)) return * concoct a NaN LatFix = sqrt(90 - abs(x)) return end double precision function AngDif(x, y) * Compute y - x. x and y must both lie in [-180, 180]. The result is * equivalent to computing the difference exactly, reducing it to (-180, * 180] and rounding the result. Note that this prescription allows -180 * to be returned (e.g., if x is tiny and negative and y = 180). * input double precision x, y double precision d, t, sumx, AngNm d = - AngNm(sumx(AngNm(x), AngNm(-y), t)) if (d .eq. 180 .and. t .lt. 0) then d = -180 end if AngDif = d - t return end double precision function AngRnd(x) * The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^57 * for reals = 0.7 pm on the earth if x is an angle in degrees. (This is * about 1000 times more resolution than we get with angles around 90 * degrees.) We use this to avoid having to deal with near singular * cases when x is non-zero but tiny (e.g., 1.0e-200). This also * converts -0 to +0. * input double precision x double precision y, z z = 1/16d0 y = abs(x) * The compiler mustn't "simplify" z - (z - y) to y if (y .lt. z) y = z - (z - y) AngRnd = 0 + sign(y, x) return end subroutine swap(x, y) * input/output double precision x, y double precision z z = x x = y y = z return end double precision function hypotx(x, y) * input double precision x, y hypotx = sqrt(x**2 + y**2) return end subroutine norm2(x, y) * input/output double precision x, y double precision hypotx, r r = hypotx(x, y) x = x/r y = y/r return end double precision function log1px(x) * input double precision x double precision y, z y = 1 + x z = y - 1 if (z .eq. 0) then log1px = x else log1px = x * log(y) / z end if return end double precision function atanhx(x) * input double precision x double precision log1px, y y = abs(x) y = log1px(2 * y/(1 - y))/2 atanhx = sign(y, x) return end double precision function cbrt(x) * input double precision x cbrt = sign(abs(x)**(1/3d0), x) return end double precision function TrgSum(sinp, sinx, cosx, c, n) * Evaluate * y = sinp ? sum(c[i] * sin( 2*i * x), i, 1, n) : * sum(c[i] * cos((2*i-1) * x), i, 1, n) * using Clenshaw summation. * Approx operation count = (n + 5) mult and (2 * n + 2) add * input logical sinp integer n double precision sinx, cosx, c(n) double precision ar, y0, y1 integer n2, k * 2 * cos(2 * x) ar = 2 * (cosx - sinx) * (cosx + sinx) * accumulators for sum if (mod(n, 2) .eq. 1) then y0 = c(n) n2 = n - 1 else y0 = 0 n2 = n end if y1 = 0 * Now n2 is even do 10 k = n2, 1, -2 * Unroll loop x 2, so accumulators return to their original role y1 = ar * y0 - y1 + c(k) y0 = ar * y1 - y0 + c(k-1) 10 continue if (sinp) then * sin(2 * x) * y0 TrgSum = 2 * sinx * cosx * y0 else * cos(x) * (y0 - y1) TrgSum = cosx * (y0 - y1) end if return end integer function trnsit(lon1, lon2) * input double precision lon1, lon2 double precision lon1x, lon2x, lon12, AngNm, AngDif lon1x = AngNm(lon1) lon2x = AngNm(lon2) lon12 = AngDif(lon1x, lon2x) trnsit = 0 if (lon1x .lt. 0 .and. lon2x .ge. 0 .and. lon12 .gt. 0) then trnsit = 1 else if (lon2x .lt. 0 .and. lon1x .ge. 0 .and. lon12 .lt. 0) then trnsit = -1 end if return end subroutine accini(s) * Initialize an accumulator; this is an array with two elements. * input/output double precision s(2) s(1) = 0 s(2) = 0 return end subroutine accadd(s, y) * Add y to an accumulator. * input double precision y * input/output double precision s(2) double precision z, u, sumx z = sumx(y, s(2), u) s(1) = sumx(z, s(1), s(2)) if (s(1) .eq. 0) then s(1) = u else s(2) = s(2) + u end if return end subroutine sncsdx(x, sinx, cosx) * Compute sin(x) and cos(x) with x in degrees * input double precision x * input/output double precision sinx, cosx double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init double precision r, s, c integer q r = mod(x, 360d0) q = nint(r / 90) r = (r - 90 * q) * degree s = sin(r) c = cos(r) q = mod(q + 4, 4) if (q .eq. 0) then sinx = s cosx = c else if (q .eq. 1) then sinx = c cosx = 0 - s else if (q .eq. 2) then sinx = 0 - s cosx = 0 - c else * q.eq.3 sinx = 0 - c cosx = s end if return end double precision function atn2dx(y, x) * input double precision x, y double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init double precision xx, yy integer q if (abs(y) .gt. abs(x)) then xx = y yy = x q = 2 else xx = x yy = y q = 0 end if if (xx .lt. 0) then xx = -xx q = q + 1 end if atn2dx = atan2(yy, xx) / degree if (q .eq. 1) then if (yy .gt. 0) then atn2dx = 180 - atn2dx else atn2dx = -180 - atn2dx end if else if (q .eq. 2) then atn2dx = 90 - atn2dx else if (q .eq. 3) then atn2dx = -90 + atn2dx end if return end double precision function polval(N, p, x) * input integer N double precision p(0:N), x integer i if (N .lt. 0) then polval = 0 else polval = p(0) end if do 10 i = 1, N polval = polval * x + p(i) 10 continue return end * Table of name abbreviations to conform to the 6-char limit and * potential name conflicts. * A3coeff A3cof * C3coeff C3cof * C4coeff C4cof * AngNormalize AngNm * AngDiff AngDif * AngRound AngRnd * arcmode arcmod * Astroid Astrd * betscale betscl * lamscale lamscl * cbet12a cbt12a * sbet12a sbt12a * epsilon dbleps * realmin dblmin * geodesic geod * inverse invers * InverseStart InvSta * Lambda12 Lam12f * latsign latsgn * lonsign lonsgn * Lengths Lengs * meridian merid * outmask omask * shortline shortp * norm norm2 * SinCosSeries TrgSum * xthresh xthrsh * transit trnsit * polyval polval * LONG_UNROLL unroll * sincosd sncsdx * atan2d atn2dx *> @endcond SKIP GeographicLib-1.45/legacy/Fortran/geodtest.for0000644000771000077100000007736712602735126021255 0ustar ckarneyckarney*> @file geodtest.for *! @brief Test suite for the geodesic routines in Fortran *! *! Run these tests by configuring with cmake and running "make test". *! *! Copyright (c) Charles Karney (2015) and licensed under *! the MIT/X11 License. For more information, see *! http://geographiclib.sourceforge.net/ *> @cond SKIP block data tests integer j double precision tstdat(20, 12) common /tstcom/ tstdat data (tstdat(1,j), j = 1,12) / + 35.60777d0,-139.44815d0,111.098748429560326d0, + -11.17491d0,-69.95921d0,129.289270889708762d0, + 8935244.5604818305d0,80.50729714281974d0,6273170.2055303837d0, + 0.16606318447386067d0,0.16479116945612937d0, + 12841384694976.432d0 / data (tstdat(2,j), j = 1,12) / + 55.52454d0,106.05087d0,22.020059880982801d0, + 77.03196d0,197.18234d0,109.112041110671519d0, + 4105086.1713924406d0,36.892740690445894d0, + 3828869.3344387607d0, + 0.80076349608092607d0,0.80101006984201008d0, + 61674961290615.615d0 / data (tstdat(3,j), j = 1,12) / + -21.97856d0,142.59065d0,-32.44456876433189d0, + 41.84138d0,98.56635d0,-41.84359951440466d0, + 8394328.894657671d0,75.62930491011522d0,6161154.5773110616d0, + 0.24816339233950381d0,0.24930251203627892d0, + -6637997720646.717d0 / data (tstdat(4,j), j = 1,12) / + -66.99028d0,112.2363d0,173.73491240878403d0, + -12.70631d0,285.90344d0,2.512956620913668d0, + 11150344.2312080241d0,100.278634181155759d0, + 6289939.5670446687d0, + -0.17199490274700385d0,-0.17722569526345708d0, + -121287239862139.744d0 / data (tstdat(5,j), j = 1,12) / + -17.42761d0,173.34268d0,-159.033557661192928d0, + -15.84784d0,5.93557d0,-20.787484651536988d0, + 16076603.1631180673d0,144.640108810286253d0, + 3732902.1583877189d0, + -0.81273638700070476d0,-0.81299800519154474d0, + 97825992354058.708d0 / data (tstdat(6,j), j = 1,12) / + 32.84994d0,48.28919d0,150.492927788121982d0, + -56.28556d0,202.29132d0,48.113449399816759d0, + 16727068.9438164461d0,150.565799985466607d0, + 3147838.1910180939d0, + -0.87334918086923126d0,-0.86505036767110637d0, + -72445258525585.010d0 / data (tstdat(7,j), j = 1,12) / + 6.96833d0,52.74123d0,92.581585386317712d0, + -7.39675d0,206.17291d0,90.721692165923907d0, + 17102477.2496958388d0,154.147366239113561d0, + 2772035.6169917581d0, + -0.89991282520302447d0,-0.89986892177110739d0, + -1311796973197.995d0 / data (tstdat(8,j), j = 1,12) / + -50.56724d0,-16.30485d0,-105.439679907590164d0, + -33.56571d0,-94.97412d0,-47.348547835650331d0, + 6455670.5118668696d0,58.083719495371259d0, + 5409150.7979815838d0, + 0.53053508035997263d0,0.52988722644436602d0, + 41071447902810.047d0 / data (tstdat(9,j), j = 1,12) / + -58.93002d0,-8.90775d0,140.965397902500679d0, + -8.91104d0,133.13503d0,19.255429433416599d0, + 11756066.0219864627d0,105.755691241406877d0, + 6151101.2270708536d0, + -0.26548622269867183d0,-0.27068483874510741d0, + -86143460552774.735d0 / data (tstdat(10,j), j = 1,12) / + -68.82867d0,-74.28391d0,93.774347763114881d0, + -50.63005d0,-8.36685d0,34.65564085411343d0, + 3956936.926063544d0,35.572254987389284d0,3708890.9544062657d0, + 0.81443963736383502d0,0.81420859815358342d0, + -41845309450093.787d0 / data (tstdat(11,j), j = 1,12) / + -10.62672d0,-32.0898d0,-86.426713286747751d0, + 5.883d0,-134.31681d0,-80.473780971034875d0, + 11470869.3864563009d0,103.387395634504061d0, + 6184411.6622659713d0, + -0.23138683500430237d0,-0.23155097622286792d0, + 4198803992123.548d0 / data (tstdat(12,j), j = 1,12) / + -21.76221d0,166.90563d0,29.319421206936428d0, + 48.72884d0,213.97627d0,43.508671946410168d0, + 9098627.3986554915d0,81.963476716121964d0, + 6299240.9166992283d0, + 0.13965943368590333d0,0.14152969707656796d0, + 10024709850277.476d0 / data (tstdat(13,j), j = 1,12) / + -19.79938d0,-174.47484d0,71.167275780171533d0, + -11.99349d0,-154.35109d0,65.589099775199228d0, + 2319004.8601169389d0,20.896611684802389d0, + 2267960.8703918325d0, + 0.93427001867125849d0,0.93424887135032789d0, + -3935477535005.785d0 / data (tstdat(14,j), j = 1,12) / + -11.95887d0,-116.94513d0,92.712619830452549d0, + 4.57352d0,7.16501d0,78.64960934409585d0, + 13834722.5801401374d0,124.688684161089762d0, + 5228093.177931598d0, + -0.56879356755666463d0,-0.56918731952397221d0, + -9919582785894.853d0 / data (tstdat(15,j), j = 1,12) / + -87.85331d0,85.66836d0,-65.120313040242748d0, + 66.48646d0,16.09921d0,-4.888658719272296d0, + 17286615.3147144645d0,155.58592449699137d0, + 2635887.4729110181d0, + -0.90697975771398578d0,-0.91095608883042767d0, + 42667211366919.534d0 / data (tstdat(16,j), j = 1,12) / + 1.74708d0,128.32011d0,-101.584843631173858d0, + -11.16617d0,11.87109d0,-86.325793296437476d0, + 12942901.1241347408d0,116.650512484301857d0, + 5682744.8413270572d0, + -0.44857868222697644d0,-0.44824490340007729d0, + 10763055294345.653d0 / data (tstdat(17,j), j = 1,12) / + -25.72959d0,-144.90758d0,-153.647468693117198d0, + -57.70581d0,-269.17879d0,-48.343983158876487d0, + 9413446.7452453107d0,84.664533838404295d0, + 6356176.6898881281d0, + 0.09492245755254703d0,0.09737058264766572d0, + 74515122850712.444d0 / data (tstdat(18,j), j = 1,12) / + -41.22777d0,122.32875d0,14.285113402275739d0, + -7.57291d0,130.37946d0,10.805303085187369d0, + 3812686.035106021d0,34.34330804743883d0,3588703.8812128856d0, + 0.82605222593217889d0,0.82572158200920196d0, + -2456961531057.857d0 / data (tstdat(19,j), j = 1,12) / + 11.01307d0,138.25278d0,79.43682622782374d0, + 6.62726d0,247.05981d0,103.708090215522657d0, + 11911190.819018408d0,107.341669954114577d0, + 6070904.722786735d0, + -0.29767608923657404d0,-0.29785143390252321d0, + 17121631423099.696d0 / data (tstdat(20,j), j = 1,12) / + -29.47124d0,95.14681d0,-163.779130441688382d0, + -27.46601d0,-69.15955d0,-15.909335945554969d0, + 13487015.8381145492d0,121.294026715742277d0, + 5481428.9945736388d0, + -0.51527225545373252d0,-0.51556587964721788d0, + 104679964020340.318d0 / end integer function assert(x, y, d) double precision x, y, d if (abs(x - y) .le. d) then assert = 0 else assert = 1 print 10, x, y, d 10 format(1x, 'assert fails: ', + g14.7, ' != ', g14.7, ' +/- ', g10.3) end if return end integer function tstinv() double precision tstdat(20, 12) common /tstcom/ tstdat double precision lat1, lon1, azi1, lat2, lon2, azi2, + s12, a12, m12, MM12, MM21, SS12 double precision azi1a, azi2a, s12a, a12a, + m12a, MM12a, MM21a, SS12a double precision a, f integer r, assert, i, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 1+2+4+8 r = 0 do i = 1,20 lat1 = tstdat(i, 1) lon1 = tstdat(i, 2) azi1 = tstdat(i, 3) lat2 = tstdat(i, 4) lon2 = tstdat(i, 5) azi2 = tstdat(i, 6) s12 = tstdat(i, 7) a12 = tstdat(i, 8) m12 = tstdat(i, 9) MM12 = tstdat(i, 10) MM21 = tstdat(i, 11) SS12 = tstdat(i, 12) call invers(a, f, lat1, lon1, lat2, lon2, + s12a, azi1a, azi2a, omask, a12a, m12a, MM12a, MM21a, SS12a) r = r + assert(azi1, azi1a, 1d-13) r = r + assert(azi2, azi2a, 1d-13) r = r + assert(s12, s12a, 1d-8) r = r + assert(a12, a12a, 1d-13) r = r + assert(m12, m12a, 1d-8) r = r + assert(MM12, MM12a, 1d-15) r = r + assert(MM21, MM21a, 1d-15) r = r + assert(SS12, SS12a, 0.1d0) end do tstinv = r return end integer function tstdir() double precision tstdat(20, 12) common /tstcom/ tstdat double precision lat1, lon1, azi1, lat2, lon2, azi2, + s12, a12, m12, MM12, MM21, SS12 double precision lat2a, lon2a, azi2a, a12a, + m12a, MM12a, MM21a, SS12a double precision a, f integer r, assert, i, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 1+2+4+8 flags = 2 r = 0 do i = 1,20 lat1 = tstdat(i, 1) lon1 = tstdat(i, 2) azi1 = tstdat(i, 3) lat2 = tstdat(i, 4) lon2 = tstdat(i, 5) azi2 = tstdat(i, 6) s12 = tstdat(i, 7) a12 = tstdat(i, 8) m12 = tstdat(i, 9) MM12 = tstdat(i, 10) MM21 = tstdat(i, 11) SS12 = tstdat(i, 12) call direct(a, f, lat1, lon1, azi1, s12, flags, + lat2a, lon2a, azi2a, omask, a12a, m12a, MM12a, MM21a, SS12a) r = r + assert(lat2, lat2a, 1d-13) r = r + assert(lon2, lon2a, 1d-13) r = r + assert(azi2, azi2a, 1d-13) r = r + assert(a12, a12a, 1d-13) r = r + assert(m12, m12a, 1d-8) r = r + assert(MM12, MM12a, 1d-15) r = r + assert(MM21, MM21a, 1d-15) r = r + assert(SS12, SS12a, 0.1d0) end do tstdir = r return end integer function tstarc() double precision tstdat(20, 12) common /tstcom/ tstdat double precision lat1, lon1, azi1, lat2, lon2, azi2, + s12, a12, m12, MM12, MM21, SS12 double precision lat2a, lon2a, azi2a, s12a, + m12a, MM12a, MM21a, SS12a double precision a, f integer r, assert, i, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 1+2+4+8 flags = 1+2 r = 0 do i = 1,20 lat1 = tstdat(i, 1) lon1 = tstdat(i, 2) azi1 = tstdat(i, 3) lat2 = tstdat(i, 4) lon2 = tstdat(i, 5) azi2 = tstdat(i, 6) s12 = tstdat(i, 7) a12 = tstdat(i, 8) m12 = tstdat(i, 9) MM12 = tstdat(i, 10) MM21 = tstdat(i, 11) SS12 = tstdat(i, 12) call direct(a, f, lat1, lon1, azi1, a12, flags, + lat2a, lon2a, azi2a, omask, s12a, m12a, MM12a, MM21a, SS12a) r = r + assert(lat2, lat2a, 1d-13) r = r + assert(lon2, lon2a, 1d-13) r = r + assert(azi2, azi2a, 1d-13) r = r + assert(s12, s12a, 1d-8) r = r + assert(m12, m12a, 1d-8) r = r + assert(MM12, MM12a, 1d-15) r = r + assert(MM21, MM21a, 1d-15) r = r + assert(SS12, SS12a, 0.1d0) end do tstarc = r return end integer function notnan(x) double precision x if (x .eq. x) then notnan = 1 else notnan = 0 end if return end integer function tstg0() double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 40.6d0, -73.8d0, 49.01666667d0, 2.55d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 53.47022d0, 0.5d-5) r = r + assert(azi2, 111.59367d0, 0.5d-5) r = r + assert(s12, 5853226d0, 0.5d0) tstg0 = r return end integer function tstg1() double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 flags = 0 r = 0 call direct(a, f, 40.63972222d0, -73.77888889d0, 53.5d0, 5850d3, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, 49.01467d0, 0.5d-5) r = r + assert(lon2, 2.56106d0, 0.5d-5) r = r + assert(azi2, 111.62947d0, 0.5d-5) tstg1 = r return end integer function tstg2() * Check fix for antipodal prolate bug found 2010-09-04 double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' a = 6.4d6 f = -1/150d0 omask = 0 r = 0 call invers(a, f, 0.07476d0, 0d0, -0.07476d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00078d0, 0.5d-5) r = r + assert(azi2, 90.00078d0, 0.5d-5) r = r + assert(s12, 20106193d0, 0.5d0) call invers(a, f, 0.1d0, 0d0, -0.1d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00105d0, 0.5d-5) r = r + assert(azi2, 90.00105d0, 0.5d-5) r = r + assert(s12, 20106193d0, 0.5d0) tstg2 = r return end integer function tstg4() * Check fix for short line bug found 2010-05-21 double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, + 36.493349428792d0, 0d0, 36.49334942879201d0, .0000008d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 0.072d0, 0.5d-3) tstg4 = r return end integer function tstg5() double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 flags = 0 r = 0 call direct(a, f, 0.01777745589997d0, 30d0, 0d0, 10d6, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) if (lon2 .lt. 0) then r = r + assert(lon2, -150d0, 0.5d-5) r = r + assert(azi2, -180d0, 0.5d-5) else r = r + assert(lon2, 30d0, 0.5d-5) r = r + assert(azi2, 0d0, 0.5d-5) end if tstg5 = r return end integer function tstg6() * Check fix for volatile sbet12a bug found 2011-06-25 (gcc 4.4d0.4d0 * x86 -O3). Found again on 2012-03-27 with tdm-mingw32 (g++ 4.6d0.1d0). double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 88.202499451857d0, 0d0, + -88.202499451857d0, 179.981022032992859592d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 20003898.214d0, 0.5d-3) call invers(a, f, 89.262080389218d0, 0d0, + -89.262080389218d0, 179.992207982775375662d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 20003925.854d0, 0.5d-3) call invers(a, f, 89.333123580033d0, 0d0, + -89.333123580032997687d0, 179.99295812360148422d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 20003926.881d0, 0.5d-3) tstg6 = r return end integer function tstg9() * Check fix for volatile x bug found 2011-06-25 (gcc 4.4d0.4d0 x86 -O3) double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 56.320923501171d0, 0d0, + -56.320923501171d0, 179.664747671772880215d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 19993558.287d0, 0.5d-3) tstg9 = r return end integer function tstg10() * Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio 10 rel * + debug) double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 52.784459512564d0, 0d0, + -52.784459512563990912d0, 179.634407464943777557d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 19991596.095d0, 0.5d-3) tstg10 = r return end integer function tstg11() * Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio 10 rel * + debug) double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 48.522876735459d0, 0d0, + -48.52287673545898293d0, 179.599720456223079643d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 19989144.774d0, 0.5d-3) tstg11 = r return end integer function tstg12() * Check fix for inverse geodesics on extreme prolate/oblate ellipsoids * Reported 2012-08-29 Stefan Guenther ; fixed * 2012-10-07 double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' a = 89.8d0 f = -1.83d0 omask = 0 r = 0 call invers(a, f, 0d0, 0d0, -10d0, 160d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 120.27d0, 1d-2) r = r + assert(azi2, 105.15d0, 1d-2) r = r + assert(s12, 266.7d0, 1d-1) tstg12 = r return end integer function tstg14() * Check fix for inverse ignoring lon12 = nan double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f, LatFix integer r, notnan, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 0d0, 0d0, 1d0, LatFix(91d0), + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + notnan(azi1) r = r + notnan(azi2) r = r + notnan(s12) tstg14 = r return end integer function tstg15() * Initial implementation of Math::eatanhe was wrong for e^2 < 0. This * checks that this is fixed. double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' a = 6.4d6 f = -1/150.0d0 omask = 8 flags = 0 r = 0 call direct(a, f, 1d0, 2d0, 3d0, 4d0, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(SS12, 23700d0, 0.5d0) tstg15 = r return end integer function tstg17() * Check fix for LONG_UNROLL bug found on 2015-05-07 double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 8 flags = 2 r = 0 call direct(a, f, 40d0, -75d0, -10d0, 2d7, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, -39d0, 1d0) r = r + assert(lon2, -254d0, 1d0) r = r + assert(azi2, -170d0, 1d0) flags = 0 call direct(a, f, 40d0, -75d0, -10d0, 2d7, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, -39d0, 1d0) r = r + assert(lon2, 105d0, 1d0) r = r + assert(azi2, -170d0, 1d0) tstg17 = r return end integer function tstg26() * Check 0/0 problem with area calculation on sphere 2015-09-08 double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' a = 6.4d6 f = 0 omask = 8 r = 0 call invers(a, f, 1d0, 2d0, 3d0, 4d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(SS12, 49911046115.0d0, 0.5d0) tstg26 = r return end integer function tstg28() * Check fix for LONG_UNROLL bug found on 2015-05-07 double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' a = 6.4d6 f = 0.1d0 omask = 1 + 2 + 4 + 8 flags = 0 r = 0 call direct(a, f, 1d0, 2d0, 10d0, 5d6, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(a12, 48.55570690d0, 0.5d-8) tstg28 = r return end integer function tstg33() * Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- * sind(-0.0) = +0.0 -- and in some version of Visual Studio -- * fmod(-0.0, 360.0) = +0.0. double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 0d0, 0d0, 0d0, 179d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00000d0, 0.5d-5) r = r + assert(azi2, 90.00000d0, 0.5d-5) r = r + assert(s12, 19926189d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0d0, 179.5d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 55.96650d0, 0.5d-5) r = r + assert(azi2, 124.03350d0, 0.5d-5) r = r + assert(s12, 19980862d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(azi2, -180.00000d0, 0.5d-5) r = r + assert(s12, 20003931d0, 0.5d0) call invers(a, f, 0d0, 0d0, 1d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(azi2, -180.00000d0, 0.5d-5) r = r + assert(s12, 19893357d0, 0.5d0) a = 6.4d6 f = 0 call invers(a, f, 0d0, 0d0, 0d0, 179d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00000d0, 0.5d-5) r = r + assert(azi2, 90.00000d0, 0.5d-5) r = r + assert(s12, 19994492d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(azi2, -180.00000d0, 0.5d-5) r = r + assert(s12, 20106193d0, 0.5d0) call invers(a, f, 0d0, 0d0, 1d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(azi2, -180.00000d0, 0.5d-5) r = r + assert(s12, 19994492d0, 0.5d0) a = 6.4d6 f = -1/300.0d0 call invers(a, f, 0d0, 0d0, 0d0, 179d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00000d0, 0.5d-5) r = r + assert(azi2, 90.00000d0, 0.5d-5) r = r + assert(s12, 19994492d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00000d0, 0.5d-5) r = r + assert(azi2, 90.00000d0, 0.5d-5) r = r + assert(s12, 20106193d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0.5d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 33.02493d0, 0.5d-5) r = r + assert(azi2, 146.97364d0, 0.5d-5) r = r + assert(s12, 20082617d0, 0.5d0) call invers(a, f, 0d0, 0d0, 1d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(azi2, -180.00000d0, 0.5d-5) r = r + assert(s12, 20027270d0, 0.5d0) tstg33 = r return end integer function tstg55() * Check fix for nan + point on equator or pole not returning all nans in * Geodesic::Inverse, found 2015-09-23. double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, notnan, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 91d0, 0d0, 0d0, 90d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + notnan(azi1) r = r + notnan(azi2) r = r + notnan(s12) call invers(a, f, 91d0, 0d0, 90d0, 9d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + notnan(azi1) r = r + notnan(azi2) r = r + notnan(s12) tstg55 = r return end integer function tstp0() * Check fix for pole-encircling bug found 2011-03-16 double precision lata(4), lona(4) data lata / 89d0, 89d0, 89d0, 89d0 / data lona / 0d0, 90d0, 180d0, 270d0 / double precision latb(4), lonb(4) data latb / -89d0, -89d0, -89d0, -89d0 / data lonb / 0d0, 90d0, 180d0, 270d0 / double precision latc(4), lonc(4) data latc / 0d0, -1d0, 0d0, 1d0 / data lonc / -1d0, 0d0, 1d0, 0d0 / double precision latd(3), lond(3) data latd / 90d0, 0d0, 0d0 / data lond / 0d0, 0d0, 90d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lata, lona, 4, AA, PP) r = r + assert(PP, 631819.8745d0, 1d-4) r = r + assert(AA, 24952305678.0d0, 1d0) call area(a, f, latb, lonb, 4, AA, PP) r = r + assert(PP, 631819.8745d0, 1d-4) r = r + assert(AA, -24952305678.0d0, 1d0) call area(a, f, latc, lonc, 4, AA, PP) r = r + assert(PP, 627598.2731d0, 1d-4) r = r + assert(AA, 24619419146.0d0, 1d0) call area(a, f, latd, lond, 3, AA, PP) r = r + assert(PP, 30022685d0, 1d0) r = r + assert(AA, 63758202715511.0d0, 1d0) tstp0 = r return end integer function tstp5() * Check fix for Planimeter pole crossing bug found 2011-06-24 double precision lat(3), lon(3) data lat / 89d0, 89d0, 89d0 / data lon / 0.1d0, 90.1d0, -179.9d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lat, lon, 3, AA, PP) r = r + assert(PP, 539297d0, 1d0) r = r + assert(AA, 12476152838.5d0, 1d0) tstp5 = r return end integer function tstp6() * Check fix for pole-encircling bug found 2011-03-16 double precision lata(3), lona(3) data lata / 9d0, 9d0, 9d0 / data lona / -0.00000000000001d0, 180d0, 0d0 / double precision latb(3), lonb(3) data latb / 9d0, 9d0, 9d0 / data lonb / 0.00000000000001d0, 0d0, 180d0 / double precision latc(3), lonc(3) data latc / 9d0, 9d0, 9d0 / data lonc / 0.00000000000001d0, 180d0, 0d0 / double precision latd(3), lond(3) data latd / 9d0, 9d0, 9d0 / data lond / -0.00000000000001d0, 0d0, 180d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lata, lona, 3, AA, PP) r = r + assert(PP, 36026861d0, 1d0) r = r + assert(AA, 0d0, 1d0) tstp6 = r return end integer function tstp12() * AA of arctic circle (not really -- adjunct to rhumb-AA test) double precision lat(2), lon(2) data lat / 66.562222222d0, 66.562222222d0 / data lon / 0d0, 180d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lat, lon, 2, AA, PP) r = r + assert(PP, 10465729d0, 1d0) r = r + assert(AA, 0d0, 1d0) tstp12 = r return end integer function tstp13() * Check encircling pole twice double precision lat(6), lon(6) data lat / 89d0, 89d0, 89d0, 89d0, 89d0, 89d0 / data lon / -360d0, -240d0, -120d0, 0d0, 120d0, 240d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lat, lon, 6, AA, PP) r = r + assert(PP, 1160741d0, 1d0) r = r + assert(AA, 32415230256.0d0, 1d0) tstp13 = r return end program geodtest integer n, i integer tstinv, tstdir, tstarc, + tstg0, tstg1, tstg2, tstg5, tstg6, tstg9, tstg10, tstg11, + tstg12, tstg14, tstg15, tstg17, tstg26, tstg28, tstg33, + tstg55, tstp0, tstp5, tstp6, tstp12, tstp13 n = 0 i = tstinv() if (i .gt. 0) then n = n + 1 print *, 'tstinv fail:', i end if i = tstdir() if (i .gt. 0) then n = n + 1 print *, 'tstdir fail:', i end if i = tstarc() if (i .gt. 0) then n = n + 1 print *, 'tstarc fail:', i end if i = tstg0() if (i .gt. 0) then n = n + 1 print *, 'tstg0 fail:', i end if i = tstg1() if (i .gt. 0) then n = n + 1 print *, 'tstg1 fail:', i end if i = tstg2() if (i .gt. 0) then n = n + 1 print *, 'tstg2 fail:', i end if i = tstg5() if (i .gt. 0) then n = n + 1 print *, 'tstg5 fail:', i end if i = tstg6() if (i .gt. 0) then n = n + 1 print *, 'tstg6 fail:', i end if i = tstg9() if (i .gt. 0) then n = n + 1 print *, 'tstg9 fail:', i end if i = tstg10() if (i .gt. 0) then n = n + 1 print *, 'tstg10 fail:', i end if i = tstg11() if (i .gt. 0) then n = n + 1 print *, 'tstg11 fail:', i end if i = tstg12() if (i .gt. 0) then n = n + 1 print *, 'tstg12 fail:', i end if i = tstg14() if (i .gt. 0) then n = n + 1 print *, 'tstg14 fail:', i end if i = tstg15() if (i .gt. 0) then n = n + 1 print *, 'tstg15 fail:', i end if i = tstg17() if (i .gt. 0) then n = n + 1 print *, 'tstg17 fail:', i end if i = tstg26() if (i .gt. 0) then n = n + 1 print *, 'tstg26 fail:', i end if i = tstg28() if (i .gt. 0) then n = n + 1 print *, 'tstg28 fail:', i end if i = tstg33() if (i .gt. 0) then n = n + 1 print *, 'tstg33 fail:', i end if i = tstg55() if (i .gt. 0) then n = n + 1 print *, 'tstg55 fail:', i end if i = tstp0() if (i .gt. 0) then n = n + 1 print *, 'tstp0 fail:', i end if i = tstp5() if (i .gt. 0) then n = n + 1 print *, 'tstp5 fail:', i end if i = tstp6() if (i .gt. 0) then n = n + 1 print *, 'tstp6 fail:', i end if i = tstp12() if (i .gt. 0) then n = n + 1 print *, 'tstp12 fail:', i end if i = tstp13() if (i .gt. 0) then n = n + 1 print *, 'tstp13 fail:', i end if if (n .gt. 0) then stop 1 end if stop end *> @endcond SKIP GeographicLib-1.45/legacy/Fortran/ngscommon.for0000644000771000077100000004042212602735126021415 0ustar ckarneyckarney subroutine bufdms (buff,lgh,hem,dd,dm,ds,ierror) implicit double precision (a-h, o-z) implicit integer (i-n) c logical done,flag c character*1 buff(*),abuf(21) character*1 ch character*1 hem integer*4 ll,lgh integer*4 i4,id,im,is,icond,ierror real*8 x(5) c c set the "error flag" c ierror = 0 icond = 0 c c set defaults for dd,dm,ds c dd = 0.0d0 dm = 0.0d0 ds = 0.0d0 c c set default limits for "hem" flag c if( hem.eq.'N' .or. hem.eq.'S' )then ddmax = 90.0d0 elseif( hem.eq.'E' .or. hem.eq.'W' )then ddmax = 360.0d0 elseif( hem.eq.'A' )then ddmax = 360.0d0 elseif( hem.eq.'Z' )then ddmax = 180.0d0 elseif( hem.eq.'*' )then ddmax = 0.0d0 ierror = 1 else ddmax = 360.0d0 endif c do 1 i=1,5 x(i) = 0.0d0 1 continue c icolon = 0 ipoint = 0 icount = 0 flag = .true. jlgh = lgh c do 2 i=1,jlgh if( buff(i).eq.':' )then icolon = icolon+1 endif if( buff(i).eq.'.' )then ipoint = ipoint+1 flag = .false. endif if( flag )then icount = icount+1 endif 2 continue c if( ipoint.eq.1 .and. icolon.eq.0 )then c c load temp buffer c do 3 i=1,jlgh abuf(i) = buff(i) 3 continue abuf(jlgh+1) = '$' ll = jlgh c call gvalr8 (abuf,ll,r8,icond) c if( icount.ge.5 )then c c value is a packed decimal of ==> DDMMSS.sssss c ss = r8/10000.0d0 id = idint( ss ) c r8 = r8-10000.0d0*dble(float(id)) ss = r8/100.0d0 im = idint( ss ) c r8 = r8-100.0d0*dble(float(im)) else c c value is a decimal of ==> .xx X.xxx X. c id = idint( r8 ) r8 = (r8-id)*60.0d0 im = idint( r8 ) r8 = (r8-im)*60.0d0 endif c c account for rounding error c is = idnint( r8*1.0d5 ) if( is.ge.6000000 )then r8 = 0.0d0 im = im+1 endif c if( im.ge.60 )then im = 0 id = id+1 endif c dd = dble( float( id ) ) dm = dble( float( im ) ) ds = r8 else c c buff() value is a d,m,s of ==> NN:NN:XX.xxx c k = 0 next = 1 done = .false. ie = jlgh c do 100 j=1,5 ib = next do 90 i=ib,ie ch = buff(i) last = i if( i.eq.jlgh .or. ch.eq.':' )then if( i.eq.jlgh )then done = .true. endif if( ch.eq.':' )then last = i-1 endif goto 91 endif 90 continue goto 98 c 91 ipoint = 0 ik = 0 do 92 i=next,last ik = ik+1 ch = buff(i) if( ch.eq.'.' )then ipoint = ipoint+1 endif abuf(ik) = buff(i) 92 continue abuf(ik+1) = '$' c ll = ik if( ipoint.eq.0 )then call gvali4 (abuf,ll,i4,icond) r8 = dble(float( i4 )) else call gvalr8 (abuf,ll,r8,icond) endif c k = k+1 x(k) = r8 c 98 if( done )then goto 101 endif c next = last 99 next = next+1 if( buff(next).eq.':' )then goto 99 endif 100 continue c c load dd,dm,ds c 101 if( k.ge.1 )then dd = x(1) endif c if( k.ge.2 )then dm = x(2) endif c if( k.ge.3 )then ds = x(3) endif endif c if( dd.gt.ddmax .or. 1 dm.ge.60.0d0 .or. 1 ds.ge.60.0d0 )then ierror = 1 dd = 0.0d0 dm = 0.0d0 ds = 0.0d0 endif c if( icond.ne.0 )then ierror = 1 endif c return end subroutine elipss (elips) implicit double precision(a-h,o-z) character*1 answer character*30 elips common/elipsoid/a,f write(*,*) ' Other Ellipsoids.' write(*,*) ' -----------------' write(*,*) ' ' write(*,*) ' A) Airy 1858' write(*,*) ' B) Airy Modified' write(*,*) ' C) Australian National' write(*,*) ' D) Bessel 1841' write(*,*) ' E) Clarke 1880' write(*,*) ' F) Everest 1830' write(*,*) ' G) Everest Modified' write(*,*) ' H) Fisher 1960' write(*,*) ' I) Fisher 1968' write(*,*) ' J) Hough 1956' write(*,*) ' K) International (Hayford)' write(*,*) ' L) Krassovsky 1938' write(*,*) ' M) NWL-9D (WGS 66)' write(*,*) ' N) South American 1969' write(*,*) ' O) Soviet Geod. System 1985' write(*,*) ' P) WGS 72' write(*,*) ' Q-Z) User defined.' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) answer 10 format(a1) c if(answer.eq.'A'.or.answer.eq.'a') then a=6377563.396d0 f=1.d0/299.3249646d0 elips='Airy 1858' elseif(answer.eq.'B'.or.answer.eq.'b') then a=6377340.189d0 f=1.d0/299.3249646d0 elips='Airy Modified' elseif(answer.eq.'C'.or.answer.eq.'c') then a=6378160.d0 f=1.d0/298.25d0 elips='Australian National' elseif(answer.eq.'D'.or.answer.eq.'d') then a=6377397.155d0 f=1.d0/299.1528128d0 elips='Bessel 1841' elseif(answer.eq.'E'.or.answer.eq.'e') then a=6378249.145d0 f=1.d0/293.465d0 elips='Clarke 1880' elseif(answer.eq.'F'.or.answer.eq.'f') then a=6377276.345d0 f=1.d0/300.8017d0 elips='Everest 1830' elseif(answer.eq.'G'.or.answer.eq.'g') then a=6377304.063d0 f=1.d0/300.8017d0 elips='Everest Modified' elseif(answer.eq.'H'.or.answer.eq.'h') then a=6378166.d0 f=1.d0/298.3d0 elips='Fisher 1960' elseif(answer.eq.'I'.or.answer.eq.'i') then a=6378150.d0 f=1.d0/298.3d0 elips='Fisher 1968' elseif(answer.eq.'J'.or.answer.eq.'j') then a=6378270.d0 f=1.d0/297.d0 elips='Hough 1956' elseif(answer.eq.'K'.or.answer.eq.'k') then a=6378388.d0 f=1.d0/297.d0 elips='International (Hayford)' elseif(answer.eq.'L'.or.answer.eq.'l') then a=6378245.d0 f=1.d0/298.3d0 elips='Krassovsky 1938' elseif(answer.eq.'M'.or.answer.eq.'m') then a=6378145.d0 f=1.d0/298.25d0 elips='NWL-9D (WGS 66)' elseif(answer.eq.'N'.or.answer.eq.'n') then a=6378160.d0 f=1.d0/298.25d0 elips='South American 1969' elseif(answer.eq.'O'.or.answer.eq.'o') then a=6378136.d0 f=1.d0/298.257d0 elips='Soviet Geod. System 1985' elseif(answer.eq.'P'.or.answer.eq.'p') then a=6378135.d0 f=1.d0/298.26d0 elips='WGS 72' else elips = 'User defined.' c write(*,*) ' Enter Equatorial axis, a : ' read(*,*) a a = dabs(a) c write(*,*) ' Enter either Polar axis, b or ' write(*,*) ' Reciprocal flattening, 1/f : ' read(*,*) ss ss = dabs(ss) c f = 0.0d0 if( 200.0d0.le.ss .and. ss.le.310.0d0 )then f = 1.d0/ss elseif( 6000000.0d0.lt.ss .and. ss.lt.a )then f = (a-ss)/a else elips = 'Error: default GRS80 used.' a = 6378137.0d0 f = 1.0d0/298.25722210088d0 endif endif c return end subroutine fixdms (ideg, min, sec, tol ) c implicit double precision (a-h, o-z) implicit integer (i-n) c c test for seconds near 60.0-tol c if( sec.ge.( 60.0d0-tol ) )then sec = 0.0d0 min = min+1 endif c c test for minutes near 60 c if( min.ge.60 )then min = 0 ideg = ideg+1 endif c c test for degrees near 360 c if( ideg.ge.360 )then ideg = 0 endif c return end subroutine hem_ns ( lat_sn, hem ) implicit integer (i-n) character*6 hem c if( lat_sn.eq.1 ) then hem = 'North ' else hem = 'South ' endif c return end subroutine hem_ew ( lon_sn, hem ) implicit integer (i-n) character*6 hem c if( lon_sn.eq.1 ) then hem = 'East ' else hem = 'West ' endif c return end subroutine getdeg(d,m,sec,isign,val) *** comvert deg, min, sec to degrees implicit double precision(a-h,j-z) val=(d+m/60.d0+sec/3600.d0) val=dble(isign)*val return end subroutine gvali4 (buff,ll,vali4,icond) implicit integer (i-n) c logical plus,sign,done,error character*1 buff(*) character*1 ch c c integer*2 i c integer*2 l1 c integer*4 ich,icond integer*4 ll integer*4 vali4 c l1 = ll vali4 = 0 icond = 0 plus = .true. sign = .false. done = .false. error = .false. c i = 0 10 i = i+1 if( i.gt.l1 .or. done )then go to 1000 else ch = buff(i) ich = ichar( buff(i) ) endif c if( ch.eq.'+' )then c c enter on plus sign c if( sign )then goto 150 else sign = .true. goto 10 endif elseif( ch.eq.'-' )then c c enter on minus sign c if( sign )then goto 150 else sign = .true. plus = .false. goto 10 endif elseif( ch.ge.'0' .and. ch.le.'9' )then goto 100 elseif( ch.eq.' ' )then c c enter on space -- ignore leading spaces c if( .not.sign )then goto 10 else buff(i) = '0' ich = 48 goto 100 endif elseif( ch.eq.':' )then c c enter on colon -- ignore c if( .not.sign )then goto 10 else goto 1000 endif elseif( ch.eq.'$' )then c c enter on dollar "$" c done = .true. goto 10 else c c something wrong c goto 150 endif c c enter on numeric c 100 vali4 = 10*vali4+(ich-48) sign = .true. goto 10 c c treat illegal character c 150 buff(i) = '0' vali4 = 0 icond = 1 c 1000 if( .not.plus )then vali4 = -vali4 endif c return end subroutine gvalr8 (buff,ll,valr8,icond) implicit integer (i-n) c logical plus,sign,dpoint,done c character*1 buff(*) character*1 ch c c integer*2 i, ip c integer*2 l1 c integer*2 nn, num, n48 c integer*4 ich,icond integer*4 ll c real*8 ten real*8 valr8 real*8 zero c data zero,ten/0.0d0,10.0d0/ c n48 = 48 l1 = ll icond = 0 valr8 = zero plus = .true. sign = .false. dpoint = .false. done = .false. c c start loop thru buffer c i = 0 10 i = i+1 if( i.gt.l1 .or. done )then go to 1000 else ch = buff(i) nn = ichar( ch ) ich = nn endif c if( ch.eq.'+' )then c c enter on plus sign c if( sign )then goto 150 else sign = .true. goto 10 endif elseif( ch.eq.'-' )then c c enter on minus sign c if( sign )then goto 150 else sign = .true. plus = .false. goto 10 endif elseif( ch.eq.'.' )then c c enter on decimal point c ip = 0 sign = .true. dpoint = .true. goto 10 elseif( ch.ge.'0' .and. ch.le.'9' )then goto 100 elseif( ch.eq.' ' )then c c enter on space c if( .not.sign )then goto 10 else buff(i) = '0' ich = 48 goto 100 endif elseif( ch.eq.':' .or. ch.eq.'$' )then c c enter on colon or "$" sign c done = .true. goto 10 else c c something wrong c goto 150 endif c c enter on numeric c 100 sign = .true. if( dpoint )then ip = ip+1 endif c num = ich valr8 = ten*valr8+dble(float( num-n48 )) goto 10 c c treat illegal character c 150 buff(i) = '0' valr8 = 0.0d0 icond = 1 c 1000 if( dpoint )then valr8 = valr8/(ten**ip) endif c if( .not.plus )then valr8 = -valr8 endif c return end subroutine todmsp(val,id,im,s,isign) *** convert position degrees to deg,min,sec *** range is [-180 to +180] implicit double precision(a-h,o-z) 1 if(val.gt.180) then val=val-180-180 go to 1 endif 2 if(val.lt.-180) then val=val+180+180 go to 2 endif if(val.lt.0.d0) then isign=-1 else isign=+1 endif s=dabs(val) id=idint(s) s=(s-id)*60.d0 im=idint(s) s=(s-im)*60.d0 *** account for rounding error is=idnint(s*1.d5) if(is.ge.6000000) then s=0.d0 im=im+1 endif if(im.ge.60) then im=0 id=id+1 endif return end subroutine trim (buff,lgh,hem) c implicit integer (i-n) character*1 ch,hem character*1 buff(*) integer*4 lgh c ibeg = 1 do 10 i=1,50 if( buff(i).ne.' ' )then goto 11 endif ibeg = ibeg+1 10 continue 11 continue if( ibeg.ge.50 )then ibeg = 1 buff(ibeg) = '0' endif c iend = 50 do 20 i=1,50 j = 51-i if( buff(j).eq.' ' )then iend = iend-1 else goto 21 endif 20 continue 21 continue c ch = buff(ibeg) if( hem.eq.'N' )then if( ch.eq.'N' .or. ch.eq.'n' .or. ch.eq.'+' )then hem = 'N' ibeg = ibeg+1 endif if( ch.eq.'S' .or. ch.eq.'s' .or. ch.eq.'-' )then hem = 'S' ibeg = ibeg+1 endif c c check for wrong hemisphere entry c if( ch.eq.'E' .or. ch.eq.'e' )then hem = '*' ibeg = ibeg+1 endif if( ch.eq.'W' .or. ch.eq.'w' )then hem = '*' ibeg = ibeg+1 endif elseif( hem.eq.'W' )then if( ch.eq.'E' .or. ch.eq.'e' .or. ch.eq.'+' )then hem = 'E' ibeg = ibeg+1 endif if( ch.eq.'W' .or. ch.eq.'w' .or. ch.eq.'-' )then hem = 'W' ibeg = ibeg+1 endif c c check for wrong hemisphere entry c if( ch.eq.'N' .or. ch.eq.'n' )then hem = '*' ibeg = ibeg+1 endif if( ch.eq.'S' .or. ch.eq.'s' )then hem = '*' ibeg = ibeg+1 endif elseif( hem.eq.'A' )then if( .not.('0'.le.ch .and. ch.le.'9') )then hem = '*' ibeg = ibeg+1 endif else c do nothing endif c c do 30 i=ibeg,iend ch = buff(i) c if( ch.eq.':' .or. ch.eq.'.' )then goto 30 elseif( ch.eq.' ' .or. ch.eq.',' )then buff(i) = ':' elseif( '0'.le.ch .and. ch.le.'9' )then goto 30 else buff(i) = ':' endif c 30 continue c c left justify buff() array to its first character position c also check for a ":" char in the starting position, c if found!! skip it c j = 0 ib = ibeg ie = iend c do 40 i=ib,ie if( i.eq.ibeg .and. buff(i).eq.':' )then c c move the 1st position pointer to the next char & c do not put ":" char in buff(j) array where j=1 c ibeg = ibeg+1 goto 40 endif j = j+1 buff(j) = buff(i) 40 continue c c lgh = iend-ibeg+1 j = lgh+1 buff(j) = '$' c c clean-up the rest of the buff() array c do 50 i=j+1,50 buff(i) = ' ' 50 continue c c save a maximum of 20 characters c if( lgh.gt.20 )then lgh = 20 j = lgh+1 buff(j) = '$' endif c return end GeographicLib-1.45/legacy/Fortran/geodesic.inc0000644000771000077100000000303512602735126021161 0ustar ckarneyckarney*> @file geodesic.inc *! @brief The interface file for the geodesic routines in Fortran *! *! Optinally insert \code *! include 'geodesic.inc' \endcode *! into the declaration portion of a subroutine that uses this library. *! *! See geodesic.for for documentation on these routines. interface * omask bits: 1 = a12; 2 = m12; 4 = MM12 + MM21; 8 = SS12 * flags bits: 1 = arcmode; 2 = unroll subroutine direct(a, f, lat1, lon1, azi1, s12a12, flags, + lat2, lon2, azi2, omask, a12s12, m12, MM12, MM21, SS12) double precision, intent(in) :: a, f, lat1, lon1, azi1, s12a12 integer, intent(in) :: flags, omask double precision, intent(out) :: lat2, lon2, azi2 double precision, intent(out) :: a12s12, m12, MM12, MM21, SS12 end subroutine direct subroutine invers(a, f, lat1, lon1, lat2, lon2, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) double precision, intent(in) :: a, f, lat1, lon1, lat2, lon2 integer, intent(in) :: omask double precision, intent(out) :: s12, azi1, azi2 double precision, intent(out) :: a12, m12, MM12, MM21, SS12 end subroutine invers subroutine area(a, f, lats, lons, n, AA, PP) integer, intent(in) :: n double precision, intent(in) :: a, f, lats(n), lons(n) double precision, intent(out) :: AA, PP end subroutine area subroutine geover(major, minor, patch) integer, intent(out) :: major, minor, patch end subroutine geover end interface GeographicLib-1.45/legacy/Fortran/00README.txt0000644000771000077100000000166712602735126020553 0ustar ckarneyckarneyThis is a Fortran implementation of the geodesic algorithms described in C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); https://dx.doi.org/10.1007/s00190-012-0578-z Addenda: http://geographiclib.sf.net/geod-addenda.html For documentation, see http://geographiclib.sourceforge.net/html/Fortran/ The code in this directory is entirely self-contained. In particular, it does not depend on the C++ classes. You can compile and link the example programs directly with something like: f95 -o geodinverse geodinverse.for geodesic.for echo 30 0 29.5 179.5 | ./geodinverse Alternatively, you can build the examples using cmake. For example, on Linux systems you might do: mkdir BUILD cd BUILD cmake .. make echo 30 0 29.5 179.5 | ./geodinverse The two tools ngsforward and ngsinverse are replacements for the NGS tools FORWARD and INVERSE available from http://www.ngs.noaa.gov/PC_PROD/Inv_Fwd/ GeographicLib-1.45/legacy/Fortran/ngsinverse.for0000644000771000077100000003461112602735126021603 0ustar ckarneyckarneycb::inverse c program inverse c c********1*********2*********3*********4*********5*********6*********7** c c name: inverse c version: 201211.29 c author: stephen j. frakes c last mod: Charles Karney c purpose: to compute a geodetic inverse c and then display output information c c input parameters: c ----------------- c c output parameters: c ------------------ c c local variables and constants: c ------------------------------ c answer user prompt response c b semiminor axis polar (in meters) c baz azimuth back (in radians) c buff input char buffer array c dd,dm,ds temporary values for degrees, minutes, seconds c dlon temporary value for difference in longitude (radians) c dmt,d_mt char constants for meter units c edist ellipsoid distance (in meters) c elips ellipsoid choice c esq eccentricity squared for reference ellipsoid c faz azimuth forward (in radians) c filout output file name c finv reciprocal flattening c hem hemisphere flag for lat & lon entry c ierror error condition flag with d,m,s conversion c lgh length of buff() array c option user prompt response c r1,r2 temporary variables c ss temporary variable c tol tolerance for conversion of seconds c c name1 name of station one c ld1,lm1,sl1 latitude sta one - degrees,minutes,seconds c ald1,alm1,sl1 latitude sta one - degrees,minutes,seconds c lat1sn latitude sta one - sign (+/- 1) c d_ns1 latitude sta one - char ('N','S') c lod1,lom1,slo1 longitude sta one - degrees,minutes,seconds c alod1,alom1,slo1 longitude sta one - degrees,minutes,seconds c lon1sn longitude sta one - sign (+/- 1) c d_ew1 longitude sta one - char ('E','W') c iaz1,maz1,saz1 forward azimuth - degrees,minutes,seconds c isign1 forward azimuth - flag (+/- 1) c glat1,glon1 station one - (lat & lon in radians ) c p1,e1 standpoint one - (lat & lon in radians ) c c name2 name of station two c ld2,lm2,sl2 latitude sta two - degrees,minutes,seconds c ald2,alm2,sl2 latitude sta two - degrees,minutes,seconds c lat2sn latitude sta two - sign (+/- 1) c d_ns2 latitude sta two - char ('N','S') c lod2,lom2,slo2 longitude sta two - degrees,minutes,seconds c alod2,alom2,slo2 longitude sta one - degrees,minutes,seconds c lon2sn longitude sta two - sign (+/- 1) c d_ew2 longitude sta two - char ('E','W') c iaz2,maz2,saz2 back azimuth - degrees,minutes,seconds c isign2 back azimuth - flag (+/- 1) c glat2,glon2 station two - (lat & lon in radians ) c p2,e2 forepoint two - (lat & lon in radians ) c c global variables and constants: c ------------------------------- c a semimajor axis equatorial (in meters) c f flattening c pi constant 3.14159.... c rad constant 180.0/pi c c this module called by: n/a c c this module calls: elipss, getdeg, inver1, todmsp c gethem, trim, bufdms, gvalr8, gvali4, fixdms, gpnhri *********** c gethem, trim, bufdms, gvalr8, gvali4, fixdms, invers <---------- c datan, write, read, dabs, open, stop c c include files used: n/a c c common blocks used: const, elipsoid c c references: see comments within subroutines c c comments: c c********1*********2*********3*********4*********5*********6*********7** c::modification history c::1990mm.dd, sjf, creation of program c::199412.15, bmt, creation of program on viper c::200203.08, crs, modified by c.schwarz to correct spelling of Clarke c::200207.15, rws, modified i/o & standardized program documentation c:: added subs trim, bufdms, gethem, gvali4, gvalr8 c::200207.23, rws, replaced sub inver1 with gpnarc, gpnloa, gpnhri c::200208.15, rws, fixed an error in bufdms c:: - renamed ellips to elipss "common error" with dirct2 c:: - added FAZ & BAZ to printed output c::200208.19, rws, added more error flags for web interface code c:: - added logical nowebb c::200208.xx, sjf, program version number 2.0 c::201105.xx, dgm, program version number 3.0 c:: - replaced sub gpnarc, gpnloa, gpnhri with invers c:: - tested for valid antipodal solutions (+/- 0.1 mm) c:: - tested for polar solutions (+/- 0.1 mm) c:: - needs improvement for long-line/antipodal boundary c::201211.29, cffk, program version numer 3.1 c:: - drop in replacement routines from c:: "Algorithms for Geodesics" c********1*********2*********3*********4*********5*********6*********7** ce::inverse c implicit double precision (a-h, o-z) implicit integer (i-n) c logical nowebb c character*1 answer,option,dmt,buff(50),hem character*6 d_ns1, d_ew1, d_ns2, d_ew2, d_mt character*30 filout,name1,name2,elips c integer*4 ierror integer*4 lgh c common/const/pi,rad common/elipsoid/a,f c c ms_unix 0 = web version c 1 = ms_dos or unix version c parameter ( ms_unix = 0 ) c pi = 4.d0*datan(1.d0) rad = 180.d0/pi dmt = 'm' d_mt = 'Meters' c if( ms_unix.eq.1 )then nowebb = .true. else nowebb = .false. endif c 1 do 2 i=1,25 write(*,*) ' ' 2 continue c 5 write(*,*) ' Program Inverse - Version 3.1 ' write(*,*) ' ' write(*,*) ' Ellipsoid options : ' write(*,*) ' ' write(*,*) ' 1) GRS80 / WGS84 (NAD83) ' write(*,*) ' 2) Clarke 1866 (NAD27) ' write(*,*) ' 3) Any other ellipsoid ' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) option 10 format(a1) c if(option.eq.'1') then a=6378137.d0 f=1.d0/298.257222100882711243162836600094d0 elips='GRS80 / WGS84 (NAD83)' elseif(option.eq.'2') then a=6378206.4d0 f=1.d0/294.9786982138d0 elips='Clarke 1866 (NAD27)' elseif(option.eq.'3') then call elipss (elips) else write(*,*) ' Enter 1, 2, or 3 ! Try again --' goto 5 endif c esq = f*(2.0d0-f) c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' c 15 write(*,*) ' Enter First Station ' write(*,16) 16 format(18x,'(Separate D,M,S by blanks or commas)') write(*,*) 'hDD MM SS.sssss Latitude : (h default = N )' 11 format(50a1) c 22 hem='N' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlat1 = 0 else irlat1 = 1 write(*,*) ' Invalid Latitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 22 endif endif c ald1 = dd alm1 = dm sl1 = ds c if( hem.eq.'N' ) then lat1sn = +1 else lat1sn = -1 endif c write(*,*) 'hDDD MM SS.sssss Longitude : (h default = W )' c 23 hem='W' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlon1 = 0 else irlon1 = 1 write(*,*) ' Invalid Longitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 23 endif endif c alod1 = dd alom1 = dm slo1 = ds c if( hem.eq.'E' ) then lon1sn = +1 else lon1sn = -1 endif c call getdeg(ald1, alm1, sl1, lat1sn, glat1) call getdeg(alod1,alom1,slo1,lon1sn, glon1) c write(*,*) ' ' write(*,*) ' ' c 20 write(*,*) ' Enter Second Station ' write(*,16) write(*,*) 'hDD MM SS.sssss Latitude : (h default = N )' c 24 hem='N' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlat2 = 0 else irlat2 = 1 write(*,*) ' Invalid Latitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 24 endif endif c ald2 = dd alm2 = dm sl2 = ds c if( hem.eq.'N' ) then lat2sn = +1 else lat2sn = -1 endif c write(*,*) 'hDDD MM SS.sssss Longitude : (h default = W )' c 25 hem='W' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlon2 = 0 else irlon2 = 1 write(*,*) ' Invalid Longitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 25 endif endif c alod2 = dd alom2 = dm slo2 = ds c if( hem.eq.'E' )then lon2sn = +1 else lon2sn = -1 endif c call getdeg(ald2, alm2, sl2, lat2sn, glat2) call getdeg(alod2,alom2,slo2,lon2sn, glon2) c p1 = glat1 e1 = glon1 p2 = glat2 e2 = glon2 c if( e1.lt.0.0d0 )then e1 = e1+2.0d0*pi endif if( e2.lt.0.0d0 )then e2 = e2+2.0d0*pi endif c c compute the geodetic inverse c call invers(a, f, p1, e1, p2, e2, + edist, faz, baz, 0, dummy, dummy, dummy, dummy, dummy) if (baz .ge. 0) then baz = baz - 180 else baz = baz + 180 end if c c set the tolerance (in seconds) for the azimuth conversion c tol = 0.00005d0 c call todmsp(faz,iaz1,maz1,saz1,isign1) if(isign1.lt.0) then iaz1=359-iaz1 maz1=59-maz1 saz1=60.d0-saz1 endif call fixdms ( iaz1, maz1, saz1, tol ) c call todmsp(baz,iaz2,maz2,saz2,isign2) if(isign2.lt.0) then iaz2=359-iaz2 maz2=59-maz2 saz2=60.d0-saz2 endif call fixdms ( iaz2, maz2, saz2, tol ) c call todmsp(glat1, ld1, lm1, sl1, lat1sn) call todmsp(glon1, lod1, lom1, slo1, lon1sn) call todmsp(glat2, ld2, lm2, sl2, lat2sn) call todmsp(glon2, lod2, lom2, slo2, lon2sn) c call hem_ns ( lat1sn, d_ns1 ) call hem_ew ( lon1sn, d_ew1 ) call hem_ns ( lat2sn, d_ns2 ) call hem_ew ( lon2sn, d_ew2 ) c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,49) elips 49 format(' Ellipsoid : ',a30) finv=1.d0/f b=a*(1.d0-f) write(*,50) a,b,finv 50 format(' Equatorial axis, a = ',f15.4,/, * ' Polar axis, b = ',f15.4,/, * ' Inverse flattening, 1/f = ',f16.11) c 18 format(' LAT = ',i3,1x,i2,1x,f8.5,1x,a6) 19 format(' LON = ',i3,1x,i2,1x,f8.5,1x,a6) c write(*,*) ' ' write(*,*) ' First Station : ' write(*,*) ' ---------------- ' write(*,18) ld1, lm1, sl1, d_ns1 write(*,19) lod1,lom1,slo1,d_ew1 c write(*,*) ' ' write(*,*) ' Second Station : ' write(*,*) ' ---------------- ' write(*,18) ld2, lm2, sl2, d_ns2 write(*,19) lod2,lom2,slo2,d_ew2 c 32 format(' Ellipsoidal distance S = ',f14.4,1x,a1) 34 format(' Forward azimuth FAZ = ',i3,1x,i2,1x,f7.4, 1 ' From North') 35 format(' Back azimuth BAZ = ',i3,1x,i2,1x,f7.4, 1 ' From North') c write(*,*) ' ' write(*,34) iaz1,maz1,saz1 write(*,35) iaz2,maz2,saz2 write(*,32) edist,dmt write(*,*) ' ' write(*,*) ' Do you want to save this output into a file (y/n)?' read(*,10) answer c if( answer.eq.'Y'.or.answer.eq.'y' )then 39 write(*,*) ' Enter the output filename : ' read(*,40) filout 40 format(a30) open(3,file=filout,status='new',err=99) goto 98 c 99 write(*,*) ' File already exists, try again.' go to 39 c 98 continue write(3,*) ' ' write(3,49) elips finv=1.d0/f b=a*(1.d0-f) write(3,50) a,b,finv write(*,*) ' Enter the First Station name : ' read(*,40) name1 write(*,*) ' Enter the Second Station name : ' read(*,40) name2 c 41 format(' First Station : ',a30) 42 format(' Second Station : ',a30) 84 format(' Error: First Station ... Invalid Latitude ') 85 format(' Error: First Station ... Invalid Longitude ') 86 format(' Error: Second Station ... Invalid Latitude ') 87 format(' Error: Second Station ... Invalid Longitude ') 88 format(1x,65(1h*)) 91 format(' DD(0-89) MM(0-59) SS(0-59.999...) ') 92 format(' DDD(0-359) MM(0-59) SS(0-59.999...) ') c write(3,*) ' ' write(3,41) name1 write(3,*) ' ---------------- ' if( irlat1.eq.0 )then write(3,18) ld1, lm1, sl1, d_ns1 else write(3,88) write(3,84) write(3,91) write(3,88) endif c if( irlon1.eq.0 )then write(3,19) lod1,lom1,slo1,d_ew1 else write(3,88) write(3,85) write(3,92) write(3,88) endif c write(3,*) ' ' write(3,42) name2 write(3,*) ' ---------------- ' c if( irlat2.eq.0 )then write(3,18) ld2, lm2, sl2, d_ns2 else write(3,88) write(3,86) write(3,91) write(3,88) endif c if( irlon2.eq.0 )then write(3,19) lod2,lom2,slo2,d_ew2 else write(3,88) write(3,87) write(3,92) write(3,88) endif c write(3,*) ' ' write(3,34) iaz1,maz1,saz1 write(3,35) iaz2,maz2,saz2 write(3,32) edist,dmt write(3,*) ' ' endif c 80 write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' 1) Another inverse, different ellipsoid.' write(*,*) ' 2) Same ellipsoid, two new stations.' write(*,*) ' 3) Same ellipsoid, same First Station.' write(*,*) ' 4) Done.' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) answer c if( answer.eq.'1' )then goto 1 elseif( answer.eq.'2' )then goto 15 elseif( answer.eq.'3' )then goto 20 else write(*,*) ' Thats all, folks!' endif c stop end GeographicLib-1.45/legacy/Fortran/CMakeLists.txt0000644000771000077100000000172712602735126021452 0ustar ckarneyckarneycmake_minimum_required (VERSION 2.8.4) project (GeographicLib-legacy-Fortran Fortran) # 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 () set (TOOLS geoddirect geodinverse planimeter geodtest) foreach (TOOL ${TOOLS}) add_executable (${TOOL} ${TOOL}.for geodesic.for geodesic.inc) endforeach () set_target_properties (${TOOLS} PROPERTIES COMPILE_FLAGS "-Wall -Wextra -pedantic -std=f95 -fimplicit-none -Wno-compare-reals") # Work alikes for NGS geodesic tools. This uses legacy code from NGS # and so they trigger multiple errors and warnings if compiled with the # compile flags above. add_executable (ngsforward ngsforward.for ngscommon.for geodesic.for) add_executable (ngsinverse ngsinverse.for ngscommon.for geodesic.for) # Turn on testing enable_testing () # Run the test suite add_test (NAME geodtest COMMAND geodtest) GeographicLib-1.45/legacy/Fortran/planimeter.for0000644000771000077100000000162712602735126021561 0ustar ckarneyckarney*> @file planimeter.for *! @brief A test program for area() *> A simple program to compute the area of a geodesic polygon. *! *! This program reads in up to 100000 lines with lat, lon for each vertex *! of a polygon. At the end of input, the program prints the number of *! vertices, the perimeter of the polygon and its area (for the WGS84 *! ellipsoid). program planimeter implicit none include 'geodesic.inc' integer maxpts parameter (maxpts = 100000) double precision a, f, lats(maxpts), lons(maxpts), S, P integer n * WGS84 values a = 6378137d0 f = 1/298.257223563d0 n = 0 10 continue if (n .ge. maxpts) go to 20 read(*, *, end=20, err=20) lats(n+1), lons(n+1) n = n+1 go to 10 20 continue call area(a, f, lats, lons, n, S, P) print 30, n, P, S 30 format(i6, 1x, f20.8, 1x, f20.3) stop end GeographicLib-1.45/legacy/Fortran/ngsforward.for0000644000771000077100000003343412602735126021576 0ustar ckarneyckarneycb::forward c program forward c c********1*********2*********3*********4*********5*********6*********7** c c name: forward c version: 201211.29 c author: stephen j. frakes c last mod: Charles Karney c purpose: to compute a geodetic forward (direct problem) c and then display output information c c input parameters: c ----------------- c c output parameters: c ------------------ c c local variables and constants: c ------------------------------ c answer user prompt response c arc meridional arc distance latitude p1 to p2 (meters) c b semiminor axis polar (in meters) c baz azimuth back (in radians) c blimit geodetic distance allowed on ellipsoid (in meters) c buff input char buffer array c dd,dm,ds temporary values for degrees, minutes, seconds c dmt,d_mt char constants for units (in meters) c dd_max maximum ellipsoid distance -1 (in meters) c edist ellipsoid distance (in meters) c elips ellipsoid choice c esq eccentricity squared for reference ellipsoid c faz azimuth forward (in radians) c filout output file name c finv reciprocal flattening c hem hemisphere flag for lat & lon entry c ierror error condition flag with d,m,s conversion c lgh length of buff() array c option user prompt response c r1,r2 temporary variables c ss temporary value for ellipsoid distance c tol tolerance for conversion of seconds c c name1 name of station one c ld1,lm1,sl1 latitude sta one - degrees,minutes,seconds c ald1,alm1,sl1 latitude sta one - degrees,minutes,seconds c lat1sn latitude sta one - sign (+/- 1) c d_ns1 latitude sta one - char ('N','S') c lod1,lom1,slo1 longitude sta one - degrees,minutes,seconds c alod1,alom1,slo1 longitude sta one - degrees,minutes,seconds c lon1sn longitude sta one - sign (+/- 1) c d_ew1 longitude sta one - char ('E','W') c iaz1,maz1,saz1 forward azimuth - degrees,minutes,seconds c isign1 forward azimuth - flag (+/- 1) c azd1,azm1,saz1 forward azimuth - degrees,minutes,seconds c iazsn forward azimuth - flag (+/- 1) c glat1,glon1 station one - (lat & lon in radians ) c c name2 name of station two c ld2,lm2,sl2 latitude sta two - degrees,minutes,seconds c lat2sn latitude sta two - sign (+/- 1) c d_ns2 latitude sta two - char ('N','S') c lod2,lom2,slo2 longitude sta two - degrees,minutes,seconds c lon2sn longitude sta two - sign (+/- 1) c d_ew2 longitude sta two - char ('E','W') c iaz2,maz2,saz2 back azimuth - degrees,minutes,seconds c isign2 back azimuth - flag (+/- 1) c glat2,glon2 station two - (lat & lon in radians ) c c global variables and constants: c ------------------------------- c a semimajor axis equatorial (in meters) c f flattening c pi constant 3.14159.... c rad constant 180.0/pi c c this module called by: n/a c c this module calls: elipss, getdeg, dirct1, todmsp c gethem, trim, bufdms, gvalr8, gvali4, fixdms c datan, write, read, dabs, open, stop c c include files used: n/a c c common blocks used: const, elipsoid c c references: see comments within subroutines c c comments: c c********1*********2*********3*********4*********5*********6*********7** c::modification history c::1990mm.dd, sjf, creation of program c::199412.15, bmt, creation of program on viper c::200203.08, crs, modified by c.schwarz to correct spelling of Clarke c:: at request of Dave Doyle c::200207.18, rws, modified i/o & standardized program documentation c:: added subs trim, bufdms, gethem, gvali4, gvalr8 c::200207.23, rws, added sub gpnarc c::200208.15, rws, fixed an error in bufdms c:: - renamed ellips to elipss "common error" with dirct2 c:: - added FAZ & BAZ to printed output c::200208.19, rws, added more error flags for web interface c:: - added logical nowebb c::200208.xx, sjf, program version number 2.0 c::201211.29, cffk, program version number 3.1 c:: - drop in replacement routines from c:: "Algorithms for Geodesics" c********1*********2*********3*********4*********5*********6*********7** ce::forward c implicit double precision (a-h, o-z) implicit integer (i-n) c logical nowebb c character*1 answer,option,dmt,buff(50),hem character*6 d_ns1, d_ew1, d_ns2, d_ew2, d_mt character*30 filout,name1,name2,elips c integer*4 ierror integer*4 lgh c common/const/pi,rad common/elipsoid/a,f c c ms_unix 0 = web version c 1 = ms_dos or unix c parameter ( ms_unix = 0 ) c pi=4.d0*datan(1.d0) rad=180.d0/pi dmt='m' d_mt='Meters' c if( ms_unix.eq.1 )then nowebb = .true. else nowebb = .false. endif c 1 do 2 i=1,25 write(*,*) ' ' 2 continue 5 write(*,*) ' Program Forward - Version 3.1 ' write(*,*) ' ' write(*,*) ' Ellipsoid options : ' write(*,*) ' ' write(*,*) ' 1) GRS80 / WGS84 (NAD83) ' write(*,*) ' 2) Clarke 1866 (NAD27) ' write(*,*) ' 3) Any other ellipsoid ' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) option 10 format(a1) c if(option.eq.'1') then a=6378137.d0 f=1.d0/298.25722210088d0 elips='GRS80 / WGS84 (NAD83)' elseif(option.eq.'2') then a=6378206.4d0 f=1.d0/294.9786982138d0 elips='Clarke 1866 (NAD27)' elseif(option.eq.'3') then call elipss (elips) else write(*,*) ' Enter 1, 2, or 3 ! Try again --' goto 5 endif c esq = f*(2.0d0-f) c c compute the geodetic limit distance (blimit), it is equal c to twice the equatorial circumference minus one meter c blimit = 2*pi*a-1.0d0 c c maximum distance allowed on ellipsoid c dd_max = blimit c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' c 15 write(*,*) ' Enter First Station ' write(*,16) 16 format(18x,'(Separate D,M,S by blanks or commas)') write(*,*) 'hDD MM SS.sssss Latitude : (h default = N )' c 11 format(50a1) c 22 hem='N' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlat1 = 0 else irlat1 = 1 write(*,*) ' Invalid Latitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 22 endif endif c ald1 = dd alm1 = dm sl1 = ds c if( hem.eq.'N' ) then lat1sn = +1 else lat1sn = -1 endif c write(*,*) 'hDDD MM SS.sssss Longitude : (h default = W )' c 23 hem='W' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlon1 = 0 else irlon1 = 1 write(*,*) ' Invalid Longitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 23 endif endif c alod1 = dd alom1 = dm slo1 = ds c if( hem.eq.'E' ) then lon1sn = +1 else lon1sn = -1 endif c call getdeg(ald1, alm1, sl1, lat1sn, glat1) call getdeg(alod1,alom1,slo1,lon1sn, glon1) c 20 write(*,*) 'DDD MM SS.sss Forward Azimuth : (from north)' c 24 hem='A' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then iazsn = 1 irazi1 = 0 else irazi1 = 1 write(*,*) ' Invalid Azimuth ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 24 endif endif c azd1 = dd azm1 = dm saz1 = ds c call getdeg(azd1,azm1,saz1,iazsn,faz) c write(*,*) 'DDDDDD.dddd Ellipsoidal Distance : (in meters)' c 25 ss = 0.0d0 read(*,*) ss ss = dabs(ss) c if( ss.lt.dd_max )then edist = ss irdst1 = 0 else irdst1 = 1 write(*,*) ' Invalid Distance ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 25 endif edist = 0.001d0 endif c call direct (a, f, glat1, glon1, faz, edist, 0, + glat2, glon2, baz, 0, dummy, dummy, dummy, dummy, dummy) if (baz .ge. 0) then baz = baz - 180 else baz = baz + 180 end if c c set the azimuth seconds tolerance c tol = 0.00005d0 c call todmsp(faz,iaz1,maz1,saz1,isign1) if(isign1.lt.0) then iaz1=359-iaz1 maz1=59-maz1 saz1=60.d0-saz1 endif call fixdms ( iaz1, maz1, saz1, tol ) c call todmsp(baz,iaz2,maz2,saz2,isign2) if(isign2.lt.0) then iaz2=359-iaz2 maz2=59-maz2 saz2=60.d0-saz2 endif call fixdms ( iaz2, maz2, saz2, tol ) c call todmsp(glat1, ld1, lm1, sl1, lat1sn) call todmsp(glon1, lod1, lom1, slo1, lon1sn) call todmsp(glat2, ld2, lm2, sl2, lat2sn) call todmsp(glon2, lod2, lom2, slo2, lon2sn) c call hem_ns ( lat1sn, d_ns1 ) call hem_ew ( lon1sn, d_ew1 ) call hem_ns ( lat2sn, d_ns2 ) call hem_ew ( lon2sn, d_ew2 ) c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,49) elips 49 format(' Ellipsoid : ',a30) finv=1.d0/f b=a*(1.d0-f) write(*,50) a,b,finv 50 format(' Equatorial axis, a = ',f15.4,/, * ' Polar axis, b = ',f15.4,/, * ' Inverse flattening, 1/f = ',f16.11) c 18 format(' LAT = ',i3,1x,i2,1x,f8.5,1x,a6) 19 format(' LON = ',i3,1x,i2,1x,f8.5,1x,a6) c write(*,*) ' ' write(*,*) ' First Station : ' write(*,*) ' ---------------- ' write(*,18) ld1, lm1, sl1, d_ns1 write(*,19) lod1,lom1,slo1,d_ew1 c write(*,*) ' ' write(*,*) ' Second Station : ' write(*,*) ' ---------------- ' write(*,18) ld2, lm2, sl2, d_ns2 write(*,19) lod2,lom2,slo2,d_ew2 c c 32 format(' Ellipsoidal distance S = ',f14.4,1x,a1) 34 format(' Forward azimuth FAZ = ',i3,1x,i2,1x,f7.4, 1 ' From North') 35 format(' Back azimuth BAZ = ',i3,1x,i2,1x,f7.4, 1 ' From North') c write(*,*) ' ' write(*,34) iaz1,maz1,saz1 write(*,35) iaz2,maz2,saz2 write(*,32) edist,dmt write(*,*) ' ' write(*,*) ' Do you want to save this output into a file (y/n)?' read(*,10) answer c if( answer.eq.'Y'.or.answer.eq.'y' )then 39 write(*,*) ' Enter the output filename : ' read(*,40) filout 40 format(a30) open(3,file=filout,status='new',err=99) goto 98 c 99 write(*,*) ' File already exists, try again.' go to 39 c 98 continue write(3,*) ' ' write(3,49) elips write(3,50) a,b,finv write(*,*) ' Enter the First Station name : ' read(*,40) name1 write(*,*) ' Enter the Second Station name : ' read(*,40) name2 c 41 format(' First Station : ',a30) 42 format(' Second Station : ',a30) 84 format(' Error: First Station ... Invalid Latitude ') 85 format(' Error: First Station ... Invalid Longitude ') 86 format(' Error: Forward Azimuth .. Invalid Entry ') 87 format(' Error: Ellipsoid Distance .. Invalid Entry ') 88 format(1x,65(1h*)) 91 format(' DD(0-89) MM(0-59) SS(0-59.999...) ') 92 format(' DDD(0-359) MM(0-59) SS(0-59.999...) ') 93 format(' Geodetic distance is too long ') c write(3,*) ' ' write(3,41) name1 write(3,*) ' ---------------- ' c if( irlat1.eq.0 )then write(3,18) ld1, lm1, sl1, d_ns1 else write(3,88) write(3,84) write(3,91) write(3,88) endif c if( irlon1.eq.0 )then write(3,19) lod1,lom1,slo1,d_ew1 else write(3,88) write(3,85) write(3,92) write(3,88) endif c write(3,*) ' ' write(3,42) name2 write(3,*) ' ---------------- ' write(3,18) ld2, lm2, sl2, d_ns2 write(3,19) lod2,lom2,slo2,d_ew2 c write(3,*) ' ' if( irazi1.eq.0 )then write(3,34) iaz1,maz1,saz1 else write(3,88) write(3,86) write(3,92) write(3,88) endif c write(3,35) iaz2,maz2,saz2 c if( irdst1.eq.0 )then write(3,32) edist,dmt else write(3,88) write(3,87) write(3,93) write(3,88) endif c write(3,*) ' ' endif c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' 1) Another forward, different ellipsoid.' write(*,*) ' 2) Same ellipsoid, two new stations.' write(*,*) ' 3) Same ellipsoid, same First Station.' write(*,*) ' 4) Let the Second Station be the First Station.' write(*,*) ' 5) Done.' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) answer c if( answer.eq.'1')then goto 1 elseif(answer.eq.'2')then goto 15 elseif(answer.eq.'3')then goto 20 elseif(answer.eq.'4')then glat1 = glat2 glon1 = glon2 goto 20 else write(*,*) ' Thats all, folks!' endif c c stop end GeographicLib-1.45/legacy/Fortran/geodinverse.for0000644000771000077100000000157512602735126021735 0ustar ckarneyckarney*> @file geodinverse.for *! @brief A test program for invers() *> A simple program to solve the inverse geodesic problem. *! *! This program reads in lines with lat1, lon1, lon2, lat2 and prints *! out lines with azi1, azi2, s12 (for the WGS84 ellipsoid). program geodinverse implicit none include 'geodesic.inc' double precision a, f, lat1, lon1, azi1, lat2, lon2, azi2, s12, + dummy1, dummy2, dummy3, dummy4, dummy5 integer omask * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 10 continue read(*, *, end=90, err=90) lat1, lon1, lat2, lon2 call invers(a, f, lat1, lon1, lat2, lon2, + s12, azi1, azi2, omask, + dummy1, dummy2, dummy3, dummy4 , dummy5) print 20, azi1, azi2, s12 20 format(1x, f20.15, 1x, f20.15, 1x, f19.10) go to 10 90 continue stop end GeographicLib-1.45/tools/GeoidEval.cpp0000644000771000077100000002437212602735126017537 0ustar ckarneyckarney/** * \file GeoidEval.cpp * \brief Command line utility for evaluating geoid heights * * Copyright (c) Charles Karney (2009-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "GeoidEval.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool cacheall = false, cachearea = false, verbose = false, cubic = true, gradp = false; real caches, cachew, cachen, cachee; std::string dir; std::string geoid = Geoid::DefaultGeoidName(); Geoid::convertflag heightmult = Geoid::NONE; std::string istring, ifile, ofile, cdelim; char lsep = ';'; bool northp = false, longfirst = false; int zonenum = UTMUPS::INVALID; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-a") { cacheall = true; cachearea = false; } else if (arg == "-c") { if (m + 4 >= argc) return usage(1, true); cacheall = false; cachearea = true; try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), caches, cachew, longfirst); DMS::DecodeLatLon(std::string(argv[m + 3]), std::string(argv[m + 4]), cachen, cachee, longfirst); } catch (const std::exception& e) { std::cerr << "Error decoding argument of -c: " << e.what() << "\n"; return 1; } m += 4; } else if (arg == "--msltohae") heightmult = Geoid::GEOIDTOELLIPSOID; else if (arg == "--haetomsl") heightmult = Geoid::ELLIPSOIDTOGEOID; else if (arg == "-w") longfirst = true; else if (arg == "-z") { if (++m == argc) return usage(1, true); std::string zone = argv[m]; try { UTMUPS::DecodeZone(zone, zonenum, northp); } catch (const std::exception& e) { std::cerr << "Error decoding zone: " << e.what() << "\n"; return 1; } if (!(zonenum >= UTMUPS::MINZONE && zonenum <= UTMUPS::MAXZONE)) { std::cerr << "Illegal zone " << zone << "\n"; return 1; } } else if (arg == "-n") { if (++m == argc) return usage(1, true); geoid = argv[m]; } else if (arg == "-d") { if (++m == argc) return usage(1, true); dir = argv[m]; } else if (arg == "-l") cubic = false; else if (arg == "-g") gradp = true; else if (arg == "-v") verbose = true; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else { int retval = usage(!(arg == "-h" || arg == "--help"), arg != "--help"); if (arg == "-h") std::cout<< "\nDefault geoid path = \"" << Geoid::DefaultGeoidPath() << "\"\nDefault geoid name = \"" << Geoid::DefaultGeoidName() << "\"\n"; return retval; } } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; int retval = 0; try { const Geoid g(geoid, dir, cubic); try { if (cacheall) g.CacheAll(); else if (cachearea) g.CacheArea(caches, cachew, cachen, cachee); } catch (const std::exception& e) { std::cerr << "ERROR: " << e.what() << "\nProceeding without a cache\n"; } if (verbose) { std::cerr << "Geoid file: " << g.GeoidFile() << "\n" << "Description: " << g.Description() << "\n" << "Interpolation: " << g.Interpolation() << "\n" << "Date & Time: " << g.DateTime() << "\n" << "Offset (m): " << g.Offset() << "\n" << "Scale (m): " << g.Scale() << "\n" << "Max error (m): " << g.MaxError() << "\n" << "RMS error (m): " << g.RMSError() << "\n"; if (g.Cache()) std::cerr<< "Caching:" << "\n SW Corner: " << g.CacheSouth() << " " << g.CacheWest() << "\n NE Corner: " << g.CacheNorth() << " " << g.CacheEast() << "\n"; } GeoCoords p; std::string s, eol, suff; const char* spaces = " \t\n\v\f\r,"; // Include comma as space while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; std::string::size_type m1 = m > 0 ? s.find_last_not_of(spaces, m - 1) : std::string::npos; s = s.substr(0, m1 != std::string::npos ? m1 + 1 : m); } } real height = 0; if (zonenum != UTMUPS::INVALID) { // Expect "easting northing" if heightmult == 0, or // "easting northing height" if heightmult != 0. std::string::size_type pa = 0, pb = 0; real easting = 0, northing = 0; for (int i = 0; i < (heightmult ? 3 : 2); ++i) { if (pb == std::string::npos) throw GeographicErr("Incomplete input: " + s); // Start of i'th token pa = s.find_first_not_of(spaces, pb); if (pa == std::string::npos) throw GeographicErr("Incomplete input: " + s); // End of i'th token pb = s.find_first_of(spaces, pa); (i == 2 ? height : (i == 0 ? easting : northing)) = Utility::num(s.substr(pa, (pb == std::string::npos ? pb : pb - pa))); } p.Reset(zonenum, northp, easting, northing); if (heightmult) { suff = pb == std::string::npos ? "" : s.substr(pb); s = s.substr(0, pa); } } else { if (heightmult) { // Treat last token as height // pb = last char of last token // pa = last char preceding white space // px = last char of 2nd last token std::string::size_type pb = s.find_last_not_of(spaces); std::string::size_type pa = s.find_last_of(spaces, pb); if (pa == std::string::npos || pb == std::string::npos) throw GeographicErr("Incomplete input: " + s); height = Utility::num(s.substr(pa + 1, pb - pa)); s = s.substr(0, pa + 1); } p.Reset(s, true, longfirst); } if (heightmult) { real h = g(p.Latitude(), p.Longitude()); *output << s << Utility::str(height + real(heightmult) * h, 4) << suff << eol; } else { if (gradp) { real gradn, grade; real h = g(p.Latitude(), p.Longitude(), gradn, grade); *output << Utility::str(h, 4) << " " << Utility::str(gradn * 1e6, 2) << (Math::isnan(gradn) ? " " : "e-6 ") << Utility::str(grade * 1e6, 2) << (Math::isnan(grade) ? "" : "e-6") << eol; } else { real h = g(p.Latitude(), p.Longitude()); *output << Utility::str(h, 4) << eol; } } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } } catch (const std::exception& e) { std::cerr << "Error reading " << geoid << ": " << e.what() << "\n"; retval = 1; } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/RhumbSolve.cpp0000644000771000077100000002046512602735126017765 0ustar ckarneyckarney/** * \file RhumbSolve.cpp * \brief Command line utility for rhumb line calculations * * Copyright (c) Charles Karney (2014-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "RhumbSolve.usage" using namespace GeographicLib; typedef Math::real real; std::string LatLonString(real lat, real lon, int prec, bool dms, char dmssep, bool longfirst) { using namespace GeographicLib; std::string latstr = dms ? DMS::Encode(lat, prec + 5, DMS::LATITUDE, dmssep) : DMS::Encode(lat, prec + 5, DMS::NUMBER), lonstr = dms ? DMS::Encode(lon, prec + 5, DMS::LONGITUDE, dmssep) : DMS::Encode(lon, prec + 5, DMS::NUMBER); return (longfirst ? lonstr : latstr) + " " + (longfirst ? latstr : lonstr); } std::string AzimuthString(real azi, int prec, bool dms, char dmssep) { return dms ? DMS::Encode(azi, prec + 5, DMS::AZIMUTH, dmssep) : DMS::Encode(azi, prec + 5, DMS::NUMBER); } int main(int argc, char* argv[]) { try { Utility::set_digits(); bool linecalc = false, inverse = false, dms = false, exact = true, longfirst = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); real lat1, lon1, azi12 = Math::NaN(), lat2, lon2, s12, S12; int prec = 3; std::string istring, ifile, ofile, cdelim; char lsep = ';', dmssep = char(0); for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-i") { inverse = true; linecalc = false; } else if (arg == "-l") { inverse = false; linecalc = true; if (m + 3 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat1, lon1, longfirst); azi12 = DMS::DecodeAzimuth(std::string(argv[m + 3])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -l: " << e.what() << "\n"; return 1; } m += 3; } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-d") { dms = true; dmssep = '\0'; } else if (arg == "-:") { dms = true; dmssep = ':'; } else if (arg == "-w") longfirst = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-s") exact = false; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; const Rhumb rh(a, f, exact); const RhumbLine rhl(linecalc ? rh.Line(lat1, lon1, azi12) : rh.Line(0, 0, 90)); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, slat1, slon1, slat2, slon2, sazi, ss12, strc; std::istringstream str; int retval = 0; while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } str.clear(); str.str(s); if (linecalc) { if (!(str >> s12)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); rhl.Position(s12, lat2, lon2, S12); *output << LatLonString(lat2, lon2, prec, dms, dmssep, longfirst) << " " << Utility::str(S12, std::max(prec-7, 0)) << eol; } else if (inverse) { if (!(str >> slat1 >> slon1 >> slat2 >> slon2)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1, longfirst); DMS::DecodeLatLon(slat2, slon2, lat2, lon2, longfirst); rh.Inverse(lat1, lon1, lat2, lon2, s12, azi12, S12); *output << AzimuthString(azi12, prec, dms, dmssep) << " " << Utility::str(s12, prec) << " " << Utility::str(S12, std::max(prec-7, 0)) << eol; } else { // direct if (!(str >> slat1 >> slon1 >> sazi >> s12)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1, longfirst); azi12 = DMS::DecodeAzimuth(sazi); rh.Direct(lat1, lon1, azi12, s12, lat2, lon2, S12); *output << LatLonString(lat2, lon2, prec, dms, dmssep, longfirst) << " " << Utility::str(S12, std::max(prec-7, 0)) << eol; } } catch (const std::exception& e) { // Write error message cout so output lines match input lines *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/MagneticField.cpp0000644000771000077100000003113412602735126020365 0ustar ckarneyckarney/** * \file MagneticField.cpp * \brief Command line utility for evaluating magnetic fields * * Copyright (c) Charles Karney (2011-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif #include "MagneticField.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool verbose = false, longfirst = false; std::string dir; std::string model = MagneticModel::DefaultMagneticName(); std::string istring, ifile, ofile, cdelim; char lsep = ';'; real time = 0, lat = 0, h = 0; bool timeset = false, circle = false, rate = false; real hguard = 500000, tguard = 50; int prec = 1; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-n") { if (++m == argc) return usage(1, true); model = argv[m]; } else if (arg == "-d") { if (++m == argc) return usage(1, true); dir = argv[m]; } else if (arg == "-t") { if (++m == argc) return usage(1, true); try { time = Utility::fractionalyear(std::string(argv[m])); timeset = true; circle = false; } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-c") { if (m + 3 >= argc) return usage(1, true); try { using std::abs; time = Utility::fractionalyear(std::string(argv[++m])); DMS::flag ind; lat = DMS::Decode(std::string(argv[++m]), ind); if (ind == DMS::LONGITUDE) throw GeographicErr("Bad hemisphere letter on latitude"); if (!(abs(lat) <= 90)) throw GeographicErr("Latitude not in [-90d, 90d]"); h = Utility::num(std::string(argv[++m])); timeset = false; circle = true; } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-r") rate = !rate; else if (arg == "-w") longfirst = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-T") { if (++m == argc) return usage(1, true); try { tguard = Utility::num(std::string(argv[m])); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-H") { if (++m == argc) return usage(1, true); try { hguard = Utility::num(std::string(argv[m])); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-v") verbose = true; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else { int retval = usage(!(arg == "-h" || arg == "--help"), arg != "--help"); if (arg == "-h") std::cout<< "\nDefault magnetic path = \"" << MagneticModel::DefaultMagneticPath() << "\"\nDefault magnetic name = \"" << MagneticModel::DefaultMagneticName() << "\"\n"; return retval; } } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; tguard = std::max(real(0), tguard); hguard = std::max(real(0), hguard); prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); int retval = 0; try { const MagneticModel m(model, dir); if ((timeset || circle) && (!Math::isfinite(time) || time < m.MinTime() - tguard || time > m.MaxTime() + tguard)) throw GeographicErr("Time " + Utility::str(time) + " too far outside allowed range [" + Utility::str(m.MinTime()) + "," + Utility::str(m.MaxTime()) + "]"); if (circle && (!Math::isfinite(h) || h < m.MinHeight() - hguard || h > m.MaxHeight() + hguard)) throw GeographicErr("Height " + Utility::str(h/1000) + "km too far outside allowed range [" + Utility::str(m.MinHeight()/1000) + "km," + Utility::str(m.MaxHeight()/1000) + "km]"); if (verbose) { std::cerr << "Magnetic file: " << m.MagneticFile() << "\n" << "Name: " << m.MagneticModelName() << "\n" << "Description: " << m.Description() << "\n" << "Date & Time: " << m.DateTime() << "\n" << "Time range: [" << m.MinTime() << "," << m.MaxTime() << "]\n" << "Height range: [" << m.MinHeight()/1000 << "km," << m.MaxHeight()/1000 << "km]\n"; } if ((timeset || circle) && (time < m.MinTime() || time > m.MaxTime())) std::cerr << "WARNING: Time " << time << " outside allowed range [" << m.MinTime() << "," << m.MaxTime() << "]\n"; if (circle && (h < m.MinHeight() || h > m.MaxHeight())) std::cerr << "WARNING: Height " << h/1000 << "km outside allowed range [" << m.MinHeight()/1000 << "km," << m.MaxHeight()/1000 << "km]\n"; const MagneticCircle c(circle ? m.Circle(time, lat, h) : MagneticCircle()); std::string s, eol, stra, strb; std::istringstream str(s); while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type n = s.find(cdelim); if (n != std::string::npos) { eol = " " + s.substr(n) + "\n"; s = s.substr(0, n); } } str.clear(); str.str(s); if (!(timeset || circle)) { if (!(str >> stra)) throw GeographicErr("Incomplete input: " + s); time = Utility::fractionalyear(stra); if (time < m.MinTime() - tguard || time > m.MaxTime() + tguard) throw GeographicErr("Time " + Utility::str(time) + " too far outside allowed range [" + Utility::str(m.MinTime()) + "," + Utility::str(m.MaxTime()) + "]"); if (time < m.MinTime() || time > m.MaxTime()) std::cerr << "WARNING: Time " << time << " outside allowed range [" << m.MinTime() << "," << m.MaxTime() << "]\n"; } real lon; if (circle) { if (!(str >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::flag ind; lon = DMS::Decode(strb, ind); if (ind == DMS::LATITUDE) throw GeographicErr("Bad hemisphere letter on " + strb); } else { if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); h = 0; // h is optional if (str >> h) { if (h < m.MinHeight() - hguard || h > m.MaxHeight() + hguard) throw GeographicErr("Height " + Utility::str(h/1000) + "km too far outside allowed range [" + Utility::str(m.MinHeight()/1000) + "km," + Utility::str(m.MaxHeight()/1000) + "km]"); if (h < m.MinHeight() || h > m.MaxHeight()) std::cerr << "WARNING: Height " << h/1000 << "km outside allowed range [" << m.MinHeight()/1000 << "km," << m.MaxHeight()/1000 << "km]\n"; } else str.clear(); } if (str >> stra) throw GeographicErr("Extra junk in input: " + s); real bx, by, bz, bxt, byt, bzt; if (circle) c(lon, bx, by, bz, bxt, byt, bzt); else m(time, lat, lon, h, bx, by, bz, bxt, byt, bzt); real H, F, D, I, Ht, Ft, Dt, It; MagneticModel::FieldComponents(bx, by, bz, bxt, byt, bzt, H, F, D, I, Ht, Ft, Dt, It); *output << DMS::Encode(D, prec + 1, DMS::NUMBER) << " " << DMS::Encode(I, prec + 1, DMS::NUMBER) << " " << Utility::str(H, prec) << " " << Utility::str(by, prec) << " " << Utility::str(bx, prec) << " " << Utility::str(-bz, prec) << " " << Utility::str(F, prec) << eol; if (rate) *output << DMS::Encode(Dt, prec + 1, DMS::NUMBER) << " " << DMS::Encode(It, prec + 1, DMS::NUMBER) << " " << Utility::str(Ht, prec) << " " << Utility::str(byt, prec) << " " << Utility::str(bxt, prec) << " " << Utility::str(-bzt, prec) << " " << Utility::str(Ft, prec) << eol; } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } } catch (const std::exception& e) { std::cerr << "Error reading " << model << ": " << e.what() << "\n"; retval = 1; } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/CartConvert.cpp0000644000771000077100000001556012602735126020131 0ustar ckarneyckarney/** * \file CartConvert.cpp * \brief Command line utility for geodetic to cartesian coordinate conversions * * Copyright (c) Charles Karney (2009-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "CartConvert.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool localcartesian = false, reverse = false, longfirst = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); int prec = 6; real lat0 = 0, lon0 = 0, h0 = 0; std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = true; else if (arg == "-l") { localcartesian = true; if (m + 3 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat0, lon0, longfirst); h0 = Utility::num(std::string(argv[m + 3])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -l: " << e.what() << "\n"; return 1; } m += 3; } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-w") longfirst = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; const Geocentric ec(a, f); const LocalCartesian lc(lat0, lon0, h0, ec); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, stra, strb, strc, strd; std::istringstream str; int retval = 0; while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } str.clear(); str.str(s); // initial values to suppress warnings real lat, lon, h, x = 0, y = 0, z = 0; if (!(str >> stra >> strb >> strc)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::num(stra); y = Utility::num(strb); z = Utility::num(strc); } else { DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); h = Utility::num(strc); } if (str >> strd) throw GeographicErr("Extraneous input: " + strd); if (reverse) { if (localcartesian) lc.Reverse(x, y, z, lat, lon, h); else ec.Reverse(x, y, z, lat, lon, h); *output << Utility::str(longfirst ? lon : lat, prec + 5) << " " << Utility::str(longfirst ? lat : lon, prec + 5) << " " << Utility::str(h, prec) << eol; } else { if (localcartesian) lc.Forward(lat, lon, h, x, y, z); else ec.Forward(lat, lon, h, x, y, z); *output << Utility::str(x, prec) << " " << Utility::str(y, prec) << " " << Utility::str(z, prec) << eol; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/GeodesicProj.cpp0000644000771000077100000001700512602735126020250 0ustar ckarneyckarney/** * \file GeodesicProj.cpp * \brief Command line utility for geodesic projections * * Copyright (c) Charles Karney (2009-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "GeodesicProj.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool azimuthal = false, cassini = false, gnomonic = false, reverse = false, longfirst = false; real lat0 = 0, lon0 = 0; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); int prec = 6; std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = true; else if (arg == "-c" || arg == "-z" || arg == "-g") { cassini = arg == "-c"; azimuthal = arg == "-z"; gnomonic = arg == "-g"; if (m + 2 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat0, lon0, longfirst); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of " << arg << ": " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-w") longfirst = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; if (!(azimuthal || cassini || gnomonic)) { std::cerr << "Must specify \"-z lat0 lon0\" or " << "\"-c lat0 lon0\" or \"-g lat0 lon0\"\n"; return 1; } const Geodesic geod(a, f); const CassiniSoldner cs = cassini ? CassiniSoldner(lat0, lon0, geod) : CassiniSoldner(geod); const AzimuthalEquidistant az(geod); const Gnomonic gn(geod); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, stra, strb, strc; std::istringstream str; int retval = 0; std::cout << std::fixed; while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } str.clear(); str.str(s); real lat, lon, x, y, azi, rk; if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::num(stra); y = Utility::num(strb); } else DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); if (reverse) { if (cassini) cs.Reverse(x, y, lat, lon, azi, rk); else if (azimuthal) az.Reverse(lat0, lon0, x, y, lat, lon, azi, rk); else gn.Reverse(lat0, lon0, x, y, lat, lon, azi, rk); *output << Utility::str(longfirst ? lon : lat, prec + 5) << " " << Utility::str(longfirst ? lat : lon, prec + 5) << " " << Utility::str(azi, prec + 5) << " " << Utility::str(rk, prec + 6) << eol; } else { if (cassini) cs.Forward(lat, lon, x, y, azi, rk); else if (azimuthal) az.Forward(lat0, lon0, lat, lon, x, y, azi, rk); else gn.Forward(lat0, lon0, lat, lon, x, y, azi, rk); *output << Utility::str(x, prec) << " " << Utility::str(y, prec) << " " << Utility::str(azi, prec + 5) << " " << Utility::str(rk, prec + 6) << eol; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/TransverseMercatorProj.cpp0000644000771000077100000001730612602735126022363 0ustar ckarneyckarney/** * \file TransverseMercatorProj.cpp * \brief Command line utility for transverse Mercator projections * * Copyright (c) Charles Karney (2008-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "TransverseMercatorProj.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool exact = true, extended = false, series = false, reverse = false, longfirst = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(), k0 = Constants::UTM_k0(), lon0 = 0; int prec = 6; std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = true; else if (arg == "-t") { exact = true; extended = true; series = false; } else if (arg == "-s") { exact = false; extended = false; series = true; } else if (arg == "-l") { if (++m >= argc) return usage(1, true); try { DMS::flag ind; lon0 = DMS::Decode(std::string(argv[m]), ind); if (ind == DMS::LATITUDE) throw GeographicErr("Bad hemisphere"); lon0 = Math::AngNormalize(lon0); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-k") { if (++m >= argc) return usage(1, true); try { k0 = Utility::num(std::string(argv[m])); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-w") longfirst = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; const TransverseMercator& TMS = series ? TransverseMercator(a, f, k0) : TransverseMercator(1, 0, 1); const TransverseMercatorExact& TME = exact ? TransverseMercatorExact(a, f, k0, extended) : TransverseMercatorExact(1, real(0.1), 1, false); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, stra, strb, strc; std::istringstream str(s); int retval = 0; std::cout << std::fixed; while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } str.clear(); str.str(s); real lat, lon, x, y; if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::num(stra); y = Utility::num(strb); } else DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); real gamma, k; if (reverse) { if (series) TMS.Reverse(lon0, x, y, lat, lon, gamma, k); else TME.Reverse(lon0, x, y, lat, lon, gamma, k); *output << Utility::str(longfirst ? lon : lat, prec + 5) << " " << Utility::str(longfirst ? lat : lon, prec + 5) << " " << Utility::str(gamma, prec + 6) << " " << Utility::str(k, prec + 6) << eol; } else { if (series) TMS.Forward(lon0, lat, lon, x, y, gamma, k); else TME.Forward(lon0, lat, lon, x, y, gamma, k); *output << Utility::str(x, prec) << " " << Utility::str(y, prec) << " " << Utility::str(gamma, prec + 6) << " " << Utility::str(k, prec + 6) << eol; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/Makefile.am0000644000771000077100000001350612602735126017225 0ustar ckarneyckarney# # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/man -I$(top_srcdir)/man -Wall -Wextra LDADD = $(top_builddir)/src/libGeographic.la DEPS = $(top_builddir)/src/libGeographic.la bin_PROGRAMS = CartConvert \ ConicProj \ GeoConvert \ GeodSolve \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ RhumbSolve \ TransverseMercatorProj CartConvert_SOURCES = CartConvert.cpp \ ../man/CartConvert.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/LocalCartesian.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp ConicProj_SOURCES = ConicProj.cpp \ ../man/ConicProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/AlbersEqualArea.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/LambertConformalConic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeoConvert_SOURCES = GeoConvert.cpp \ ../man/GeoConvert.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp GeodSolve_SOURCES = GeodSolve.cpp \ ../man/GeodSolve.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicExact.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/GeodesicLineExact.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeodesicProj_SOURCES = GeodesicProj.cpp \ ../man/GeodesicProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/AzimuthalEquidistant.hpp \ ../include/GeographicLib/CassiniSoldner.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/Gnomonic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeoidEval_SOURCES = GeoidEval.cpp \ ../man/GeoidEval.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geoid.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp Gravity_SOURCES = Gravity.cpp \ ../man/Gravity.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/GravityCircle.hpp \ ../include/GeographicLib/GravityModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/NormalGravity.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/SphericalHarmonic1.hpp \ ../include/GeographicLib/Utility.hpp MagneticField_SOURCES = MagneticField.cpp \ ../man/MagneticField.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/MagneticCircle.hpp \ ../include/GeographicLib/MagneticModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/Utility.hpp Planimeter_SOURCES = Planimeter.cpp \ ../man/Planimeter.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Accumulator.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Ellipsoid.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/PolygonArea.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp RhumbSolve_SOURCES = RhumbSolve.cpp \ ../man/RhumbSolve.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Ellipsoid.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp TransverseMercatorProj_SOURCES = TransverseMercatorProj.cpp \ ../man/TransverseMercatorProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/EllipticFunction.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/TransverseMercator.hpp \ ../include/GeographicLib/TransverseMercatorExact.hpp \ ../include/GeographicLib/Utility.hpp sbin_SCRIPTS = geographiclib-get-geoids \ geographiclib-get-gravity \ geographiclib-get-magnetic geographiclib_data = $(datadir)/GeographicLib geographiclib-get-geoids: geographiclib-get-geoids.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-gravity: geographiclib-get-gravity.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-magnetic: geographiclib-get-magnetic.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ CLEANFILES = $(sbin_SCRIPTS) EXTRA_DIST = Makefile.mk CMakeLists.txt tests.cmake \ geographiclib-get-geoids.sh geographiclib-get-gravity.sh \ geographiclib-get-magnetic.sh GeographicLib-1.45/tools/Makefile.mk0000644000771000077100000000625712602735126017244 0ustar ckarneyckarneyPROGRAMS = CartConvert \ ConicProj \ GeoConvert \ GeodSolve \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ RhumbSolve \ TransverseMercatorProj SCRIPTS = geographiclib-get-geoids \ geographiclib-get-gravity \ geographiclib-get-magnetic all: $(PROGRAMS) $(SCRIPTS) LIBSTEM = Geographic LIBRARY = lib$(LIBSTEM).a INCLUDEPATH = ../include LIBPATH = ../src # After installation, use these values of INCLUDEPATH and LIBPATH # INCLUDEPATH = $(PREFIX)/include # LIBPATH = $(PREFIX)/lib PREFIX = /usr/local GEOGRAPHICLIB_DATA = $(PREFIX)/share/GeographicLib CC = g++ -g CXXFLAGS = -g -Wall -Wextra -O3 -std=c++0x CPPFLAGS = -I$(INCLUDEPATH) -I../man $(DEFINES) LDLIBS = -L$(LIBPATH) -l$(LIBSTEM) EXTRALIBS = $(PROGRAMS): $(LIBPATH)/$(LIBRARY) $(CC) $(LDFLAGS) -o $@ $@.o $(LDLIBS) $(EXTRALIBS) VPATH = ../include/GeographicLib ../man clean: rm -f *.o $(SCRIPTS) CartConvert: CartConvert.o ConicProj: ConicProj.o GeoConvert: GeoConvert.o GeodSolve: GeodSolve.o GeodesicProj: GeodesicProj.o GeoidEval: GeoidEval.o Gravity: Gravity.o MagneticField: MagneticField.o Planimeter: Planimeter.o RhumbSolve: RhumbSolve.o TransverseMercatorProj: TransverseMercatorProj.o CartConvert.o: CartConvert.usage Config.h Constants.hpp DMS.hpp Geocentric.hpp \ LocalCartesian.hpp Math.hpp Utility.hpp ConicProj.o: ConicProj.usage Config.h AlbersEqualArea.hpp Constants.hpp \ DMS.hpp LambertConformalConic.hpp Math.hpp Utility.hpp GeoConvert.o: GeoConvert.usage Config.h Constants.hpp DMS.hpp GeoCoords.hpp \ Math.hpp UTMUPS.hpp Utility.hpp GeodSolve.o: GeodSolve.usage Config.h Constants.hpp DMS.hpp Geodesic.hpp \ GeodesicExact.hpp GeodesicLine.hpp GeodesicLineExact.hpp Math.hpp \ Utility.hpp GeodesicProj.o: GeodesicProj.usage Config.h AzimuthalEquidistant.hpp \ CassiniSoldner.hpp Constants.hpp DMS.hpp Geodesic.hpp GeodesicLine.hpp \ Gnomonic.hpp Math.hpp Utility.hpp GeoidEval.o: GeoidEval.usage Config.h Constants.hpp DMS.hpp GeoCoords.hpp \ Geoid.hpp Math.hpp UTMUPS.hpp Utility.hpp Gravity.o: Gravity.usage Config.h CircularEngine.hpp Constants.hpp DMS.hpp \ Geocentric.hpp GravityCircle.hpp GravityModel.hpp Math.hpp \ NormalGravity.hpp SphericalEngine.hpp SphericalHarmonic.hpp \ SphericalHarmonic1.hpp Utility.hpp MagneticField.o: MagneticField.usage Config.h CircularEngine.hpp Constants.hpp \ DMS.hpp Geocentric.hpp MagneticCircle.hpp MagneticModel.hpp Math.hpp \ SphericalEngine.hpp SphericalHarmonic.hpp Utility.hpp Planimeter.o: Planimeter.usage Config.h Accumulator.hpp Constants.hpp DMS.hpp \ Ellipsoid.hpp GeoCoords.hpp Geodesic.hpp Math.hpp PolygonArea.hpp \ UTMUPS.hpp Utility.hpp RhumbSolve.o: RhumbSolve.usage Config.h Constants.hpp DMS.hpp Ellipsoid.hpp \ Math.hpp Utility.hpp TransverseMercatorProj.o: TransverseMercatorProj.usage Config.h Constants.hpp \ DMS.hpp EllipticFunction.hpp Math.hpp TransverseMercator.hpp \ TransverseMercatorExact.hpp Utility.hpp %: %.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(GEOGRAPHICLIB_DATA)%" $< > $@ chmod +x $@ INSTALL = install -b DEST = $(PREFIX)/bin SDEST = $(PREFIX)/sbin install: $(PROGRAMS) $(SCRIPTS) test -f $(DEST) || mkdir -p $(DEST) $(INSTALL) $(PROGRAMS) $(DEST) test -f $(SDEST) || mkdir -p $(SDEST) $(INSTALL) $(SCRIPTS) $(SDEST) GeographicLib-1.45/tools/CMakeLists.txt0000644000771000077100000000412312602735126017724 0ustar ckarneyckarney# Build the tools... # Where to find the *.usage files for the --help option. include_directories (${PROJECT_BINARY_DIR}/man) # Only needed if target_compile_definitions is not supported add_definitions (${PROJECT_DEFINITIONS}) # Loop over all the tools, specifying the source and library. add_custom_target (tools ALL) foreach (TOOL ${TOOLS}) add_executable (${TOOL} ${TOOL}.cpp) if (MAINTAINER) add_dependencies (${TOOL} usage) endif () add_dependencies (tools ${TOOL}) set_source_files_properties (${TOOL}.cpp PROPERTIES OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/man/${TOOL}.usage) target_link_libraries (${TOOL} ${PROJECT_LIBRARIES} ${QUAD_LIBRARIES} ${MPFR_LIBRARIES}) endforeach () if (MSVC OR CMAKE_CONFIGURATION_TYPES) # Add _d suffix for your debug versions of the tools set_target_properties (${TOOLS} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) endif () if (APPLE AND NOT CMAKE_VERSION VERSION_LESS 2.8.12) # Ensure that the package is relocatable set_target_properties (${TOOLS} PROPERTIES INSTALL_RPATH "@loader_path/../lib${LIB_SUFFIX}") endif () # Specify where the tools are installed, adding them to the export targets install (TARGETS ${TOOLS} EXPORT targets DESTINATION bin) # Put all the tools into a folder in the IDE set_property (TARGET tools ${TOOLS} PROPERTY FOLDER tools) # Create the scripts for downloading the data files on non-Windows # systems. This needs to substitute ${GEOGRAPHICLIB_DATA} as the # default data directory. These are installed under sbin, because it is # expected to be run with write access to /usr/local. if (NOT WIN32) foreach (SCRIPT ${SCRIPTS}) configure_file (${SCRIPT}.sh scripts/${SCRIPT} @ONLY) add_custom_command (OUTPUT ${SCRIPT} COMMAND ${CMAKE_COMMAND} -E copy scripts/${SCRIPT} ${SCRIPT} && chmod +x ${SCRIPT} DEPENDS ${SCRIPT}.sh) install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT} DESTINATION sbin) endforeach () add_custom_target (scripts ALL DEPENDS ${SCRIPTS}) endif () # The test suite -- split into a separate file because it's rather large. include (tests.cmake) GeographicLib-1.45/tools/geographiclib-get-magnetic.sh0000644000771000077100000001037612602735126022670 0ustar ckarneyckarney#! /bin/sh # # Download magnetic models for use by GeographicLib::MagneticModel. # # Copyright (c) Charles Karney (2011-2015) and # licensed under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ DEFAULTDIR="@GEOGRAPHICLIB_DATA@" SUBDIR=magnetic NAME=magnetic MODEL=magneticmodel CLASS=MagneticModel TOOL=MagneticField EXT=wmm.cof usage() { cat <&2; exit 1 ;; esac done shift `expr $OPTIND - 1` if test $# -eq 0; then usage 1>&2; exit 1 fi test -d "$PARENTDIR"/$SUBDIR || mkdir -p "$PARENTDIR"/$SUBDIR 2> /dev/null if test ! -d "$PARENTDIR"/$SUBDIR; then echo Cannot create directory $PARENTDIR/$SUBDIR 1>&2 exit 1 fi TEMP= if test -z "$DEBUG"; then trap 'trap "" 0; test "$TEMP" && rm -rf "$TEMP"; exit 1' 1 2 3 9 15 trap 'test "$TEMP" && rm -rf "$TEMP"' 0 fi TEMP=`mktemp -d -q -t $NAME-XXXXXXXX` if test -z "$TEMP" -o ! -d "$TEMP"; then echo Cannot create temporary directory 1>&2 exit 1 fi WRITETEST="$PARENTDIR"/$SUBDIR/write-test-`basename $TEMP` if touch "$WRITETEST" 2> /dev/null; then rm -f "$WRITETEST" else echo Cannot write in directory $PARENTDIR/$SUBDIR 1>&2 exit 1 fi set -e cat > $TEMP/all < /dev/null; then echo $1 else case "$1" in all ) cat $TEMP/all ;; minimal ) echo wmm2015; echo igrf12 ;; * ) echo Unknown magnetic model $1 1>&2 exit 1 ;; esac fi shift done > $TEMP/list sort -u $TEMP/list > $TEMP/todo while read file; do if test -z "$FORCE" -a -s $PARENTDIR/$SUBDIR/$file.$EXT; then echo $PARENTDIR/$SUBDIR/$file.$EXT already installed, skipping $file... echo $file >> $TEMP/skip continue fi echo download $file.tar.bz2 ... echo $file >> $TEMP/download URL="http://downloads.sourceforge.net/project/geographiclib/$SUBDIR-distrib/$file.tar.bz2?use_mirror=autoselect" ARCHIVE=$TEMP/$file.tar.bz2 wget -O$ARCHIVE $URL echo unpack $file.tar.bz2 ... tar vxojf $ARCHIVE -C $PARENTDIR echo $MODEL $file installed. done < $TEMP/todo if test "$DEBUG"; then echo Saving temporary directory $TEMP fi echo if test -s $TEMP/download; then n=`wc -l < $TEMP/download` s=; test $n -gt 1 && s=s cat < # # Copyright (c) Charles Karney (2011-2013) and # licensed under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ DEFAULTDIR="@GEOGRAPHICLIB_DATA@" SUBDIR=geoids NAME=geoid MODEL=geoid CLASS=Geoid TOOL=GeoidEval EXT=pgm usage() { cat <&2; exit 1 ;; esac done shift `expr $OPTIND - 1` if test $# -eq 0; then usage 1>&2; exit 1 fi test -d "$PARENTDIR"/$SUBDIR || mkdir -p "$PARENTDIR"/$SUBDIR 2> /dev/null if test ! -d "$PARENTDIR"/$SUBDIR; then echo Cannot create directory $PARENTDIR/$SUBDIR 1>&2 exit 1 fi TEMP= if test -z "$DEBUG"; then trap 'trap "" 0; test "$TEMP" && rm -rf "$TEMP"; exit 1' 1 2 3 9 15 trap 'test "$TEMP" && rm -rf "$TEMP"' 0 fi TEMP=`mktemp -d -q -t $NAME-XXXXXXXX` if test -z "$TEMP" -o ! -d "$TEMP"; then echo Cannot create temporary directory 1>&2 exit 1 fi WRITETEST="$PARENTDIR"/$SUBDIR/write-test-`basename $TEMP` if touch "$WRITETEST" 2> /dev/null; then rm -f "$WRITETEST" else echo Cannot write in directory $PARENTDIR/$SUBDIR 1>&2 exit 1 fi set -e cat > $TEMP/all < /dev/null; then echo $1 else case "$1" in all ) cat $TEMP/all ;; minimal ) echo egm96-5 ;; best ) # highest resolution models cat < egm2008-2_5 cat <&2 exit 1 ;; esac fi shift done > $TEMP/list sort -u $TEMP/list > $TEMP/todo while read file; do if test -z "$FORCE" -a -s $PARENTDIR/$SUBDIR/$file.$EXT; then echo $PARENTDIR/$SUBDIR/$file.$EXT already installed, skipping $file... echo $file >> $TEMP/skip continue fi echo download $file.tar.bz2 ... echo $file >> $TEMP/download URL="http://downloads.sourceforge.net/project/geographiclib/$SUBDIR-distrib/$file.tar.bz2?use_mirror=autoselect" ARCHIVE=$TEMP/$file.tar.bz2 wget -O$ARCHIVE $URL echo unpack $file.tar.bz2 ... tar vxojf $ARCHIVE -C $PARENTDIR echo $MODEL $file installed. done < $TEMP/todo if test "$DEBUG"; then echo Saving temporary directory $TEMP fi echo if test -s $TEMP/download; then n=`wc -l < $TEMP/download` s=; test $n -gt 1 && s=s cat < and licensed # under the MIT/X11 License. For more information, see # http://geographiclib.sourceforge.net/ DEFAULTDIR="@GEOGRAPHICLIB_DATA@" SUBDIR=gravity NAME=gravity MODEL=gravitymodel CLASS=GravityModel TOOL=Gravity EXT=egm.cof usage() { cat <&2; exit 1 ;; esac done shift `expr $OPTIND - 1` if test $# -eq 0; then usage 1>&2; exit 1 fi test -d "$PARENTDIR"/$SUBDIR || mkdir -p "$PARENTDIR"/$SUBDIR 2> /dev/null if test ! -d "$PARENTDIR"/$SUBDIR; then echo Cannot create directory $PARENTDIR/$SUBDIR 1>&2 exit 1 fi TEMP= if test -z "$DEBUG"; then trap 'trap "" 0; test "$TEMP" && rm -rf "$TEMP"; exit 1' 1 2 3 9 15 trap 'test "$TEMP" && rm -rf "$TEMP"' 0 fi TEMP=`mktemp -d -q -t $NAME-XXXXXXXX` if test -z "$TEMP" -o ! -d "$TEMP"; then echo Cannot create temporary directory 1>&2 exit 1 fi WRITETEST="$PARENTDIR"/$SUBDIR/write-test-`basename $TEMP` if touch "$WRITETEST" 2> /dev/null; then rm -f "$WRITETEST" else echo Cannot write in directory $PARENTDIR/$SUBDIR 1>&2 exit 1 fi set -e cat > $TEMP/all < /dev/null; then echo $1 else case "$1" in all ) cat $TEMP/all ;; minimal ) echo egm96; echo wgs84 ;; * ) echo Unknown $MODEL $1 1>&2 exit 1 ;; esac fi shift done > $TEMP/list sort -u $TEMP/list > $TEMP/todo while read file; do if test -z "$FORCE" -a -s $PARENTDIR/$SUBDIR/$file.$EXT; then echo $PARENTDIR/$SUBDIR/$file.$EXT already installed, skipping $file... echo $file >> $TEMP/skip continue fi echo download $file.tar.bz2 ... echo $file >> $TEMP/download URL="http://downloads.sourceforge.net/project/geographiclib/$SUBDIR-distrib/$file.tar.bz2?use_mirror=autoselect" ARCHIVE=$TEMP/$file.tar.bz2 wget -O$ARCHIVE $URL echo unpack $file.tar.bz2 ... tar vxojf $ARCHIVE -C $PARENTDIR echo $MODEL $file installed. done < $TEMP/todo if test "$DEBUG"; then echo Saving temporary directory $TEMP fi echo if test -s $TEMP/download; then n=`wc -l < $TEMP/download` s=; test $n -gt 1 && s=s cat < and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "Gravity.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool verbose = false, longfirst = false; std::string dir; std::string model = GravityModel::DefaultGravityName(); std::string istring, ifile, ofile, cdelim; char lsep = ';'; real lat = 0, h = 0; bool circle = false; int prec = -1; enum { GRAVITY = 0, DISTURBANCE = 1, ANOMALY = 2, UNDULATION = 3, }; unsigned mode = GRAVITY; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-n") { if (++m == argc) return usage(1, true); model = argv[m]; } else if (arg == "-d") { if (++m == argc) return usage(1, true); dir = argv[m]; } else if (arg == "-G") mode = GRAVITY; else if (arg == "-D") mode = DISTURBANCE; else if (arg == "-A") mode = ANOMALY; else if (arg == "-H") mode = UNDULATION; else if (arg == "-c") { if (m + 2 >= argc) return usage(1, true); try { using std::abs; DMS::flag ind; lat = DMS::Decode(std::string(argv[++m]), ind); if (ind == DMS::LONGITUDE) throw GeographicErr("Bad hemisphere letter on latitude"); if (!(abs(lat) <= 90)) throw GeographicErr("Latitude not in [-90d, 90d]"); h = Utility::num(std::string(argv[++m])); circle = true; } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-w") longfirst = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-v") verbose = true; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else { int retval = usage(!(arg == "-h" || arg == "--help"), arg != "--help"); if (arg == "-h") std::cout<< "\nDefault gravity path = \"" << GravityModel::DefaultGravityPath() << "\"\nDefault gravity name = \"" << GravityModel::DefaultGravityName() << "\"\n"; return retval; } } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; switch (mode) { case GRAVITY: prec = std::min(16 + Math::extra_digits(), prec < 0 ? 5 : prec); break; case DISTURBANCE: case ANOMALY: prec = std::min(14 + Math::extra_digits(), prec < 0 ? 3 : prec); break; case UNDULATION: default: prec = std::min(12 + Math::extra_digits(), prec < 0 ? 4 : prec); break; } int retval = 0; try { const GravityModel g(model, dir); if (circle) { if (!Math::isfinite(h)) throw GeographicErr("Bad height"); else if (mode == UNDULATION && h != 0) throw GeographicErr("Height should be zero for geoid undulations"); } if (verbose) { std::cerr << "Gravity file: " << g.GravityFile() << "\n" << "Name: " << g.GravityModelName() << "\n" << "Description: " << g.Description() << "\n" << "Date & Time: " << g.DateTime() << "\n"; } unsigned mask = (mode == GRAVITY ? GravityModel::GRAVITY : (mode == DISTURBANCE ? GravityModel::DISTURBANCE : (mode == ANOMALY ? GravityModel::SPHERICAL_ANOMALY : GravityModel::GEOID_HEIGHT))); // mode == UNDULATION const GravityCircle c(circle ? g.Circle(lat, h, mask) : GravityCircle()); std::string s, eol, stra, strb; std::istringstream str; while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } str.clear(); str.str(s); real lon; if (circle) { if (!(str >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::flag ind; lon = DMS::Decode(strb, ind); if (ind == DMS::LATITUDE) throw GeographicErr("Bad hemisphere letter on " + strb); } else { if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); h = 0; if (!(str >> h)) // h is optional str.clear(); if (mode == UNDULATION && h != 0) throw GeographicErr("Height must be zero for geoid heights"); } if (str >> stra) throw GeographicErr("Extra junk in input: " + s); switch (mode) { case GRAVITY: { real gx, gy, gz; if (circle) { c.Gravity(lon, gx, gy, gz); } else { g.Gravity(lat, lon, h, gx, gy, gz); } *output << Utility::str(gx, prec) << " " << Utility::str(gy, prec) << " " << Utility::str(gz, prec) << eol; } break; case DISTURBANCE: { real deltax, deltay, deltaz; if (circle) { c.Disturbance(lon, deltax, deltay, deltaz); } else { g.Disturbance(lat, lon, h, deltax, deltay, deltaz); } // Convert to mGals *output << Utility::str(deltax * 1e5, prec) << " " << Utility::str(deltay * 1e5, prec) << " " << Utility::str(deltaz * 1e5, prec) << eol; } break; case ANOMALY: { real Dg01, xi, eta; if (circle) c.SphericalAnomaly(lon, Dg01, xi, eta); else g.SphericalAnomaly(lat, lon, h, Dg01, xi, eta); Dg01 *= 1e5; // Convert to mGals xi *= 3600; // Convert to arcsecs eta *= 3600; *output << Utility::str(Dg01, prec) << " " << Utility::str(xi, prec) << " " << Utility::str(eta, prec) << eol; } break; case UNDULATION: default: { real N = circle ? c.GeoidHeight(lon) : g.GeoidHeight(lat, lon); *output << Utility::str(N, prec) << eol; } break; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } } catch (const std::exception& e) { std::cerr << "Error reading " << model << ": " << e.what() << "\n"; retval = 1; } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/Makefile.in0000644000771000077100000010357712602735152017245 0ustar ckarneyckarney# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ # # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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@ target_triplet = @target@ bin_PROGRAMS = CartConvert$(EXEEXT) ConicProj$(EXEEXT) \ GeoConvert$(EXEEXT) GeodSolve$(EXEEXT) GeodesicProj$(EXEEXT) \ GeoidEval$(EXEEXT) Gravity$(EXEEXT) MagneticField$(EXEEXT) \ Planimeter$(EXEEXT) RhumbSolve$(EXEEXT) \ TransverseMercatorProj$(EXEEXT) subdir = tools DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(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)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" PROGRAMS = $(bin_PROGRAMS) am_CartConvert_OBJECTS = CartConvert.$(OBJEXT) CartConvert_OBJECTS = $(am_CartConvert_OBJECTS) CartConvert_LDADD = $(LDADD) CartConvert_DEPENDENCIES = $(top_builddir)/src/libGeographic.la 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 = am_ConicProj_OBJECTS = ConicProj.$(OBJEXT) ConicProj_OBJECTS = $(am_ConicProj_OBJECTS) ConicProj_LDADD = $(LDADD) ConicProj_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_GeoConvert_OBJECTS = GeoConvert.$(OBJEXT) GeoConvert_OBJECTS = $(am_GeoConvert_OBJECTS) GeoConvert_LDADD = $(LDADD) GeoConvert_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_GeodSolve_OBJECTS = GeodSolve.$(OBJEXT) GeodSolve_OBJECTS = $(am_GeodSolve_OBJECTS) GeodSolve_LDADD = $(LDADD) GeodSolve_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_GeodesicProj_OBJECTS = GeodesicProj.$(OBJEXT) GeodesicProj_OBJECTS = $(am_GeodesicProj_OBJECTS) GeodesicProj_LDADD = $(LDADD) GeodesicProj_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_GeoidEval_OBJECTS = GeoidEval.$(OBJEXT) GeoidEval_OBJECTS = $(am_GeoidEval_OBJECTS) GeoidEval_LDADD = $(LDADD) GeoidEval_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_Gravity_OBJECTS = Gravity.$(OBJEXT) Gravity_OBJECTS = $(am_Gravity_OBJECTS) Gravity_LDADD = $(LDADD) Gravity_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_MagneticField_OBJECTS = MagneticField.$(OBJEXT) MagneticField_OBJECTS = $(am_MagneticField_OBJECTS) MagneticField_LDADD = $(LDADD) MagneticField_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_Planimeter_OBJECTS = Planimeter.$(OBJEXT) Planimeter_OBJECTS = $(am_Planimeter_OBJECTS) Planimeter_LDADD = $(LDADD) Planimeter_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_RhumbSolve_OBJECTS = RhumbSolve.$(OBJEXT) RhumbSolve_OBJECTS = $(am_RhumbSolve_OBJECTS) RhumbSolve_LDADD = $(LDADD) RhumbSolve_DEPENDENCIES = $(top_builddir)/src/libGeographic.la am_TransverseMercatorProj_OBJECTS = TransverseMercatorProj.$(OBJEXT) TransverseMercatorProj_OBJECTS = $(am_TransverseMercatorProj_OBJECTS) TransverseMercatorProj_LDADD = $(LDADD) TransverseMercatorProj_DEPENDENCIES = \ $(top_builddir)/src/libGeographic.la 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; }; \ } SCRIPTS = $(sbin_SCRIPTS) 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@ -I$(top_builddir)/include/GeographicLib depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f 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 = 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 = SOURCES = $(CartConvert_SOURCES) $(ConicProj_SOURCES) \ $(GeoConvert_SOURCES) $(GeodSolve_SOURCES) \ $(GeodesicProj_SOURCES) $(GeoidEval_SOURCES) \ $(Gravity_SOURCES) $(MagneticField_SOURCES) \ $(Planimeter_SOURCES) $(RhumbSolve_SOURCES) \ $(TransverseMercatorProj_SOURCES) DIST_SOURCES = $(CartConvert_SOURCES) $(ConicProj_SOURCES) \ $(GeoConvert_SOURCES) $(GeodSolve_SOURCES) \ $(GeodesicProj_SOURCES) $(GeoidEval_SOURCES) \ $(Gravity_SOURCES) $(MagneticField_SOURCES) \ $(Planimeter_SOURCES) $(RhumbSolve_SOURCES) \ $(TransverseMercatorProj_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 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@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ 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@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/man -I$(top_srcdir)/man -Wall -Wextra LDADD = $(top_builddir)/src/libGeographic.la DEPS = $(top_builddir)/src/libGeographic.la CartConvert_SOURCES = CartConvert.cpp \ ../man/CartConvert.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/LocalCartesian.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp ConicProj_SOURCES = ConicProj.cpp \ ../man/ConicProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/AlbersEqualArea.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/LambertConformalConic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeoConvert_SOURCES = GeoConvert.cpp \ ../man/GeoConvert.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp GeodSolve_SOURCES = GeodSolve.cpp \ ../man/GeodSolve.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicExact.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/GeodesicLineExact.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeodesicProj_SOURCES = GeodesicProj.cpp \ ../man/GeodesicProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/AzimuthalEquidistant.hpp \ ../include/GeographicLib/CassiniSoldner.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/Gnomonic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp GeoidEval_SOURCES = GeoidEval.cpp \ ../man/GeoidEval.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geoid.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp Gravity_SOURCES = Gravity.cpp \ ../man/Gravity.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/GravityCircle.hpp \ ../include/GeographicLib/GravityModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/NormalGravity.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/SphericalHarmonic1.hpp \ ../include/GeographicLib/Utility.hpp MagneticField_SOURCES = MagneticField.cpp \ ../man/MagneticField.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/CircularEngine.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/MagneticCircle.hpp \ ../include/GeographicLib/MagneticModel.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/SphericalEngine.hpp \ ../include/GeographicLib/SphericalHarmonic.hpp \ ../include/GeographicLib/Utility.hpp Planimeter_SOURCES = Planimeter.cpp \ ../man/Planimeter.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Accumulator.hpp \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Ellipsoid.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/PolygonArea.hpp \ ../include/GeographicLib/UTMUPS.hpp \ ../include/GeographicLib/Utility.hpp RhumbSolve_SOURCES = RhumbSolve.cpp \ ../man/RhumbSolve.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Ellipsoid.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/Utility.hpp TransverseMercatorProj_SOURCES = TransverseMercatorProj.cpp \ ../man/TransverseMercatorProj.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/EllipticFunction.hpp \ ../include/GeographicLib/Math.hpp \ ../include/GeographicLib/TransverseMercator.hpp \ ../include/GeographicLib/TransverseMercatorExact.hpp \ ../include/GeographicLib/Utility.hpp sbin_SCRIPTS = geographiclib-get-geoids \ geographiclib-get-gravity \ geographiclib-get-magnetic geographiclib_data = $(datadir)/GeographicLib CLEANFILES = $(sbin_SCRIPTS) EXTRA_DIST = Makefile.mk CMakeLists.txt tests.cmake \ geographiclib-get-geoids.sh geographiclib-get-gravity.sh \ geographiclib-get-magnetic.sh all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 tools/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tools/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): 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 CartConvert$(EXEEXT): $(CartConvert_OBJECTS) $(CartConvert_DEPENDENCIES) $(EXTRA_CartConvert_DEPENDENCIES) @rm -f CartConvert$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(CartConvert_OBJECTS) $(CartConvert_LDADD) $(LIBS) ConicProj$(EXEEXT): $(ConicProj_OBJECTS) $(ConicProj_DEPENDENCIES) $(EXTRA_ConicProj_DEPENDENCIES) @rm -f ConicProj$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(ConicProj_OBJECTS) $(ConicProj_LDADD) $(LIBS) GeoConvert$(EXEEXT): $(GeoConvert_OBJECTS) $(GeoConvert_DEPENDENCIES) $(EXTRA_GeoConvert_DEPENDENCIES) @rm -f GeoConvert$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(GeoConvert_OBJECTS) $(GeoConvert_LDADD) $(LIBS) GeodSolve$(EXEEXT): $(GeodSolve_OBJECTS) $(GeodSolve_DEPENDENCIES) $(EXTRA_GeodSolve_DEPENDENCIES) @rm -f GeodSolve$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(GeodSolve_OBJECTS) $(GeodSolve_LDADD) $(LIBS) GeodesicProj$(EXEEXT): $(GeodesicProj_OBJECTS) $(GeodesicProj_DEPENDENCIES) $(EXTRA_GeodesicProj_DEPENDENCIES) @rm -f GeodesicProj$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(GeodesicProj_OBJECTS) $(GeodesicProj_LDADD) $(LIBS) GeoidEval$(EXEEXT): $(GeoidEval_OBJECTS) $(GeoidEval_DEPENDENCIES) $(EXTRA_GeoidEval_DEPENDENCIES) @rm -f GeoidEval$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(GeoidEval_OBJECTS) $(GeoidEval_LDADD) $(LIBS) Gravity$(EXEEXT): $(Gravity_OBJECTS) $(Gravity_DEPENDENCIES) $(EXTRA_Gravity_DEPENDENCIES) @rm -f Gravity$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(Gravity_OBJECTS) $(Gravity_LDADD) $(LIBS) MagneticField$(EXEEXT): $(MagneticField_OBJECTS) $(MagneticField_DEPENDENCIES) $(EXTRA_MagneticField_DEPENDENCIES) @rm -f MagneticField$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(MagneticField_OBJECTS) $(MagneticField_LDADD) $(LIBS) Planimeter$(EXEEXT): $(Planimeter_OBJECTS) $(Planimeter_DEPENDENCIES) $(EXTRA_Planimeter_DEPENDENCIES) @rm -f Planimeter$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(Planimeter_OBJECTS) $(Planimeter_LDADD) $(LIBS) RhumbSolve$(EXEEXT): $(RhumbSolve_OBJECTS) $(RhumbSolve_DEPENDENCIES) $(EXTRA_RhumbSolve_DEPENDENCIES) @rm -f RhumbSolve$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(RhumbSolve_OBJECTS) $(RhumbSolve_LDADD) $(LIBS) TransverseMercatorProj$(EXEEXT): $(TransverseMercatorProj_OBJECTS) $(TransverseMercatorProj_DEPENDENCIES) $(EXTRA_TransverseMercatorProj_DEPENDENCIES) @rm -f TransverseMercatorProj$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(TransverseMercatorProj_OBJECTS) $(TransverseMercatorProj_LDADD) $(LIBS) install-sbinSCRIPTS: $(sbin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | 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; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$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_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CartConvert.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConicProj.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoConvert.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodSolve.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodesicProj.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoidEval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Gravity.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MagneticField.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Planimeter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RhumbSolve.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransverseMercatorProj.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 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 distdir: $(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 check: check-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"; 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: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-sbinSCRIPTS 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 -rf ./$(DEPDIR) -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-sbinSCRIPTS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ 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-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sbinSCRIPTS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-sbinSCRIPTS geographiclib-get-geoids: geographiclib-get-geoids.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-gravity: geographiclib-get-gravity.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-magnetic: geographiclib-get-magnetic.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ # 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: GeographicLib-1.45/tools/tests.cmake0000644000771000077100000006212112602735126017332 0ustar ckarneyckarney# Here are the tests for GeographicLib # First turn on testing enable_testing () # The tests consist of calling the various tools with --input-string and # matching the output against regular expressions. add_test (NAME GeoConvert0 COMMAND GeoConvert -p -3 -m --input-string "33.3 44.4") set_tests_properties (GeoConvert0 PROPERTIES PASS_REGULAR_EXPRESSION "38SMB4484") # I/O for boost-quadmath has a bug where precision 0 is interpreted as # printed all the digits of the number (instead of printing the integer # portion). Problem reported on 2014-06-07: # https://svn.boost.org/trac/boost/ticket/10103. GeographicLib 1.42 # includes a workaround for this bug. add_test (NAME GeoConvert1 COMMAND GeoConvert -d --input-string "38smb") set_tests_properties (GeoConvert1 PROPERTIES PASS_REGULAR_EXPRESSION "32d59'14\\.1\"N 044d27'53\\.4\"E") add_test (NAME GeoConvert2 COMMAND GeoConvert -p -2 --input-string "30d30'30\" 30.50833") set_tests_properties (GeoConvert2 PROPERTIES PASS_REGULAR_EXPRESSION "30\\.508 30\\.508") add_test (NAME GeoConvert3 COMMAND GeoConvert --junk) set_tests_properties (GeoConvert3 PROPERTIES WILL_FAIL ON) add_test (NAME GeoConvert4 COMMAND GeoConvert --input-string garbage) set_tests_properties (GeoConvert4 PROPERTIES WILL_FAIL ON) # Check fix for DMS::Decode bug fixed on 2011-03-22 add_test (NAME GeoConvert5 COMMAND GeoConvert --input-string "5d. 0") set_tests_properties (GeoConvert5 PROPERTIES WILL_FAIL ON) if (NOT (MSVC AND MSVC_VERSION MATCHES "1[78]..")) # Check fix for DMS::Decode double rounding bug fixed on 2012-11-15 # This test is known to fail for VS 11 and 12 bug reported 2013-01-10 # http://connect.microsoft.com/VisualStudio/feedback/details/776287 # OK to skip this test for these compilers because this is a question # of accuracy of the least significant bit. The bug is fixed in VS 14. add_test (NAME GeoConvert6 COMMAND GeoConvert -p 9 --input-string "0 179.99999999999998578") set_tests_properties (GeoConvert6 PROPERTIES PASS_REGULAR_EXPRESSION "179\\.9999999999999[7-9]") endif () # This invokes MGRS::Check() add_test (NAME GeoConvert7 COMMAND GeoConvert --version) # Check fix to PolarStereographic es initialization blunder (2015-05-18) add_test (NAME GeoConvert8 COMMAND GeoConvert -u -p 6 --input-string "86 0") set_tests_properties (GeoConvert8 PROPERTIES PASS_REGULAR_EXPRESSION "n 2000000\\.0* 1555731\\.570643") # Check that integer(minutes) >= 60 and decimal(minutes) > 60 fail. # Latter used to succeed; fixed 2015-06-11. add_test (NAME GeoConvert9 COMMAND GeoConvert --input-string "5d70.0 10") add_test (NAME GeoConvert10 COMMAND GeoConvert --input-string "5d60 10") set_tests_properties (GeoConvert9 GeoConvert10 PROPERTIES WILL_FAIL ON) # Check that integer(minutes) < 60 and decimal(minutes) <= 60 succeed. # Latter used to fail with 60.; fixed 2015-06-11. add_test (NAME GeoConvert11 COMMAND GeoConvert --input-string "5d59 10") add_test (NAME GeoConvert12 COMMAND GeoConvert --input-string "5d60. 10") add_test (NAME GeoConvert13 COMMAND GeoConvert --input-string "5d60.0 10") # Check DMS::Encode does round ties to even. Fixed 2015-06-11. add_test (NAME GeoConvert14 COMMAND GeoConvert -: -p -4 --input-string "5.25 5.75") set_tests_properties (GeoConvert14 PROPERTIES PASS_REGULAR_EXPRESSION "05.2N 005.8E") add_test (NAME GeoConvert15 COMMAND GeoConvert -: -p -1 --input-string "5.03125 5.09375") set_tests_properties (GeoConvert15 PROPERTIES PASS_REGULAR_EXPRESSION "05:01:52N 005:05:38E") # Check MGRS::Forward improved rounding fix, 2015-07-22 add_test (NAME GeoConvert16 COMMAND GeoConvert -m -p 3 --input-string "38n 444140.6 3684706.3") set_tests_properties (GeoConvert16 PROPERTIES PASS_REGULAR_EXPRESSION "38SMB4414060084706300") # Check MGRS::Forward digit consistency fix, 2015-07-23 add_test (NAME GeoConvert17 COMMAND GeoConvert -m -p 3 --input-string "38n 500000 63.811") add_test (NAME GeoConvert18 COMMAND GeoConvert -m -p 4 --input-string "38n 500000 63.811") set_tests_properties (GeoConvert17 PROPERTIES PASS_REGULAR_EXPRESSION "38NNF0000000000063811") set_tests_properties (GeoConvert18 PROPERTIES PASS_REGULAR_EXPRESSION "38NNF000000000000638110") add_test (NAME GeodSolve0 COMMAND GeodSolve -i -p 0 --input-string "40.6 -73.8 49d01'N 2d33'E") set_tests_properties (GeodSolve0 PROPERTIES PASS_REGULAR_EXPRESSION "53\\.47022 111\\.59367 5853226") add_test (NAME GeodSolve1 COMMAND GeodSolve -p 0 --input-string "40d38'23\"N 073d46'44\"W 53d30' 5850e3") set_tests_properties (GeodSolve1 PROPERTIES PASS_REGULAR_EXPRESSION "49\\.01467 2\\.56106 111\\.62947") # Check fix for antipodal prolate bug found 2010-09-04 add_test (NAME GeodSolve2 COMMAND GeodSolve -i -p 0 -e 6.4e6 -1/150 --input-string "0.07476 0 -0.07476 180") set_tests_properties (GeodSolve2 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00078 90\\.00078 20106193") # Another check for similar bug add_test (NAME GeodSolve3 COMMAND GeodSolve -i -p 0 -e 6.4e6 -1/150 --input-string "0.1 0 -0.1 180") set_tests_properties (GeodSolve3 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00105 90\\.00105 20106193") # Check fix for short line bug found 2010-05-21 add_test (NAME GeodSolve4 COMMAND GeodSolve -i --input-string "36.493349428792 0 36.49334942879201 .0000008") set_tests_properties (GeodSolve4 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 0\\.072") # Check fix for point2=pole bug found 2010-05-03 (but only with long double) add_test (NAME GeodSolve5 COMMAND GeodSolve -p 0 --input-string "0.01777745589997 30 0 10e6") set_tests_properties (GeodSolve5 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 -150\\.00000 -180\\.00000;90\\.00000 30\\.00000 0\\.00000") # Check fix for volatile sbet12a bug found 2011-06-25 (gcc 4.4.4 x86 -O3) # Found again on 2012-03-27 with tdm-mingw32 (g++ 4.6.1). add_test (NAME GeodSolve6 COMMAND GeodSolve -i --input-string "88.202499451857 0 -88.202499451857 179.981022032992859592") add_test (NAME GeodSolve7 COMMAND GeodSolve -i --input-string "89.262080389218 0 -89.262080389218 179.992207982775375662") add_test (NAME GeodSolve8 COMMAND GeodSolve -i --input-string "89.333123580033 0 -89.333123580032997687 179.99295812360148422") set_tests_properties (GeodSolve6 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 20003898.214") set_tests_properties (GeodSolve7 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 20003925.854") set_tests_properties (GeodSolve8 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 20003926.881") # Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) add_test (NAME GeodSolve9 COMMAND GeodSolve -i --input-string "56.320923501171 0 -56.320923501171 179.664747671772880215") set_tests_properties (GeodSolve9 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 19993558.287") # Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio 10 rel + debug) add_test (NAME GeodSolve10 COMMAND GeodSolve -i --input-string "52.784459512564 0 -52.784459512563990912 179.634407464943777557") set_tests_properties (GeodSolve10 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 19991596.095") # Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio 10 rel + debug) add_test (NAME GeodSolve11 COMMAND GeodSolve -i --input-string "48.522876735459 0 -48.52287673545898293 179.599720456223079643") set_tests_properties (GeodSolve11 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 19989144.774") # Check fix for inverse geodesics on extreme prolate/oblate ellipsoids # Reported 2012-08-29 Stefan Guenther ; fixed 2012-10-07 add_test (NAME GeodSolve12 COMMAND GeodSolve -i -e 89.8 -1.83 -p 1 --input-string "0 0 -10 160") add_test (NAME GeodSolve13 COMMAND GeodSolve -i -e 89.8 -1.83 -p 1 --input-string "0 0 -10 160" -E) set_tests_properties (GeodSolve12 GeodSolve13 PROPERTIES PASS_REGULAR_EXPRESSION "120\\.27.* 105\\.15.* 266\\.7") if (NOT GEOGRAPHICLIB_PRECISION EQUAL 4) # mpfr (nan == 0 is true) and boost-quadmath (nan > 0 is true) have # bugs in handling nans, so skip this test. Problems reported on # 2015-03-31, https://svn.boost.org/trac/boost/ticket/11159. MFPR C++ # version 3.6.2 fixes its nan problem. # # Check fix for inverse ignoring lon12 = nan add_test (NAME GeodSolve14 COMMAND GeodSolve -i --input-string "0 0 1 nan") set_tests_properties (GeodSolve14 PROPERTIES PASS_REGULAR_EXPRESSION "nan nan nan") endif() # Initial implementation of Math::eatanhe was wrong for e^2 < 0. This # checks that this is fixed. add_test (NAME GeodSolve15 COMMAND GeodSolve -e 6.4e6 -1/150 -f --input-string "1 2 3 4") add_test (NAME GeodSolve16 COMMAND GeodSolve -e 6.4e6 -1/150 -f --input-string "1 2 3 4" -E) set_tests_properties (GeodSolve15 GeodSolve16 PROPERTIES PASS_REGULAR_EXPRESSION "1\\..* 2\\..* 3\\..* 1\\..* 2\\..* 3\\..* 4\\..* 0\\..* 4\\..* 1\\..* 1\\..* 23700") # Check fix for LONG_UNROLL bug found on 2015-05-07 add_test (NAME GeodSolve17 COMMAND GeodSolve -u --input-string "40 -75 -10 2e7") add_test (NAME GeodSolve18 COMMAND GeodSolve -u --input-string "40 -75 -10 2e7" -E) add_test (NAME GeodSolve19 COMMAND GeodSolve -u -l 40 -75 -10 --input-string "2e7") add_test (NAME GeodSolve20 COMMAND GeodSolve -u -l 40 -75 -10 --input-string "2e7" -E) set_tests_properties (GeodSolve17 GeodSolve18 GeodSolve19 GeodSolve20 PROPERTIES PASS_REGULAR_EXPRESSION "-39\\.[0-9]* -254\\.[0-9]* -170\\.[0-9]*") add_test (NAME GeodSolve21 COMMAND GeodSolve --input-string "40 -75 -10 2e7") add_test (NAME GeodSolve22 COMMAND GeodSolve --input-string "40 -75 -10 2e7" -E) add_test (NAME GeodSolve23 COMMAND GeodSolve -l 40 -75 -10 --input-string "2e7") add_test (NAME GeodSolve24 COMMAND GeodSolve -l 40 -75 -10 --input-string "2e7" -E) set_tests_properties (GeodSolve21 GeodSolve22 GeodSolve23 GeodSolve24 PROPERTIES PASS_REGULAR_EXPRESSION "-39\\.[0-9]* 105\\.[0-9]* -170\\.[0-9]*") # Check fix for inaccurate rounding in DMS::Decode, e.g., verify that # 7:33:36 = 7.56; fixed on 2015-06-11. add_test (NAME GeodSolve25 COMMAND GeodSolve -p 6 --input-string "0 0 7:33:36-7.56 10001965") set_tests_properties (GeodSolve25 PROPERTIES PASS_REGULAR_EXPRESSION "89\\.9[0-9]* 0\\.00000000000 0\\.00000000000") # Check 0/0 problem with area calculation on sphere 2015-09-08 add_test (NAME GeodSolve26 COMMAND GeodSolve -i -f -e 6.4e6 0 --input-string "1 2 3 4") add_test (NAME GeodSolve27 COMMAND GeodSolve -i -f -e 6.4e6 0 --input-string "1 2 3 4" -E) set_tests_properties (GeodSolve26 GeodSolve27 PROPERTIES PASS_REGULAR_EXPRESSION " 49911046115") # Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in # Java implementation fixed on 2015-05-19). add_test (NAME GeodSolve28 COMMAND GeodSolve -f -e 6.4e6 0.1 -p 3 --input-string "1 2 10 5e6") set_tests_properties (GeodSolve28 PROPERTIES PASS_REGULAR_EXPRESSION " 48.55570690 ") # Check longitude unrolling with inverse calculation 2015-09-16 add_test (NAME GeodSolve29 COMMAND GeodSolve -i -f -p 0 --input-string "0 539 0 181") add_test (NAME GeodSolve30 COMMAND GeodSolve -i -f -p 0 --input-string "0 539 0 181" -E) set_tests_properties (GeodSolve29 GeodSolve30 PROPERTIES PASS_REGULAR_EXPRESSION "0\\..* 179\\..* 90\\..* 0\\..* -179\\..* 90\\..* 222639 ") add_test (NAME GeodSolve31 COMMAND GeodSolve -i -f -p 0 --input-string "0 539 0 181" -u) add_test (NAME GeodSolve32 COMMAND GeodSolve -i -f -p 0 --input-string "0 539 0 181" -u -E) set_tests_properties (GeodSolve31 GeodSolve32 PROPERTIES PASS_REGULAR_EXPRESSION "0\\..* 539\\..* 90\\..* 0\\..* 541\\..* 90\\..* 222639 ") # Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- # sind(-0.0) = +0.0 -- and in some version of Visual Studio -- # fmod(-0.0, 360.0) = +0.0. add_test (NAME GeodSolve33 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179") add_test (NAME GeodSolve34 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -E) add_test (NAME GeodSolve35 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179.5") add_test (NAME GeodSolve36 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179.5" -E) add_test (NAME GeodSolve37 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180") add_test (NAME GeodSolve38 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -E) add_test (NAME GeodSolve39 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180") add_test (NAME GeodSolve40 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -E) add_test (NAME GeodSolve41 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -e 6.4e6 0) add_test (NAME GeodSolve42 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -e 6.4e6 0 -E) add_test (NAME GeodSolve43 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -e 6.4e6 0) add_test (NAME GeodSolve44 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -e 6.4e6 0 -E) add_test (NAME GeodSolve45 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -e 6.4e6 0) add_test (NAME GeodSolve46 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -e 6.4e6 0 -E) add_test (NAME GeodSolve47 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -e 6.4e6 -1/300) add_test (NAME GeodSolve48 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -e 6.4e6 -1/300 -E) add_test (NAME GeodSolve49 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -e 6.4e6 -1/300) add_test (NAME GeodSolve50 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -e 6.4e6 -1/300 -E) add_test (NAME GeodSolve51 COMMAND GeodSolve -i -p 0 --input-string "0 0 0.5 180" -e 6.4e6 -1/300) add_test (NAME GeodSolve52 COMMAND GeodSolve -i -p 0 --input-string "0 0 0.5 180" -e 6.4e6 -1/300 -E) add_test (NAME GeodSolve53 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -e 6.4e6 -1/300) add_test (NAME GeodSolve54 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -e 6.4e6 -1/300 -E) set_tests_properties (GeodSolve33 GeodSolve34 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 19926189") set_tests_properties (GeodSolve35 GeodSolve36 PROPERTIES PASS_REGULAR_EXPRESSION "55\\.96650 124\\.03350 19980862") set_tests_properties (GeodSolve37 GeodSolve38 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 20003931") set_tests_properties (GeodSolve39 GeodSolve40 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 19893357") set_tests_properties (GeodSolve41 GeodSolve42 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 19994492") set_tests_properties (GeodSolve43 GeodSolve44 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 20106193") set_tests_properties (GeodSolve45 GeodSolve46 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 19994492") set_tests_properties (GeodSolve47 GeodSolve48 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 19994492") set_tests_properties (GeodSolve49 GeodSolve50 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 20106193") set_tests_properties (GeodSolve51 GeodSolve52 PROPERTIES PASS_REGULAR_EXPRESSION "33\\.02493 146\\.97364 20082617") set_tests_properties (GeodSolve53 GeodSolve54 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 20027270") # Check fix for nan + point on equator or pole not returning all nans in # Geodesic::Inverse, found 2015-09-23. add_test (NAME GeodSolve55 COMMAND GeodSolve -i --input-string "nan 0 0 90") add_test (NAME GeodSolve56 COMMAND GeodSolve -i --input-string "nan 0 0 90" -E) add_test (NAME GeodSolve57 COMMAND GeodSolve -i --input-string "nan 0 90 9") add_test (NAME GeodSolve58 COMMAND GeodSolve -i --input-string "nan 0 90 9" -E) set_tests_properties (GeodSolve55 GeodSolve56 GeodSolve57 GeodSolve58 PROPERTIES PASS_REGULAR_EXPRESSION "nan nan nan") # Check fix for pole-encircling bug found 2011-03-16 add_test (NAME Planimeter0 COMMAND Planimeter --input-string "89 0;89 90;89 180;89 270") add_test (NAME Planimeter1 COMMAND Planimeter -r --input-string "-89 0;-89 90;-89 180;-89 270") add_test (NAME Planimeter2 COMMAND Planimeter --input-string "0 -1;-1 0;0 1;1 0") add_test (NAME Planimeter3 COMMAND Planimeter --input-string "90 0; 0 0; 0 90") add_test (NAME Planimeter4 COMMAND Planimeter -l --input-string "90 0; 0 0; 0 90") set_tests_properties (Planimeter0 Planimeter1 PROPERTIES PASS_REGULAR_EXPRESSION "4 631819\\.8745[0-9]+ 2495230567[78]\\.[0-9]+") set_tests_properties (Planimeter2 PROPERTIES PASS_REGULAR_EXPRESSION "4 627598\\.2731[0-9]+ 24619419146.[0-9]+") set_tests_properties (Planimeter3 PROPERTIES PASS_REGULAR_EXPRESSION "3 30022685\\.[0-9]+ 63758202715511\\.[0-9]+") set_tests_properties (Planimeter4 PROPERTIES PASS_REGULAR_EXPRESSION "3 20020719\\.[0-9]+") # Check fix for Planimeter pole crossing bug found 2011-06-24 add_test (NAME Planimeter5 COMMAND Planimeter --input-string "89,0.1;89,90.1;89,-179.9") set_tests_properties (Planimeter5 PROPERTIES PASS_REGULAR_EXPRESSION "3 539297\\.[0-9]+ 1247615283[89]\\.[0-9]+") # Check fix for Planimeter lon12 rounding bug found 2012-12-03 add_test (NAME Planimeter6 COMMAND Planimeter -p 8 --input-string "9 -0.00000000000001;9 180;9 0") add_test (NAME Planimeter7 COMMAND Planimeter -p 8 --input-string "9 0.00000000000001;9 0;9 180") add_test (NAME Planimeter8 COMMAND Planimeter -p 8 --input-string "9 0.00000000000001;9 180;9 0") add_test (NAME Planimeter9 COMMAND Planimeter -p 8 --input-string "9 -0.00000000000001;9 0;9 180") set_tests_properties (Planimeter6 Planimeter7 Planimeter8 Planimeter9 PROPERTIES PASS_REGULAR_EXPRESSION "3 36026861\\.[0-9]+ -?0.0[0-9]+") # Area of Wyoming add_test (NAME Planimeter10 COMMAND Planimeter -R --input-string "41N 111:3W; 41N 104:3W; 45N 104:3W; 45N 111:3W") set_tests_properties (Planimeter10 PROPERTIES PASS_REGULAR_EXPRESSION "4 2029616\\.[0-9]+ 2535883763..\\.") # Area of arctic circle add_test (NAME Planimeter11 COMMAND Planimeter -R --input-string "66:33:44 0; 66:33:44 180") set_tests_properties (Planimeter11 PROPERTIES PASS_REGULAR_EXPRESSION "2 15985058\\.[0-9]+ 212084182523..\\.") add_test (NAME Planimeter12 COMMAND Planimeter --input-string "66:33:44 0; 66:33:44 180") set_tests_properties (Planimeter12 PROPERTIES PASS_REGULAR_EXPRESSION "2 10465729\\.[0-9]+ -?0.0") # Check encircling pole twice add_test (NAME Planimeter13 COMMAND Planimeter --input-string "89 -360; 89 -240; 89 -120; 89 0; 89 120; 89 240") set_tests_properties (Planimeter13 PROPERTIES PASS_REGULAR_EXPRESSION "6 1160741\\..* 32415230256\\.") # Check fix for AlbersEqualArea::Reverse bug found 2011-05-01 add_test (NAME ConicProj0 COMMAND ConicProj -a 40d58 39d56 -l 77d45W -r --input-string "220e3 -52e3") set_tests_properties (ConicProj0 PROPERTIES PASS_REGULAR_EXPRESSION "39\\.95[0-9]+ -75\\.17[0-9]+ 1\\.67[0-9]+ 0\\.99[0-9]+") # Check fix for AlbersEqualArea prolate bug found 2012-05-15 add_test (NAME ConicProj1 COMMAND ConicProj -a 0 0 -e 6.4e6 -0.5 -r --input-string "0 8605508") set_tests_properties (ConicProj1 PROPERTIES PASS_REGULAR_EXPRESSION "^85\\.00") # Check fix for LambertConformalConic::Forward bug found 2012-07-14 add_test (NAME ConicProj2 COMMAND ConicProj -c -30 -30 --input-string "-30 0") set_tests_properties (ConicProj2 PROPERTIES PASS_REGULAR_EXPRESSION "^-?0\\.0+ -?0\\.0+ -?0\\.0+ 1\\.0+") # Check fixes for LambertConformalConic::Reverse overflow bugs found 2012-07-14 add_test (NAME ConicProj3 COMMAND ConicProj -r -c 0 0 --input-string "1113195 -1e10") set_tests_properties (ConicProj3 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ 10\\.00[0-9]+ ") add_test (NAME ConicProj4 COMMAND ConicProj -r -c 0 0 --input-string "1113195 inf") set_tests_properties (ConicProj4 PROPERTIES PASS_REGULAR_EXPRESSION "^90\\.0+ 10\\.00[0-9]+ ") add_test (NAME ConicProj5 COMMAND ConicProj -r -c 45 45 --input-string "0 -1e100") set_tests_properties (ConicProj5 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ -?0\\.00[0-9]+ ") add_test (NAME ConicProj6 COMMAND ConicProj -r -c 45 45 --input-string "0 -inf") set_tests_properties (ConicProj6 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ -?0\\.00[0-9]+ ") add_test (NAME ConicProj7 COMMAND ConicProj -r -c 90 90 --input-string "0 -1e150") set_tests_properties (ConicProj7 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ -?0\\.00[0-9]+ ") add_test (NAME ConicProj8 COMMAND ConicProj -r -c 90 90 --input-string "0 -inf") set_tests_properties (ConicProj8 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ -?0\\.00[0-9]+ ") add_test (NAME CartConvert0 COMMAND CartConvert -e 6.4e6 1/100 -r --input-string "10e3 0 1e3") add_test (NAME CartConvert1 COMMAND CartConvert -e 6.4e6 -1/100 -r --input-string "1e3 0 10e3") set_tests_properties (CartConvert0 PROPERTIES PASS_REGULAR_EXPRESSION "85\\.57[0-9]+ 0\\.0[0]+ -6334614\\.[0-9]+") set_tests_properties (CartConvert1 PROPERTIES PASS_REGULAR_EXPRESSION "4\\.42[0-9]+ 0\\.0[0]+ -6398614\\.[0-9]+") # Test fix to bad meridian convergence at pole with # TransverseMercatorExact found 2013-06-26 add_test (NAME TransverseMercatorProj0 COMMAND TransverseMercatorProj -k 1 --input-string "90 75") set_tests_properties (TransverseMercatorProj0 PROPERTIES PASS_REGULAR_EXPRESSION "^0\\.0+ 10001965\\.7293[0-9]+ 75\\.0+ 1\\.0+") # Test fix to bad scale at pole with TransverseMercatorExact # found 2013-06-30 (quarter meridian = 10001965.7293127228128889202m) add_test (NAME TransverseMercatorProj1 COMMAND TransverseMercatorProj -k 1 -r --input-string "0 10001965.7293127228") set_tests_properties (TransverseMercatorProj1 PROPERTIES PASS_REGULAR_EXPRESSION "(90\\.0+ 0\\.0+ 0\\.0+|(90\\.0+|89\\.99999999999[0-9]+) -?180\\.0+ -?180\\.0+) (1\\.0000+|0\\.9999+)") # Test fix to bad handling of pole by RhumbSolve -i # Reported 2015-02-24 by Thomas Murray add_test (NAME RhumbSolve0 COMMAND RhumbSolve -p 3 -i --input-string "0 0 90 0") add_test (NAME RhumbSolve1 COMMAND RhumbSolve -p 3 -i --input-string "0 0 90 0" -s) set_tests_properties (RhumbSolve0 RhumbSolve1 PROPERTIES PASS_REGULAR_EXPRESSION "^0\\.0+ 10001965\\.729 ") # Test fix to CassiniSoldner::Forward bug found 2015-06-20 add_test (NAME GeodesicProj0 COMMAND GeodesicProj -c 0 0 -p 3 --input-string "90 80") set_tests_properties (GeodesicProj0 PROPERTIES PASS_REGULAR_EXPRESSION "^-?0\\.0+ [0-9]+\\.[0-9]+ 170\\.0+ ") if (EXISTS ${GEOGRAPHICLIB_DATA}/geoids/egm96-5.pgm) # Check fix for single-cell cache bug found 2010-11-23 add_test (NAME GeoidEval0 COMMAND GeoidEval -n egm96-5 --input-string "0d1 0d1;0d4 0d4") set_tests_properties (GeoidEval0 PROPERTIES PASS_REGULAR_EXPRESSION "^17\\.1[56]..\n17\\.1[45]..") endif () if (EXISTS ${GEOGRAPHICLIB_DATA}/magnetic/wmm2010.wmm) # Test case from WMM2010_Report.pdf, Sec 1.5, pp 14-15: # t = 2012.5, lat = -80, lon = 240, h = 100e3 add_test (NAME MagneticField0 COMMAND MagneticField -n wmm2010 -p 10 -r --input-string "2012.5 -80 240 100e3") add_test (NAME MagneticField1 COMMAND MagneticField -n wmm2010 -p 10 -r -t 2012.5 --input-string "-80 240 100e3") add_test (NAME MagneticField2 COMMAND MagneticField -n wmm2010 -p 10 -r -c 2012.5 -80 100e3 --input-string "240") # In third number, allow a final digit 5 (instead of correct 4) to # accommodate Visual Studio 12 and 14. The relative difference is # "only" 2e-15; on the other hand, this might be a lurking bug in # these compilers. (Visual Studio 10 and 11 are OK.) set_tests_properties (MagneticField0 MagneticField1 MagneticField2 PROPERTIES PASS_REGULAR_EXPRESSION " 5535\\.5249148687 14765\\.3703243050 -50625\\.930547879[45] .*\n.* 20\\.4904268023 1\\.0272592716 83\\.5313962281 ") endif () if (EXISTS ${GEOGRAPHICLIB_DATA}/magnetic/emm2015.wmm) # Tests from EMM2015_TEST_VALUES.txt including cases of linear # interpolation and extrapolation. add_test (NAME MagneticField3 COMMAND MagneticField -n emm2015 -r --input-string "2009.2 -85.9 -116.5 0") add_test (NAME MagneticField4 COMMAND MagneticField -n emm2015 -r -c 2009.2 -85.9 0 --input-string -116.5) add_test (NAME MagneticField5 COMMAND MagneticField -n emm2015 -r --input-string "2015.7 78.3 123.7 100e3") add_test (NAME MagneticField6 COMMAND MagneticField -n emm2015 -r -c 2015.7 78.3 100e3 --input-string 123.7) set_tests_properties (MagneticField3 MagneticField4 PROPERTIES PASS_REGULAR_EXPRESSION "79\\.70 -72\\.74 16532\\.1 2956\\.1 16265\\.7 -53210\\.7 55719\\.7\n-0\\.1. 0\\.0. 13\\.1 34\\.1 7\\.1 81\\.7 -74\\.1") set_tests_properties (MagneticField5 MagneticField6 PROPERTIES PASS_REGULAR_EXPRESSION "-8\\.73 86\\.82 3128\\.9 3092\\.6 -474\\.7 56338\\.9 56425\\.8\n-0\\.2. 0\\.0. -20\\.7 -22\\.3 -9\\.2 26\\.5 25\\.3") endif () if (EXISTS ${GEOGRAPHICLIB_DATA}/gravity/egm2008.egm) # Verify no overflow at poles with high degree model add_test (NAME Gravity0 COMMAND Gravity -n egm2008 -p 6 --input-string "90 110 0") set_tests_properties (Gravity0 PROPERTIES PASS_REGULAR_EXPRESSION "-0\\.000146 0\\.000078 -9\\.832294") # Check fix for invR bug in GravityCircle found by Mathieu Peyrega on # 2013-04-09 add_test (NAME Gravity1 COMMAND Gravity -n egm2008 -A -c -18 4000 --input-string "-86") set_tests_properties (Gravity1 PROPERTIES PASS_REGULAR_EXPRESSION "-7\\.438 1\\.305 -1\\.563") add_test (NAME Gravity2 COMMAND Gravity -n egm2008 -D -c -18 4000 --input-string "-86") set_tests_properties (Gravity2 PROPERTIES PASS_REGULAR_EXPRESSION "7\\.404 -6\\.168 7\\.616") endif () if (EXISTS ${GEOGRAPHICLIB_DATA}/gravity/grs80.egm) # Check close to zero gravity in geostationary orbit add_test (NAME Gravity3 COMMAND Gravity -p 3 -n grs80 --input-string "0 123 35786e3") set_tests_properties (Gravity3 PROPERTIES PASS_REGULAR_EXPRESSION "^-?0\\.000 -?0\\.000 -?0.000") endif () GeographicLib-1.45/tools/GeoConvert.cpp0000644000771000077100000001556512602735126017757 0ustar ckarneyckarney/** * \file GeoConvert.cpp * \brief Command line utility for geographic coordinate conversions * * Copyright (c) Charles Karney (2008-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif #include "GeoConvert.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); enum { GEOGRAPHIC, DMS, UTMUPS, MGRS, CONVERGENCE }; int outputmode = GEOGRAPHIC; int prec = 0; int zone = UTMUPS::MATCH; bool centerp = true, longfirst = false; std::string istring, ifile, ofile, cdelim; char lsep = ';', dmssep = char(0); bool sethemisphere = false, northp = false, abbrev = true; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-g") outputmode = GEOGRAPHIC; else if (arg == "-d") { outputmode = DMS; dmssep = '\0'; } else if (arg == "-:") { outputmode = DMS; dmssep = ':'; } else if (arg == "-u") outputmode = UTMUPS; else if (arg == "-m") outputmode = MGRS; else if (arg == "-c") outputmode = CONVERGENCE; else if (arg == "-n") centerp = false; else if (arg == "-z") { if (++m == argc) return usage(1, true); std::string zonestr(argv[m]); try { UTMUPS::DecodeZone(zonestr, zone, northp); sethemisphere = true; } catch (const std::exception&) { std::istringstream str(zonestr); char c; if (!(str >> zone) || (str >> c)) { std::cerr << "Zone " << zonestr << " is not a number or zone+hemisphere\n"; return 1; } if (!(zone >= UTMUPS::MINZONE && zone <= UTMUPS::MAXZONE)) { std::cerr << "Zone " << zone << " not in [0, 60]\n"; return 1; } sethemisphere = false; } } else if (arg == "-s") { zone = UTMUPS::STANDARD; sethemisphere = false; } else if (arg == "-t") { zone = UTMUPS::UTM; sethemisphere = false; } else if (arg == "-w") longfirst = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-l") abbrev = false; else if (arg == "-a") abbrev = true; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; MGRS::Check(); return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; GeoCoords p; std::string s, eol; std::string os; int retval = 0; while (std::getline(*input, s)) { eol = "\n"; try { if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } p.Reset(s, centerp, longfirst); p.SetAltZone(zone); switch (outputmode) { case GEOGRAPHIC: os = p.GeoRepresentation(prec, longfirst); break; case DMS: os = p.DMSRepresentation(prec, longfirst, dmssep); break; case UTMUPS: os = (sethemisphere ? p.AltUTMUPSRepresentation(northp, prec, abbrev) : p.AltUTMUPSRepresentation(prec, abbrev)); break; case MGRS: os = p.AltMGRSRepresentation(prec); break; case CONVERGENCE: { real gamma = p.AltConvergence(), k = p.AltScale(); int prec1 = std::max(-5, std::min(Math::extra_digits() + 8, prec)); os = Utility::str(gamma, prec1 + 5) + " " + Utility::str(k, prec1 + 7); } } } catch (const std::exception& e) { // Write error message to cout so output lines match input lines os = std::string("ERROR: ") + e.what(); retval = 1; } *output << os << eol; } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/ConicProj.cpp0000644000771000077100000002015112602735126017555 0ustar ckarneyckarney/** * \file ConicProj.cpp * \brief Command line utility for conical projections * * Copyright (c) Charles Karney (2009-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "ConicProj.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool lcc = false, albers = false, reverse = false, longfirst = false; real lat1 = 0, lat2 = 0, lon0 = 0, k1 = 1; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); int prec = 6; std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = true; else if (arg == "-c" || arg == "-a") { lcc = arg == "-c"; albers = arg == "-a"; if (m + 2 >= argc) return usage(1, true); try { for (int i = 0; i < 2; ++i) { DMS::flag ind; (i ? lat2 : lat1) = DMS::Decode(std::string(argv[++m]), ind); if (ind == DMS::LONGITUDE) throw GeographicErr("Bad hemisphere"); } } catch (const std::exception& e) { std::cerr << "Error decoding arguments of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-l") { if (++m == argc) return usage(1, true); try { DMS::flag ind; lon0 = DMS::Decode(std::string(argv[m]), ind); if (ind == DMS::LATITUDE) throw GeographicErr("Bad hemisphere"); lon0 = Math::AngNormalize(lon0); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-k") { if (++m == argc) return usage(1, true); try { k1 = Utility::num(std::string(argv[m])); } catch (const std::exception& e) { std::cerr << "Error decoding argument of " << arg << ": " << e.what() << "\n"; return 1; } } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-w") longfirst = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; if (!(lcc || albers)) { std::cerr << "Must specify \"-c lat1 lat2\" or " << "\"-a lat1 lat2\"\n"; return 1; } const LambertConformalConic lproj = lcc ? LambertConformalConic(a, f, lat1, lat2, k1) : LambertConformalConic(1, 0, 0, 0, 1); const AlbersEqualArea aproj = albers ? AlbersEqualArea(a, f, lat1, lat2, k1) : AlbersEqualArea(1, 0, 0, 0, 1); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, stra, strb, strc; std::istringstream str; int retval = 0; while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } str.clear(); str.str(s); real lat, lon, x, y, gamma, k; if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::num(stra); y = Utility::num(strb); } else DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); if (reverse) { if (lcc) lproj.Reverse(lon0, x, y, lat, lon, gamma, k); else aproj.Reverse(lon0, x, y, lat, lon, gamma, k); *output << Utility::str(longfirst ? lon : lat, prec + 5) << " " << Utility::str(longfirst ? lat : lon, prec + 5) << " " << Utility::str(gamma, prec + 6) << " " << Utility::str(k, prec + 6) << eol; } else { if (lcc) lproj.Forward(lon0, lat, lon, x, y, gamma, k); else aproj.Forward(lon0, lat, lon, x, y, gamma, k); *output << Utility::str(x, prec) << " " << Utility::str(y, prec) << " " << Utility::str(gamma, prec + 6) << " " << Utility::str(k, prec + 6) << eol; } } catch (const std::exception& e) { *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/GeodSolve.cpp0000644000771000077100000003023412602735126017561 0ustar ckarneyckarney/** * \file GeodSolve.cpp * \brief Command line utility for geodesic calculations * * Copyright (c) Charles Karney (2009-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "GeodSolve.usage" typedef GeographicLib::Math::real real; std::string LatLonString(real lat, real lon, int prec, bool dms, char dmssep, bool longfirst) { using namespace GeographicLib; std::string latstr = dms ? DMS::Encode(lat, prec + 5, DMS::LATITUDE, dmssep) : DMS::Encode(lat, prec + 5, DMS::NUMBER), lonstr = dms ? DMS::Encode(lon, prec + 5, DMS::LONGITUDE, dmssep) : DMS::Encode(lon, prec + 5, DMS::NUMBER); return (longfirst ? lonstr : latstr) + " " + (longfirst ? latstr : lonstr); } std::string AzimuthString(real azi, int prec, bool dms, char dmssep) { using namespace GeographicLib; return dms ? DMS::Encode(azi, prec + 5, DMS::AZIMUTH, dmssep) : DMS::Encode(azi, prec + 5, DMS::NUMBER); } std::string DistanceStrings(real s12, real a12, bool full, bool arcmode, int prec, bool dms) { using namespace GeographicLib; std::string s; if (full || !arcmode) s += Utility::str(s12, prec); if (full) s += " "; if (full || arcmode) s += DMS::Encode(a12, prec + 5, dms ? DMS::NONE : DMS::NUMBER); return s; } real ReadDistance(const std::string& s, bool arcmode) { using namespace GeographicLib; return arcmode ? DMS::DecodeAngle(s) : Utility::num(s); } int main(int argc, char* argv[]) { try { using namespace GeographicLib; Utility::set_digits(); bool linecalc = false, inverse = false, arcmode = false, dms = false, full = false, exact = false, unroll = false, longfirst = false, azi2back = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); real lat1, lon1, azi1, lat2, lon2, azi2, s12, m12, a12, M12, M21, S12; int prec = 3; std::string istring, ifile, ofile, cdelim; char lsep = ';', dmssep = char(0); for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-i") { inverse = true; linecalc = false; } else if (arg == "-a") arcmode = true; else if (arg == "-l") { inverse = false; linecalc = true; if (m + 3 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat1, lon1, longfirst); azi1 = DMS::DecodeAzimuth(std::string(argv[m + 3])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -l: " << e.what() << "\n"; return 1; } m += 3; } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-u") unroll = true; else if (arg == "-d") { dms = true; dmssep = '\0'; } else if (arg == "-:") { dms = true; dmssep = ':'; } else if (arg == "-w") longfirst = true; else if (arg == "-b") azi2back = true; else if (arg == "-f") full = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-E") exact = true; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; // GeodesicExact mask values are the same as Geodesic unsigned outmask = Geodesic::LATITUDE | Geodesic::LONGITUDE | Geodesic::AZIMUTH; // basic output quantities outmask |= inverse ? Geodesic::DISTANCE : // distance-related flags (arcmode ? Geodesic::NONE : Geodesic::DISTANCE_IN); // longitude unrolling outmask |= unroll ? Geodesic::LONG_UNROLL : Geodesic::NONE; // full output -- don't use Geodesic::ALL since this includes DISTANCE_IN outmask |= full ? (Geodesic::DISTANCE | Geodesic::REDUCEDLENGTH | Geodesic::GEODESICSCALE | Geodesic::AREA) : Geodesic::NONE; const Geodesic geods(a, f); const GeodesicExact geode(a, f); GeodesicLine ls; GeodesicLineExact le; if (linecalc) { if (exact) le = geode.Line(lat1, lon1, azi1, outmask); else ls = geods.Line(lat1, lon1, azi1, outmask); } // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, slat1, slon1, slat2, slon2, sazi1, ss12, strc; std::istringstream str; int retval = 0; while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } str.clear(); str.str(s); if (inverse) { if (!(str >> slat1 >> slon1 >> slat2 >> slon2)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1, longfirst); DMS::DecodeLatLon(slat2, slon2, lat2, lon2, longfirst); a12 = exact ? geode.GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi1, azi2, m12, M12, M21, S12) : geods.GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi1, azi2, m12, M12, M21, S12); if (full) { if (unroll) lon2 = lon1 + Math::AngDiff(lon1, lon2); else { lon1 = Math::AngNormalize(lon1); lon2 = Math::AngNormalize(lon2); } *output << LatLonString(lat1, lon1, prec, dms, dmssep, longfirst) << " "; } *output << AzimuthString(azi1, prec, dms, dmssep) << " "; if (full) *output << LatLonString(lat2, lon2, prec, dms, dmssep, longfirst) << " "; if (azi2back) azi2 += azi2 >= 0 ? -180 : 180; *output << AzimuthString(azi2, prec, dms, dmssep) << " " << DistanceStrings(s12, a12, full, arcmode, prec, dms); if (full) *output << " " << Utility::str(m12, prec) << " " << Utility::str(M12, prec+7) << " " << Utility::str(M21, prec+7) << " " << Utility::str(S12, std::max(prec-7, 0)); *output << eol; } else { if (linecalc) { if (!(str >> ss12)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); s12 = ReadDistance(ss12, arcmode); a12 = exact ? le.GenPosition(arcmode, s12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12) : ls.GenPosition(arcmode, s12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12); } else { if (!(str >> slat1 >> slon1 >> sazi1 >> ss12)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1, longfirst); azi1 = DMS::DecodeAzimuth(sazi1); s12 = ReadDistance(ss12, arcmode); a12 = exact ? geode.GenDirect(lat1, lon1, azi1, arcmode, s12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12) : geods.GenDirect(lat1, lon1, azi1, arcmode, s12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12); } if (full) *output << LatLonString(lat1, unroll ? lon1 : Math::AngNormalize(lon1), prec, dms, dmssep, longfirst) << " " << AzimuthString(azi1, prec, dms, dmssep) << " "; if (azi2back) azi2 += azi2 >= 0 ? -180 : 180; *output << LatLonString(lat2, lon2, prec, dms, dmssep, longfirst) << " " << AzimuthString(azi2, prec, dms, dmssep); if (full) *output << " " << DistanceStrings(s12, a12, full, arcmode, prec, dms) << " " << Utility::str(m12, prec) << " " << Utility::str(M12, prec+7) << " " << Utility::str(M21, prec+7) << " " << Utility::str(S12, std::max(prec-7, 0)); *output << eol; } } catch (const std::exception& e) { // Write error message cout so output lines match input lines *output << "ERROR: " << e.what() << "\n"; retval = 1; } } return retval; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/tools/Planimeter.cpp0000644000771000077100000001656112602735126020001 0ustar ckarneyckarney/** * \file Planimeter.cpp * \brief Command line utility for measuring the area of geodesic polygons * * Copyright (c) Charles Karney (2010-2015) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif #include "Planimeter.usage" int main(int argc, char* argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); enum { GEODESIC, EXACT, AUTHALIC, RHUMB }; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); bool reverse = false, sign = true, polyline = false, longfirst = false; int linetype = GEODESIC; int prec = 6; std::string istring, ifile, ofile, cdelim; char lsep = ';'; for (int m = 1; m < argc; ++m) { std::string arg(argv[m]); if (arg == "-r") reverse = !reverse; else if (arg == "-s") sign = !sign; else if (arg == "-l") polyline = !polyline; else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::num(std::string(argv[m + 1])); f = Utility::fract(std::string(argv[m + 2])); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -e: " << e.what() << "\n"; return 1; } m += 2; } else if (arg == "-w") longfirst = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::num(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-G") linetype = GEODESIC; else if (arg == "-E") linetype = EXACT; else if (arg == "-Q") linetype = AUTHALIC; else if (arg == "-R") linetype = RHUMB; else if (arg == "--input-string") { if (++m == argc) return usage(1, true); istring = argv[m]; } else if (arg == "--input-file") { if (++m == argc) return usage(1, true); ifile = argv[m]; } else if (arg == "--output-file") { if (++m == argc) return usage(1, true); ofile = argv[m]; } else if (arg == "--line-separator") { if (++m == argc) return usage(1, true); if (std::string(argv[m]).size() != 1) { std::cerr << "Line separator must be a single character\n"; return 1; } lsep = argv[m][0]; } else if (arg == "--comment-delimiter") { if (++m == argc) return usage(1, true); cdelim = argv[m]; } else if (arg == "--version") { std::cout << argv[0] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; return 0; } else return usage(!(arg == "-h" || arg == "--help"), arg != "--help"); } if (!ifile.empty() && !istring.empty()) { std::cerr << "Cannot specify --input-string and --input-file together\n"; return 1; } if (ifile == "-") ifile.clear(); std::ifstream infile; std::istringstream instring; if (!ifile.empty()) { infile.open(ifile.c_str()); if (!infile.is_open()) { std::cerr << "Cannot open " << ifile << " for reading\n"; return 1; } } else if (!istring.empty()) { std::string::size_type m = 0; while (true) { m = istring.find(lsep, m); if (m == std::string::npos) break; istring[m] = '\n'; } instring.str(istring); } std::istream* input = !ifile.empty() ? &infile : (!istring.empty() ? &instring : &std::cin); std::ofstream outfile; if (ofile == "-") ofile.clear(); if (!ofile.empty()) { outfile.open(ofile.c_str()); if (!outfile.is_open()) { std::cerr << "Cannot open " << ofile << " for writing\n"; return 1; } } std::ostream* output = !ofile.empty() ? &outfile : &std::cout; const Ellipsoid ellip(a, f); if (linetype == AUTHALIC) { using std::sqrt; a = sqrt(ellip.Area() / (4 * Math::pi())); f = 0; } const Geodesic geod(a, f); const GeodesicExact geode(a, f); const Rhumb rhumb(a, f); PolygonArea poly(geod, polyline); PolygonAreaExact polye(geode, polyline); PolygonAreaRhumb polyr(rhumb, polyline); GeoCoords p; // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol("\n"); real perimeter, area; unsigned num; while (std::getline(*input, s)) { if (!cdelim.empty()) { std::string::size_type m = s.find(cdelim); if (m != std::string::npos) { eol = " " + s.substr(m) + "\n"; s = s.substr(0, m); } } bool endpoly = s.empty(); if (!endpoly) { try { p.Reset(s, longfirst); if (Math::isnan(p.Latitude()) || Math::isnan(p.Longitude())) endpoly = true; } catch (const GeographicErr&) { endpoly = true; } } if (endpoly) { num = linetype == EXACT ? polye.Compute(reverse, sign, perimeter, area) : linetype == RHUMB ? polyr.Compute(reverse, sign, perimeter, area) : poly.Compute(reverse, sign, perimeter, area); // geodesic + authalic if (num > 0) { *output << num << " " << Utility::str(perimeter, prec); if (!polyline) { *output << " " << Utility::str(area, std::max(0, prec - 5)); } *output << eol; } linetype == EXACT ? polye.Clear() : linetype == RHUMB ? polyr.Clear() : poly.Clear(); eol = "\n"; } else { linetype == EXACT ? polye.AddPoint(p.Latitude(), p.Longitude()) : linetype == RHUMB ? polyr.AddPoint(p.Latitude(), p.Longitude()) : poly.AddPoint(linetype == AUTHALIC ? ellip.AuthalicLatitude(p.Latitude()) : p.Latitude(), p.Longitude()); } } num = linetype == EXACT ? polye.Compute(reverse, sign, perimeter, area) : linetype == RHUMB ? polyr.Compute(reverse, sign, perimeter, area) : poly.Compute(reverse, sign, perimeter, area); if (num > 0) { *output << num << " " << Utility::str(perimeter, prec); if (!polyline) { *output << " " << Utility::str(area, std::max(0, prec - 5)); } *output << eol; } linetype == EXACT ? polye.Clear() : linetype == RHUMB ? polyr.Clear() : poly.Clear(); eol = "\n"; return 0; } catch (const std::exception& e) { std::cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { std::cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.45/AUTHORS0000644000771000077100000000104312602735126015072 0ustar ckarneyckarneyCharles Karney Francesco Paolo Lovergine (autoconfiscation) Mathieu Peyréga (help with gravity models) Andrew MacIntyre (python/setup.py) Skip Breidbach (maven support for Java) Scott Heiman (.NET wrappers + C# examples) Chris Bennight (deploying Java library) Sebastian Mattheis (gnomonic projection in Java) Yurij Mikhalevich <0@39.yt> (node.js port) GeographicLib-1.45/matlab/geographiclib-legacy/polygonarea.m0000644000771000077100000000246312602735126024030 0ustar ckarneyckarneyfunction [area, perimeter] = polygonarea(latlong, a, f) %POLYGONAREA Wrapper for geodarea % % [area, perimeter] = POLYGONAREA(latlong) % [area, perimeter] = POLYGONAREA(latlong, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geodarea which is implemented as native % Matlab code. % % latlong is an M x 2 matrix % latitude of vertices = latlong(:,1) in degrees % longitude of vertices = latlong(:,2) in degrees % % area is the area in meters^2 % perimeter is the perimeter in meters % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % Only simple polygons (which do not intersect themselves) are supported. % There is no need to "close" the polygon. Counter-clockwise traversal % counts as a positive area. A polygon may encircle one or both poles. % The total area of the WGS84 ellipsoid is given by % 8 * polygonarea([ 0 0; 0 90; 90 0 ]) % % See also GEODAREA. % Copyright (c) Charles Karney (2015) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [area, perimeter] = geodarea(latlong(:,1), latlong(:,2), ellipsoid); end GeographicLib-1.45/matlab/geographiclib-legacy/geodesicinverse.cpp0000644000771000077100000000701612602735126025213 0ustar ckarneyckarney/** * \file geodesicinverse.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010-2013) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geodesicinverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geodesicinverse.cpp #include #include #include #include using namespace std; using namespace GeographicLib; template void compute(double a, double f, mwSize m, const double* latlong, double* geodesic, double* aux) { const double* lat1 = latlong; const double* lon1 = latlong + m; const double* lat2 = latlong + 2*m; const double* lon2 = latlong + 3*m; double* azi1 = geodesic; double* azi2 = geodesic + m; double* s12 = geodesic + 2*m; double* a12 = NULL; double* m12 = NULL; double* M12 = NULL; double* M21 = NULL; double* S12 = NULL; if (aux) { a12 = aux; m12 = aux + m; M12 = aux + 2*m; M21 = aux + 3*m; S12 = aux + 4*m; } const G g(a, f); for (mwIndex i = 0; i < m; ++i) { if (abs(lat1[i]) <= 90 && lon1[i] >= -540 && lon1[i] < 540 && abs(lat2[i]) <= 90 && lon2[i] >= -540 && lon2[i] < 540) { if (aux) a12[i] = g.Inverse(lat1[i], lon1[i], lat2[i], lon2[i], s12[i], azi1[i], azi2[i], m12[i], M12[i], M21[i], S12[i]); else g.Inverse(lat1[i], lon1[i], lat2[i], lon2[i], s12[i], azi1[i], azi2[i]); } } } void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("latlong coordinates are not of type double."); if (mxGetN(prhs[0]) != 4) mexErrMsgTxt("latlong coordinates must be M x 4 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } mwSize m = mxGetM(prhs[0]); const double* latlong = mxGetPr(prhs[0]); double* geodesic = mxGetPr(plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL)); std::fill(geodesic, geodesic + 3*m, Math::NaN()); double* aux = nlhs == 2 ? mxGetPr(plhs[1] = mxCreateDoubleMatrix(m, 5, mxREAL)) : NULL; if (aux) std::fill(aux, aux + 5*m, Math::NaN()); try { if (std::abs(f) <= 0.02) compute(a, f, m, latlong, geodesic, aux); else compute(a, f, m, latlong, geodesic, aux); } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.45/matlab/geographiclib-legacy/utmupsreverse.m0000644000771000077100000000204612602735126024436 0ustar ckarneyckarneyfunction [latlong, scale] = utmupsreverse(utmups) %UTMUPSREVERSE Wrapper for utmups_inv % % [latlong, scale] = UTMUPSREVERSE(utmups) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls utmups_inv which is implemented as % native Matlab code. % % utmups is an M x 4 matrix % easting = utmups(:,1) in meters % northing = utmups(:,2) in meters % zone = utmups(:,3) % hemi = utmups(:,4) % % zone = 0 for UPS, zone = [1,60] for UTM % hemi = 0 for southern hemisphere, hemi = 1 for northern hemisphere. % % latlong is an M x 2 matrix % latitude = latlong(:,1) in degrees % longitude = latlong(:,2) in degrees % scale is an M x 2 matrix % gamma = scale(:,1) meridian convergence in degrees % k = scale(:,2) scale % % See also UTMUPS_INV. % Copyright (c) Charles Karney (2015) . [lat, lon, gam, k] = ... utmups_inv(utmups(:,1), utmups(:,2), utmups(:,3), utmups(:,4)); latlong = [lat, lon]; scale = [gam, k]; end GeographicLib-1.45/matlab/geographiclib-legacy/localcartesianforward.m0000644000771000077100000000376712602735126026071 0ustar ckarneyckarneyfunction [cartesian, rot] = localcartesianforward(origin, geodetic, a, f) %LOCALCARTESIANFORWARD Wrapper for loccart_fwd % % [cartesian, rot] = LOCALCARTESIANFORWARD(origin, geodetic) % [cartesian, rot] = LOCALCARTESIANFORWARD(origin, geodetic, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls loccart_fwd which is implemented as % native Matlab code. % % origin is a 1 x 3 or 1 x 2 matrix % lat0 = origin(1,1) in degrees % lon0 = origin(1,2) in degrees % h0 = origin(1,3) in meters (default 0 m) % geodetic is an M x 3 or M x 2 matrix of geodetic coordinates % lat = geodetic(:,1) in degrees % lon = geodetic(:,2) in degrees % h = geodetic(:,3) in meters (default 0 m) % % cartesian is an M x 3 matrix of local cartesian coordinates % x = cartesian(:,1) in meters % y = cartesian(:,2) in meters % z = cartesian(:,3) in meters % rot is an M x 9 matrix % M = rot(:,1:9) rotation matrix in row major order. Pre-multiplying % a unit vector in local cartesian coordinates at (lat, lon, h) % by M transforms the vector to local cartesian coordinates at % (lat0, lon0, h0) % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also LOCCART_FWD. % Copyright (c) Charles Karney (2015) . if (nargin < 3) ellipsoid = defaultellipsoid; elseif (nargin < 4) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end if size(geodetic,2) < 3 h = 0; else h = geodetic(:,3); end if length(origin(:)) == 2 h0 = 0; elseif length(origin(:)) == 3 h0 = origin(3); else error('origin is not vector of length 2 or 3') end [x, y, z, M] = loccart_fwd(origin(1), origin(2), h0, ... geodetic(:,1), geodetic(:,2), h, ellipsoid); cartesian = [x, y, z]; rot = reshape(permute(M, [3, 2, 1]), [], 9); end GeographicLib-1.45/matlab/geographiclib-legacy/localcartesianforward.cpp0000644000771000077100000000666112602735126026413 0ustar ckarneyckarney/** * \file localcartesianforward.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic localcartesianforward.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic localcartesianforward.cpp #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 2) mexErrMsgTxt("Two input arguments required."); else if (nrhs > 4) mexErrMsgTxt("More than four input arguments specified."); else if (nrhs == 3) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("origin is not of type double."); if (!( mxGetM(prhs[0]) == 1 && (mxGetN(prhs[0]) == 2 || mxGetN(prhs[0]) == 3) )) mexErrMsgTxt("origin be 1 x 3 or 1 x 2 matrix."); double* origin = mxGetPr(prhs[0]); double lat0 = origin[0], lon0 = origin[1], h0 = mxGetN(prhs[0]) == 3 ? origin[2] : 0; if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) )) mexErrMsgTxt("geodetic coordinates are not of type double."); if (!(mxGetN(prhs[1]) == 3 || mxGetN(prhs[1]) == 2)) mexErrMsgTxt("geodetic coordinates must be an M x 3 or M x 2 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 4) { if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[2]); if (!( mxIsDouble(prhs[3]) && !mxIsComplex(prhs[3]) && mxGetNumberOfElements(prhs[3]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[3]); } mwSize m = mxGetM(prhs[1]); double* lat = mxGetPr(prhs[1]); double* lon = lat + m; bool haveh = mxGetN(prhs[1]) == 3; double* h = haveh ? lat + 2*m : NULL; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* x = mxGetPr(plhs[0]); std::fill(x, x + 3*m, Math::NaN()); double* y = x + m; double* z = x + 2*m; double* rot = NULL; bool rotp = nlhs == 2; if (rotp) { plhs[1] = mxCreateDoubleMatrix(m, 9, mxREAL); rot = mxGetPr(plhs[1]); std::fill(rot, rot + 9*m, Math::NaN()); } try { std::vector rotv(rotp ? 9 : 0); const Geocentric c(a, f); if (!(abs(lat0) <= 90)) throw GeographicErr("Invalid latitude"); if (!(lon0 >= -540 || lon0 < 540)) throw GeographicErr("Invalid longitude"); const LocalCartesian l(lat0, lon0, h0, c); for (mwIndex i = 0; i < m; ++i) { if (abs(lat[i]) <= 90 && lon[i] >= -540 && lon[i] < 540) { l.Forward(lat[i], lon[i], haveh ? h[i] : 0.0, x[i], y[i], z[i], rotv); if (rotp) { for (mwIndex k = 0; k < 9; ++k) rot[m * k + i] = rotv[k]; } } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.45/matlab/geographiclib-legacy/utmupsreverse.cpp0000644000771000077100000000427712602735126024774 0ustar ckarneyckarney/** * \file utmupsreverse.cpp * \brief Matlab mex file for UTM/UPS to geographic conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic utmupsreverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic utmupsreverse.cpp #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs != 1) mexErrMsgTxt("One input argument required."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("utmups coordinates are not of type double."); if (mxGetN(prhs[0]) != 4) mexErrMsgTxt("utmups coordinates must be M x 4 matrix."); mwSize m = mxGetM(prhs[0]); double* x = mxGetPr(prhs[0]); double* y = x + m; double* zone = x + 2*m; double* hemi = x + 3*m; plhs[0] = mxCreateDoubleMatrix(m, 2, mxREAL); double* lat = mxGetPr(plhs[0]); double* lon = lat + m; double* gamma = NULL; double* k = NULL; bool scale = nlhs == 2; if (scale) { plhs[1] = mxCreateDoubleMatrix(m, 2, mxREAL); gamma = mxGetPr(plhs[1]); k = gamma + m; } for (mwIndex i = 0; i < m; ++i) { try { int ZONE = int(zone[i]); if (double(ZONE) != zone[i]) throw GeographicErr("Zone is not an integer"); bool HEMI = (hemi[i] != 0); if (HEMI && (hemi[i] != 1)) throw GeographicErr("Hemisphere is not 0 or 1"); if (scale) UTMUPS::Reverse(ZONE, HEMI, x[i], y[i], lat[i], lon[i], gamma[i], k[i]); else UTMUPS::Reverse(ZONE, HEMI, x[i], y[i], lat[i], lon[i]); } catch (const std::exception& e) { mexWarnMsgTxt(e.what()); lat[i] = lon[i] = Math::NaN(); if (scale) gamma[i] = k[i] = Math::NaN(); } } } GeographicLib-1.45/matlab/geographiclib-legacy/utmupsforward.m0000644000771000077100000000254312602735126024431 0ustar ckarneyckarneyfunction [utmups, scale] = utmupsforward(latlong, setzone) %UTMUPSFORWARD Wrapper for utmups_fwd % % [utmups, scale] = UTMUPSFORWARD(latlong) % [utmups, scale] = UTMUPSFORWARD(latlong, setzone) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls utmups_fwd which is implemented as % native Matlab code. % % latlong is an M x 2 matrix % latitude = latlong(:,1) in degrees % longitude = latlong(:,2) in degrees % % utmups is an M x 4 matrix % easting = utmups(:,1) in meters % northing = utmups(:,2) in meters % zone = utmups(:,3) % hemi = utmups(:,4) % scale is an M x 2 matrix % gamma = scale(:,1) meridian convergence in degrees % k = scale(:,2) scale % % zone = 0 for UPS, zone = [1,60] for UTM % hemi = 0 for southern hemisphere, hemi = 1 for northern hemisphere % % setzone is an zone override flag with legal values % 0, use UPS % [1,60], use the corresponding UTM zone % -1, use the standard assigment (the default) % -2, use closest UTM zone % % See also UTMUPS_FWD. % Copyright (c) Charles Karney (2015) . if nargin < 2 setzone = -1; end [x, y, zone, northp, gam, k] = ... utmups_fwd(latlong(:,1), latlong(:,2), setzone); utmups = [x, y, zone, northp]; scale = [gam, k]; end GeographicLib-1.45/matlab/geographiclib-legacy/utmupsforward.cpp0000644000771000077100000000530412602735126024755 0ustar ckarneyckarney/** * \file utmupsforward.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic utmupsforward.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic utmupsforward.cpp #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 2) mexErrMsgTxt("More than two input arguments specified."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("latlong coordinates are not of type double."); if (mxGetN(prhs[0]) != 2) mexErrMsgTxt("latlong coordinates must be M x 2 matrix."); int setzone; if (nrhs == 1) setzone = UTMUPS::STANDARD; else { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("setzone is not an integer."); double rzone = mxGetScalar(prhs[1]); setzone = int(rzone); if (double(setzone) != rzone) mexErrMsgTxt("setzone is not an integer."); if (setzone < UTMUPS::MINPSEUDOZONE || setzone > UTMUPS::MAXZONE) mexErrMsgTxt("setzone outside the legal range."); } mwSize m = mxGetM(prhs[0]); double* lat = mxGetPr(prhs[0]); double* lon = lat + m; plhs[0] = mxCreateDoubleMatrix(m, 4, mxREAL); double* x = mxGetPr(plhs[0]); double* y = x + m; double* zone = x + 2*m; double* hemi = x + 3*m; double* gamma = NULL; double* k = NULL; bool scale = nlhs == 2; if (scale) { plhs[1] = mxCreateDoubleMatrix(m, 2, mxREAL); gamma = mxGetPr(plhs[1]); k = gamma + m; } for (mwIndex i = 0; i < m; ++i) { int ZONE; bool HEMI; try { if (scale) UTMUPS::Forward(lat[i], lon[i], ZONE, HEMI, x[i], y[i], gamma[i], k[i], setzone); else UTMUPS::Forward(lat[i], lon[i], ZONE, HEMI, x[i], y[i], setzone); zone[i] = ZONE; hemi[i] = HEMI ? 1 : 0; } catch (const std::exception& e) { mexWarnMsgTxt(e.what()); x[i] = y[i] = Math::NaN(); if (scale) gamma[i] = k[i] = Math::NaN(); zone[i] = UTMUPS::INVALID; hemi[i] = 0; } } } GeographicLib-1.45/matlab/geographiclib-legacy/mgrsreverse.cpp0000644000771000077100000000416212602735126024400 0ustar ckarneyckarney/** * \file mgrsreverse.cpp * \brief Matlab mex file for UTM/UPS to MGRS conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic mgrsreverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic mgrsreverse.cpp #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs != 1) mexErrMsgTxt("One input argument required."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!mxIsCell(prhs[0]) || mxGetN(prhs[0]) != 1) mexErrMsgTxt("mgrs coordinates should be in a M x 1 cell array."); mwSize m = mxGetM(prhs[0]); plhs[0] = mxCreateDoubleMatrix(m, 4, mxREAL); double* x = mxGetPr(plhs[0]); double* y = x + m; double* zone = x + 2*m; double* hemi = x + 3*m; double* prec = NULL; bool precp = nlhs == 2; if (precp) { plhs[1] = mxCreateDoubleMatrix(m, 1, mxREAL); prec = mxGetPr(plhs[1]); } string mgrsstr; for (mwIndex i = 0; i < m; ++i) { try { mxArray* mgrs = mxGetCell(prhs[0], i); if (!mxIsChar(mgrs) || mxGetM(mgrs) != 1) throw GeographicErr("Cell element not a string"); mwSize n = mxGetN(mgrs); mxChar* mgrschar = mxGetChars(mgrs); mgrsstr.resize(n); for (mwIndex k = 0; k < n; ++k) mgrsstr[k] = mgrschar[k]; int ZONE, PREC; bool HEMI; MGRS::Reverse(mgrsstr, ZONE, HEMI, x[i], y[i], PREC); zone[i] = ZONE; hemi[i] = HEMI ? 1 : 0; if (precp) prec[i] = PREC; } catch (const std::exception& e) { mexWarnMsgTxt(e.what()); x[i] = y[i] = Math::NaN(); zone[i] = UTMUPS::INVALID; hemi[i] = 0; if (precp) prec[i] = -2; } } } GeographicLib-1.45/matlab/geographiclib-legacy/mgrsforward.cpp0000644000771000077100000000453712602735126024377 0ustar ckarneyckarney/** * \file mgrsforward.cpp * \brief Matlab mex file for UTM/UPS to MGRS conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic mgrsforward.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic mgrsforward.cpp #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 2) mexErrMsgTxt("More than two input arguments specified."); else if (nlhs > 1) mexErrMsgTxt("Only one output argument can be specified."); if (!mxIsDouble(prhs[0])) mexErrMsgTxt("utmups coordinates are not of type double."); if (mxGetN(prhs[0]) != 4) mexErrMsgTxt("utmups coordinates must be M x 4 matrix."); int prec; if (nrhs == 1) prec = 5; else { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Precision is not an integer."); double rprec = mxGetScalar(prhs[1]); prec = int(rprec); if (double(prec) != rprec) mexErrMsgTxt("Precision is not an integer."); if (prec < -1 || prec > 11) mexErrMsgTxt("Precision outside the legal range [-1, 11]."); } mwSize m = mxGetM(prhs[0]); double* x = mxGetPr(prhs[0]); double* y = x + m; double* zone = x + 2*m; double* hemi = x + 3*m; string mgrsstr; plhs[0] = mxCreateCellArray(1, &m); mxArray* mgrs = plhs[0]; for (mwIndex i = 0; i < m; ++i) { try { mgrsstr = "INVALID"; int ZONE = int(zone[i]); if (double(ZONE) != zone[i]) throw GeographicErr("Zone is not an integer"); bool HEMI = (hemi[i] != 0); if (HEMI && (hemi[i] != 1)) throw GeographicErr("Hemisphere is not 0 or 1"); MGRS::Forward(ZONE, HEMI, x[i], y[i], prec, mgrsstr); } catch (const std::exception& e) { mexWarnMsgTxt(e.what()); } mxSetCell(mgrs, i, mxCreateString(mgrsstr.c_str())); } } GeographicLib-1.45/matlab/geographiclib-legacy/geodesicline.cpp0000644000771000077100000000764312602735126024475 0ustar ckarneyckarney/** * \file geodesicline.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010-2013) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geodesicline.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geodesicline.cpp #include #include #include using namespace std; using namespace GeographicLib; template void compute(double a, double f, double lat1, double lon1, double azi1, mwSize m, const double* s12, double* latlong, double* aux) { double* lat2 = latlong; double* lon2 = latlong + m; double* azi2 = latlong + 2*m; double* a12 = NULL; double* m12 = NULL; double* M12 = NULL; double* M21 = NULL; double* S12 = NULL; if (aux) { a12 = aux; m12 = aux + m; M12 = aux + 2*m; M21 = aux + 3*m; S12 = aux + 4*m; } const G g(a, f); const L l(g, lat1, lon1, azi1); for (mwIndex i = 0; i < m; ++i) if (aux) a12[i] = l.Position(s12[i], lat2[i], lon2[i], azi2[i], m12[i], M12[i], M21[i], S12[i]); else l.Position(s12[i], lat2[i], lon2[i], azi2[i]); } void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 4) mexErrMsgTxt("Four input arguments required."); else if (nrhs > 6) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 5) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) && mxGetNumberOfElements(prhs[0]) == 1 )) mexErrMsgTxt("lat1 is not a real scalar."); double lat1 = mxGetScalar(prhs[0]); if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("lon1 is not a real scalar."); double lon1 = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("azi1 is not a real scalar."); double azi1 = mxGetScalar(prhs[2]); if (!( mxIsDouble(prhs[3]) && !mxIsComplex(prhs[3]) )) mexErrMsgTxt("distances are not of type double."); if (mxGetN(prhs[3]) != 1) mexErrMsgTxt("distances must be M x 1 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 6) { if (!( mxIsDouble(prhs[4]) && !mxIsComplex(prhs[4]) && mxGetNumberOfElements(prhs[4]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[4]); if (!( mxIsDouble(prhs[5]) && !mxIsComplex(prhs[5]) && mxGetNumberOfElements(prhs[5]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[5]); } mwSize m = mxGetM(prhs[3]); double* s12 = mxGetPr(prhs[3]); double* latlong = mxGetPr(plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL)); double* aux = nlhs == 2 ? mxGetPr(plhs[1] = mxCreateDoubleMatrix(m, 5, mxREAL)) : NULL; try { if (!(abs(lat1) <= 90)) throw GeographicErr("Invalid latitude"); if (!(lon1 >= -540 || lon1 < 540)) throw GeographicErr("Invalid longitude"); if (!(azi1 >= -540 || azi1 < 540)) throw GeographicErr("Invalid azimuth"); if (std::abs(f) <= 0.02) compute (a, f, lat1, lon1, azi1, m, s12, latlong, aux); else compute (a, f, lat1, lon1, azi1, m, s12, latlong, aux); } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.45/matlab/geographiclib-legacy/polygonarea.cpp0000644000771000077100000000520212602735126024350 0ustar ckarneyckarney/** * \file polygonarea.cpp * \brief Matlab mex file for computing the area of a geodesicpolygon * * Copyright (c) Charles Karney (2011) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic polygonarea.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic polygonarea.cpp #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("latlong coordinates are not of type double."); if (mxGetN(prhs[0]) != 2) mexErrMsgTxt("latlong coordinates must be M x 2 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } mwSize m = mxGetM(prhs[0]); double* lat = mxGetPr(prhs[0]); double* lon = lat + m; plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL); double* area = mxGetPr(plhs[0]); double* perimeter = NULL; bool perimeterp = nlhs == 2; if (perimeterp) { plhs[1] = mxCreateDoubleMatrix(1, 1, mxREAL); perimeter = mxGetPr(plhs[1]); } try { const Geodesic g(a, f); PolygonArea p(g, false); for (mwIndex i = 0; i < m; ++i) { if (!(abs(lat[i]) <= 90)) throw GeographicErr("Invalid latitude"); if (!(lon[i] >= -540 || lon[i] < 540)) throw GeographicErr("Invalid longitude"); p.AddPoint(lat[i], lon[i]); } double tp, ta; p.Compute(false, true, tp, ta); *area = ta; if (perimeterp) *perimeter = tp; } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.45/matlab/geographiclib-legacy/geographiclibinterface.m0000644000771000077100000000611412602735126026165 0ustar ckarneyckarneyfunction geographiclibinterface(incdir, libdir) %GEOGRAPHICLIBINTERFACE Compile interface code (DEPRECATED) % % GEOGRAPHICLIBINTERFACE % GEOGRAPHICLIBINTERFACE(installdir) % GEOGRAPHICLIBINTERFACE(incdir, libdir) % % This function is DEPRECATED because native Matlab implementations are % available for all the functions. It and the associated C++ wrapper % code will be removed at some point in 2016. % % With one argument GEOGRAPHICLIBINTERFACE looks for the compiled library % in installdir/lib and the include files in installdir/include. % % With no arguments, installdir is taked to be '/usr/local', on Unix and % Linux systems, and 'C:/Program Files/GeographicLib', on Windows systems % % With two arguments, the library is looked for in libdir and the include % files in incdir. % % This has been tested with % % Octave 3.2.3 and g++ 4.4.4 under Linux % Octave 3.6.4 and g++ 4.8.3 under Linux % Matlab 2007a and Visual Studio 2005 under Windows % Matlab 2008a and Visual Studio 2005 under Windows % Matlab 2008a and Visual Studio 2008 under Windows (*) % Matlab 2010b and Visual Studio 2005 under Windows % Matlab 2010b and Visual Studio 2008 under Windows (*) % Matlab 2010b and Visual Studio 2010 under Windows % Matlab 2013b and Visual Studio 2012 under Windows % Matlab 2014b and Mac OSX 10.10 (Yosemite) % % Run 'mex -setup' to configure the C++ compiler for Matlab to use. % Copyright (c) Charles Karney (2010-2014) and % licensed under the MIT/X11 License. For more information, see % http://geographiclib.sf.net/html/other.html#matlab funs = {'geodesicdirect', 'geodesicinverse', 'geodesicline', ... 'geoidheight', ... 'utmupsforward', 'utmupsreverse', ... 'mgrsforward', 'mgrsreverse', ... 'geocentricforward', 'geocentricreverse', ... 'localcartesianforward', 'localcartesianreverse', ... 'polygonarea'}; lib='Geographic'; if (ispc && ... strcmp(mex.getCompilerConfigurations().Manufacturer, 'Microsoft') && ... strcmp(mex.getCompilerConfigurations().Version, '9.0')) warning(['geoidheight compiled with Visual Studio 2008 ',... 'causes Matlab to CRASH']); end if (nargin < 2) if (nargin == 0) if ispc installdir = 'C:/Program Files/GeographicLib'; else installdir = '/usr/local'; end else installdir = incdir; end incdir=[installdir '/include']; libdir=[installdir '/lib']; end testheader = [incdir '/GeographicLib/Constants.hpp']; if (~ exist(testheader, 'file')) error(['Cannot find ' testheader]); end fprintf('Compiling Matlab interface to GeographicLib\n'); fprintf('Include directory: %s\nLibrary directory: %s\n', incdir, libdir); for i=1:size(funs,2) fprintf('Compiling %s...', funs{i}); if ispc || ismac mex( ['-I' incdir], ['-L' libdir], ['-l' lib], [funs{i} '.cpp'] ); else mex( ['-I' incdir], ['-L' libdir], ['-l' lib], ['-Wl,-rpath=' libdir], ... [funs{i} '.cpp'] ); end fprintf(' done.\n'); end end GeographicLib-1.45/matlab/geographiclib-legacy/geocentricreverse.m0000644000771000077100000000306012602735126025220 0ustar ckarneyckarneyfunction [geodetic, rot] = geocentricreverse(geocentric, a, f) %GEOCENTRICREVERSE Wrapper for geocent_inv % % [geodetic, rot] = GEOCENTRICREVERSE(geocentric) % [geodetic, rot] = GEOCENTRICREVERSE(geocentric, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geocent_inv which is implemented as % native Matlab code. % % geocentric is an M x 3 matrix of geocentric coordinates % X = geocentric(:,1) in meters % Y = geocentric(:,2) in meters % Z = geocentric(:,3) in meters % % geodetic is an M x 3 matrix of geodetic coordinates % lat = geodetic(:,1) in degrees % lon = geodetic(:,2) in degrees % h = geodetic(:,3) in meters % rot is an M x 9 matrix % M = rot(:,1:9) rotation matrix in row major order. Pre-multiplying % a unit vector in geocentric coordinates by the transpose of M % transforms the vector to local cartesian coordinates % (east, north, up). % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also GEOCENT_INV. % Copyright (c) Charles Karney (2015) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [lat, lon, h, M] = geocent_inv(geocentric(:,1), geocentric(:,2), ... geocentric(:,3), ellipsoid); geodetic = [lat, lon, h]; rot = reshape(permute(M, [3, 2, 1]), [], 9); end GeographicLib-1.45/matlab/geographiclib-legacy/geocentricforward.cpp0000644000771000077100000000551712602735126025550 0ustar ckarneyckarney/** * \file geocentricforward.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geocentricforward.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geocentricforward.cpp #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("geodetic coordinates are not of type double."); if (!(mxGetN(prhs[0]) == 3 || mxGetN(prhs[0]) == 2)) mexErrMsgTxt("geodetic coordinates must be an M x 3 or M x 2 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } mwSize m = mxGetM(prhs[0]); double* lat = mxGetPr(prhs[0]); double* lon = lat + m; bool haveh = mxGetN(prhs[0]) == 3; double* h = haveh ? lat + 2*m : NULL; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* x = mxGetPr(plhs[0]); std::fill(x, x + 3*m, Math::NaN()); double* y = x + m; double* z = x + 2*m; double* rot = NULL; bool rotp = nlhs == 2; if (rotp) { plhs[1] = mxCreateDoubleMatrix(m, 9, mxREAL); rot = mxGetPr(plhs[1]); std::fill(rot, rot + 9*m, Math::NaN()); } try { std::vector rotv(rotp ? 9 : 0); const Geocentric c(a, f); for (mwIndex i = 0; i < m; ++i) { if (abs(lat[i]) <= 90 && lon[i] >= -540 && lon[i] < 540) { c.Forward(lat[i], lon[i], haveh ? h[i] : 0.0, x[i], y[i], z[i], rotv); if (rotp) { for (mwIndex k = 0; k < 9; ++k) rot[m * k + i] = rotv[k]; } } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.45/matlab/geographiclib-legacy/Contents.m0000644000771000077100000000237212602735126023304 0ustar ckarneyckarney% GeographicLib legacy functions % Version 1.42 2015-04-27 % % The functions in this directory are DEPRECATED. They are wrapper % routines for the GeographicLib toolbox, which is available at % % href="http://www.mathworks.com/matlabcentral/fileexchange/50605 % % Directly using the GeographicLib toolbox provides greater functionality % and flexiblility. % % Geodesics % geodesicdirect - Wrapper for geodreckon % geodesicinverse - Wrapper for geoddistance % geodesicline - Another wrapper for geodreckon % polygonarea - Wrapper for geodarea % % Grid systems % utmupsforward - Wrapper for utmups_fwd % utmupsreverse - Wrapper for utmups_inv % mgrsforward - Wrapper for mgrs_fwd % mgrsreverse - Wrapper for mgrs_inv % % Geoid lookup % geoidheight - Wrapper for geoid_height % % Geometric transformations % geocentricforward - Wrapper for geocent_fwd % geocentricreverse - Wrapper for geocent_inv % localcartesianforward - Wrapper for loccart_fwd % localcartesianreverse - Wrapper for loccart_inv % % Deprecated % geographiclibinterface - Compile interface code (DEPRECATED) % Copyright (c) Charles Karney (2015) . GeographicLib-1.45/matlab/geographiclib-legacy/geodesicinverse.m0000644000771000077100000000317412602735126024666 0ustar ckarneyckarneyfunction [geodesic, aux] = geodesicinverse(latlong, a, f) %GEODESICINVERSE Wrapper for geoddistance % % [geodesic, aux] = GEODESICINVERSE(latlong) % [geodesic, aux] = GEODESICINVERSE(latlong, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geoddistance which is implemented as % native Matlab code. % % latlong is an M x 4 matrix % latitude of point 1 = latlong(:,1) in degrees % longitude of point 1 = latlong(:,2) in degrees % latitude of point 2 = latlong(:,3) in degrees % longitude of point 2 = latlong(:,4) in degrees % % geodesic is an M x 3 matrix % azimuth at point 1 = geodesic(:,1) in degrees % azimuth at point 2 = geodesic(:,2) in degrees % distance between points 1 and 2 = geodesic(:,3) in meters % aux is an M x 5 matrix % spherical arc length = aux(:,1) in degrees % reduced length = aux(:,2) in meters % geodesic scale 1 to 2 = aux(:,3) % geodesic scale 2 to 1 = aux(:,4) % area under geodesic = aux(:,5) in meters^2 % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also GEODDISTANCE. % Copyright (c) Charles Karney (2015) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ... (latlong(:,1), latlong(:,2), latlong(:,3), latlong(:,4), ellipsoid); geodesic = [azi1, azi2, s12]; aux = [a12, m12, M12, M21, S12]; end GeographicLib-1.45/matlab/geographiclib-legacy/geodesicdirect.cpp0000644000771000077100000000677112602735126025021 0ustar ckarneyckarney/** * \file geodesicdirect.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010-2013) and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geodesicdirect.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geodesicdirect.cpp #include #include #include #include using namespace std; using namespace GeographicLib; template void compute(double a, double f, mwSize m, const double* geodesic, double* latlong, double* aux) { const double* lat1 = geodesic; const double* lon1 = geodesic + m; const double* azi1 = geodesic + 2*m; const double* s12 = geodesic + 3*m; double* lat2 = latlong; double* lon2 = latlong + m; double* azi2 = latlong + 2*m; double* a12 = NULL; double* m12 = NULL; double* M12 = NULL; double* M21 = NULL; double* S12 = NULL; if (aux) { a12 = aux; m12 = aux + m; M12 = aux + 2*m; M21 = aux + 3*m; S12 = aux + 4*m; } const G g(a, f); for (mwIndex i = 0; i < m; ++i) { if (abs(lat1[i]) <= 90 && lon1[i] >= -540 && lon1[i] < 540 && azi1[i] >= -540 && azi1[i] < 540) { if (aux) a12[i] = g.Direct(lat1[i], lon1[i], azi1[i], s12[i], lat2[i], lon2[i], azi2[i], m12[i], M12[i], M21[i], S12[i]); else g.Direct(lat1[i], lon1[i], azi1[i], s12[i], lat2[i], lon2[i], azi2[i]); } } } void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("geodesic coordinates are not of type double."); if (mxGetN(prhs[0]) != 4) mexErrMsgTxt("geodesic coordinates must be M x 4 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } mwSize m = mxGetM(prhs[0]); const double* geodesic = mxGetPr(prhs[0]); double* latlong = mxGetPr(plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL)); std::fill(latlong, latlong + 3*m, Math::NaN()); double* aux = nlhs == 2 ? mxGetPr(plhs[1] = mxCreateDoubleMatrix(m, 5, mxREAL)) : NULL; if (aux) std::fill(aux, aux + 5*m, Math::NaN()); try { if (std::abs(f) <= 0.02) compute(a, f, m, geodesic, latlong, aux); else compute(a, f, m, geodesic, latlong, aux); } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.45/matlab/geographiclib-legacy/geocentricreverse.cpp0000644000771000077100000000504412602735126025552 0ustar ckarneyckarney/** * \file geocentricreverse.cpp * \brief Matlab mex file for UTM/UPS to geographic conversions * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geocentricreverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geocentricreverse.cpp #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nrhs == 2) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("geocentric coordinates are not of type double."); if (mxGetN(prhs[0]) != 3) mexErrMsgTxt("geocentric coordinates must be M x 3 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 3) { if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) && mxGetNumberOfElements(prhs[1]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[1]); if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[2]); } mwSize m = mxGetM(prhs[0]); double* x = mxGetPr(prhs[0]); double* y = x + m; double* z = x + 2*m; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* lat = mxGetPr(plhs[0]); double* lon = lat + m; double* h = lat + 2*m; double* rot = NULL; bool rotp = nlhs == 2; if (rotp) { plhs[1] = mxCreateDoubleMatrix(m, 9, mxREAL); rot = mxGetPr(plhs[1]); } try { std::vector rotv(rotp ? 9 : 0); const Geocentric c(a, f); for (mwIndex i = 0; i < m; ++i) { c.Reverse(x[i], y[i], z[i], lat[i], lon[i], h[i], rotv); if (rotp) { for (mwIndex k = 0; k < 9; ++k) rot[m * k + i] = rotv[k]; } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.45/matlab/geographiclib-legacy/mgrsforward.m0000644000771000077100000000165512602735126024047 0ustar ckarneyckarneyfunction mgrs = mgrsforward(utmups, prec) %MGRSFORWARD Wrapper for mgrs_fwd % % mgrs = MGRSFORWARD(utmups) % mgrs = MGRSFORWARD(utmups, prec) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls mgrs_fwd which is implemented as native % Matlab code. % % utmups is an M x 4 matrix % easting = utmups(:,1) in meters % northing = utmups(:,2) in meters % zone = utmups(:,3) % hemi = utmups(:,4) % % zone = 0 for UPS, zone = [1,60] for UTM % hemi = 0 for southern hemisphere, hemi = 1 for northern hemisphere % prec = half the number of trailing digits in the MGRS string % (default 5) % % mgrs is a M x 1 cell array of MGRS strings. % % See also MGRS_FWD. % Copyright (c) Charles Karney (2015) . if nargin < 2 prec = 5; end mgrs = mgrs_fwd(utmups(:,1), utmups(:,2), utmups(:,3), utmups(:,4), prec); end GeographicLib-1.45/matlab/geographiclib-legacy/localcartesianreverse.m0000644000771000077100000000367612602735126026077 0ustar ckarneyckarneyfunction [geodetic, rot] = localcartesianreverse(origin, cartesian, a, f) %LOCALCARTESIANREVERSE Wrapper for loccart_inv % % [geodetic, rot] = LOCALCARTESIANREVERSE(origin, cartesian) % [geodetic, rot] = LOCALCARTESIANREVERSE(origin, cartesian, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls loccart_inv which is implemented as % native Matlab code. % % origin is a 1 x 3 or 1 x 2 matrix % lat0 = origin(1,1) in degrees % lon0 = origin(1,2) in degrees % h0 = origin(1,3) in meters (default 0 m) % cartesian is an M x 3 matrix of local cartesian coordinates % x = cartesian(:,1) in meters % y = cartesian(:,2) in meters % z = cartesian(:,3) in meters % % geodetic is an M x 3 matrix of geodetic coordinates % lat = geodetic(:,1) in degrees % lon = geodetic(:,2) in degrees % h = geodetic(:,3) in meters % rot is an M x 9 matrix % M = rot(:,1:9) rotation matrix in row major order. Pre-multiplying % a unit vector in local cartesian coordinates at (lat0, lon0, % h0) by the transpose of M transforms the vector to local % cartesian coordinates at (lat, lon, h). % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also LOCCART_INV. % Copyright (c) Charles Karney (2015) . if (nargin < 3) ellipsoid = defaultellipsoid; elseif (nargin < 4) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end if length(origin(:)) == 2 h0 = 0; elseif length(origin(:)) == 3 h0 = origin(3); else error('origin is not vector of length 2 or 3') end [lat, lon, h, M] = ... loccart_inv(origin(1), origin(2), h0, ... cartesian(:,1), cartesian(:,2), cartesian(:,3), ellipsoid); geodetic = [lat, lon, h]; rot = reshape(permute(M, [3, 2, 1]), [], 9); end GeographicLib-1.45/matlab/geographiclib-legacy/mgrsreverse.m0000644000771000077100000000221312602735126024045 0ustar ckarneyckarneyfunction [utmups, prec] = mgrsreverse(mgrs) %MGRSREVERSE Wrapper for mgrs_inv % % [utmups, prec] = MGRSREVERSE(mgrs) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls mgrs_inv which is implemented as native % Matlab code. % % mgrs is a M x 1 cell array of MGRS strings, e.g., % mgrsreverse({ '38SMB4488'; '12TUK3393' }) % % utmups is an M x 4 matrix % easting = utmups(:,1) in meters % northing = utmups(:,2) in meters % zone = utmups(:,3) % hemi = utmups(:,4) % prec is an M x 1 matrix % precision = prec(:,1) % = half the number of trailing digits in the MGRS string % % zone = 0 for UPS, zone = [1,60] for UTM. % hemi = 0 for southern hemisphere, hemi = 1 for northern hemisphere % prec = precision, half the number of trailing digits % % The position is the center of the MGRS square. To obtain the % SW corner subtract 0.5 * 10^(5-prec) from the easting and northing. % % See also MGRS_INV. % Copyright (c) Charles Karney (2015) . [x, y, z, h, prec] = mgrs_inv(mgrs); utmups = [x, y, z, h]; end GeographicLib-1.45/matlab/geographiclib-legacy/geocentricforward.m0000644000771000077100000000267012602735126025217 0ustar ckarneyckarneyfunction [geocentric, rot] = geocentricforward(geodetic, a, f) %GEOCENTRICFORWARD Wrapper for geocent_fwd % % [geocentric, rot] = GEOCENTRICFORWARD(geodetic) % [geocentric, rot] = GEOCENTRICFORWARD(geodetic, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geocent_fwd which is implemented as % native Matlab code. % % geodetic is an M x 3 or M x 2 matrix of geodetic coordinates % lat = geodetic(:,1) in degrees % lon = geodetic(:,2) in degrees % h = geodetic(:,3) in meters (default 0 m) % % geocentric is an M x 3 matrix of geocentric coordinates % X = geocentric(:,1) in meters % Y = geocentric(:,2) in meters % Z = geocentric(:,3) in meters % rot is an M x 9 matrix % M = rot(:,1:9) rotation matrix in row major order. Pre-multiplying % a unit vector in local cartesian coordinates (east, north, up) % by M transforms the vector to geocentric coordinates. % % See also GEOCENT_FWD. % Copyright (c) Charles Karney (2015) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end if size(geodetic,2) < 3 h = 0; else h = geodetic(:,3); end [X, Y, Z, M] = geocent_fwd(geodetic(:,1), geodetic(:,2), h, ellipsoid); geocentric = [X, Y, Z]; rot = reshape(permute(M, [3, 2, 1]), [], 9); end GeographicLib-1.45/matlab/geographiclib-legacy/geodesicdirect.m0000644000771000077100000000316412602735126024464 0ustar ckarneyckarneyfunction [latlong, aux] = geodesicdirect(geodesic, a, f) %GEODESICDIRECT Wrapper for geodreckon % % [latlong, aux] = GEODESICDIRECT(geodesic) % [latlong, aux] = GEODESICDIRECT(geodesic, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geodreckon which is implemented as % native Matlab code. % % geodesic is an M x 4 matrix % latitude of point 1 = latlong(:,1) in degrees % longitude of point 1 = latlong(:,2) in degrees % azimuth at point 1 = latlong(:,3) in degrees % distance to point 2 = latlong(:,4) in meters % % latlong is an M x 3 matrix % latitude of point 2 = geodesic(:,1) in degrees % longitude of point 2 = geodesic(:,2) in degrees % azimuth at point 2 = geodesic(:,3) in degrees % aux is an M x 5 matrix % spherical arc length = aux(:,1) in degrees % reduced length = aux(:,2) in meters % geodesic scale 1 to 2 = aux(:,3) % geodesic scale 2 to 1 = aux(:,4) % area under geodesic = aux(:,5) in meters^2 % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also GEODRECKON. % Copyright (c) Charles Karney (2015) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [lat2, lon2, azi2, S12, m12, M12, M21, a12] = geodreckon ... (geodesic(:,1), geodesic(:,2), geodesic(:,4), geodesic(:,3), ... ellipsoid); latlong = [lat2, lon2, azi2]; aux = [a12, m12, M12, M21, S12]; end GeographicLib-1.45/matlab/geographiclib-legacy/geoidheight.cpp0000644000771000077100000000624212602735126024315 0ustar ckarneyckarney/** * \file geoidheight.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic geoidheight.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic geoidheight.cpp #include #include #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 1) mexErrMsgTxt("One input argument required."); else if (nrhs > 3) mexErrMsgTxt("More than three input arguments specified."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("latlong coordinates are not of type double."); if (mxGetN(prhs[0]) != 2) mexErrMsgTxt("latlong coordinates must be M x 2 matrix."); mwSize m = mxGetM(prhs[0]); double* lat = mxGetPr(prhs[0]); double* lon = lat + m; plhs[0] = mxCreateDoubleMatrix(m, 1, mxREAL); double* h = mxGetPr(plhs[0]); std::fill(h, h + m, Math::NaN()); double* gradn = NULL; double* grade = NULL; bool gradient = nlhs == 2; if (gradient) { plhs[1] = mxCreateDoubleMatrix(m, 2, mxREAL); gradn = mxGetPr(plhs[1]); std::fill(gradn, gradn + 2*m, Math::NaN()); grade = gradn + m; } string geoidname("egm96-5"); if (nrhs > 1) { if (!mxIsChar(prhs[1])) mexErrMsgTxt("geoid name must be a string."); if (mxGetM(prhs[1]) == 0) mexErrMsgTxt("geoid name cannot be empty."); if (mxGetM(prhs[1]) != 1) mexErrMsgTxt("geoid name cannot be a vector of strings."); mwSize n = mxGetN(prhs[1]); if (n < 1) mexErrMsgTxt("geoid name cannot be empty."); mxChar* ptr = mxGetChars(prhs[1]); geoidname.resize(n); for (mwIndex i = 0; i < n; ++i) geoidname[i] = ptr[i]; } string geoiddir(""); if (nrhs > 2) { if (!mxIsChar(prhs[2])) mexErrMsgTxt("geoid directory must be a string."); if (mxGetM(prhs[2]) > 1) mexErrMsgTxt("geoid directory cannot be a vector of strings."); mwSize n = mxGetN(prhs[2]); if (n > 0 && mxGetM(prhs[2]) == 1) { mxChar* ptr = mxGetChars(prhs[2]); geoiddir.resize(n); for (mwIndex i = 0; i < n; ++i) geoiddir[i] = ptr[i]; } // else string is empty and do nothing } try { const Geoid g(geoidname, geoiddir); for (mwIndex i = 0; i < m; ++i) { if (abs(lat[i]) <= 90 && lon[i] >= -540 && lon[i] < 540) { // g() can throw an exception, e.g., because of an I/O failure. Treat // this as fatal. if (gradient) h[i] = g(lat[i], lon[i], gradn[i], grade[i]); else h[i] = g(lat[i], lon[i]); } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.45/matlab/geographiclib-legacy/geodesicline.m0000644000771000077100000000342412602735126024140 0ustar ckarneyckarneyfunction [latlong, aux] = geodesicline(lat1, lon1, azi1, distances, a, f) %GEODESICLINE Another wrapper for geodreckon % % [latlong, aux] = GEODESICLINE(lat1, lon1, azi1, distances) % [latlong, aux] = GEODESICLINE(lat1, lon1, azi1, distances, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geodreckon which is implemented as % native Matlab code. % % lat1 is the latitude of point 1 (scalar) in degrees % lon1 is the longitude of point 1 (scalar) in degrees % azi1 is the azimuth at point 1 (scalar) in degrees % distances is an M x 1 vector of distances to point 2 in meters % % latlong is an M x 3 matrix % latitude of point 2 = geodesic(:,1) in degrees % longitude of point 2 = geodesic(:,2) in degrees % azimuth at point 2 = geodesic(:,3) in degrees % aux is an M x 5 matrix % spherical arc length = aux(:,1) in degrees % reduced length = aux(:,2) in meters % geodesic scale 1 to 2 = aux(:,3) % geodesic scale 2 to 1 = aux(:,4) % area under geodesic = aux(:,5) in meters^2 % % a = major radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % The result is the same as produced by % geodesicdirect([repmat([lat1, lon1, azi1],size(distances)), ... % distances], a, f) % % See also GEODRECKON. % Copyright (c) Charles Karney (2015) . if (nargin < 5) ellipsoid = defaultellipsoid; elseif (nargin < 6) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [lat2, lon2, azi2, S12, m12, M12, M21, a12] = ... geodreckon(lat1, lon1, distances, azi1, ellipsoid); latlong = [lat2, lon2, azi2]; aux = [a12, m12, M12, M21, S12]; end GeographicLib-1.45/matlab/geographiclib-legacy/geoidheight.m0000644000771000077100000000237712602735126023774 0ustar ckarneyckarneyfunction height = geoidheight(latlong, geoidname, geoiddir) %GEOIDHEIGHT Wrapper for geoid_height % % height = GEOIDHEIGHT(latlong) % height = GEOIDHEIGHT(latlong, geoidname, geoiddir) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geoid_height which is implemented as % native Matlab code. (Note that, unlike the compiled interface, this % wrapper function does not return the gradient of the geoid height; this % is now a deprecated feature of the Geoid class.) % % latlong is an M x 2 matrix % latitude = latlong(:,1) in degrees % longitude = latlong(:,2) in degrees % geoidname is the name of the geoid; choices are (default egm96-5) % egm84-30 egm84-15 % egm96-15 egm96-5 % egm2008-5 egm2008-2_5 egm2008-1 % geoiddir is the directory containing the geoid models (default empty % string meaning system default) % % height is an M x 1 matrix % geoidheight = height(:,1) height of geoid in meters % % See also GEOID_HEIGHT. % Copyright (c) Charles Karney (2015) . if nargin < 2 geoidname = ''; end if nargin < 3 geoiddir = ''; end height = geoid_height(latlong(:,1), latlong(:,2), geoidname, geoiddir); end GeographicLib-1.45/matlab/geographiclib-legacy/localcartesianreverse.cpp0000644000771000077100000000622012602735126026411 0ustar ckarneyckarney/** * \file localcartesianreverse.cpp * \brief Matlab mex file for UTM/UPS to geographic conversions * * Copyright (c) Charles Karney (2011) and licensed under * the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ **********************************************************************/ // Compile in Matlab with // [Unix] // mex -I/usr/local/include -L/usr/local/lib -Wl,-rpath=/usr/local/lib // -lGeographic localcartesianreverse.cpp // [Windows] // mex -I../include -L../windows/Release // -lGeographic localcartesianreverse.cpp #include #include using namespace std; using namespace GeographicLib; void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { if (nrhs < 2) mexErrMsgTxt("Two input arguments required."); else if (nrhs > 4) mexErrMsgTxt("More than four input arguments specified."); else if (nrhs == 3) mexErrMsgTxt("Must specify flattening with the major radius."); else if (nlhs > 2) mexErrMsgTxt("More than two output arguments specified."); if (!( mxIsDouble(prhs[0]) && !mxIsComplex(prhs[0]) )) mexErrMsgTxt("origin is not of type double."); if (!( mxGetM(prhs[0]) == 1 && (mxGetN(prhs[0]) == 2 || mxGetN(prhs[0]) == 3) )) mexErrMsgTxt("origin be 1 x 3 or 1 x 2 matrix."); double* origin = mxGetPr(prhs[0]); double lat0 = origin[0], lon0 = origin[1], h0 = mxGetN(prhs[0]) == 3 ? origin[2] : 0; if (!( mxIsDouble(prhs[1]) && !mxIsComplex(prhs[1]) )) mexErrMsgTxt("local cartesian coordinates are not of type double."); if (mxGetN(prhs[1]) != 3) mexErrMsgTxt("local cartesian coordinates must be M x 3 matrix."); double a = Constants::WGS84_a(), f = Constants::WGS84_f(); if (nrhs == 4) { if (!( mxIsDouble(prhs[2]) && !mxIsComplex(prhs[2]) && mxGetNumberOfElements(prhs[2]) == 1 )) mexErrMsgTxt("Major radius is not a real scalar."); a = mxGetScalar(prhs[2]); if (!( mxIsDouble(prhs[3]) && !mxIsComplex(prhs[3]) && mxGetNumberOfElements(prhs[3]) == 1 )) mexErrMsgTxt("Flattening is not a real scalar."); f = mxGetScalar(prhs[3]); } mwSize m = mxGetM(prhs[1]); double* x = mxGetPr(prhs[1]); double* y = x + m; double* z = x + 2*m; plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL); double* lat = mxGetPr(plhs[0]); double* lon = lat + m; double* h = lat + 2*m; double* rot = NULL; bool rotp = nlhs == 2; if (rotp) { plhs[1] = mxCreateDoubleMatrix(m, 9, mxREAL); rot = mxGetPr(plhs[1]); } try { std::vector rotv(rotp ? 9 : 0); const Geocentric c(a, f); if (!(abs(lat0) <= 90)) throw GeographicErr("Invalid latitude"); if (!(lon0 >= -540 || lon0 < 540)) throw GeographicErr("Invalid longitude"); const LocalCartesian l(lat0, lon0, h0, c); for (mwIndex i = 0; i < m; ++i) { l.Reverse(x[i], y[i], z[i], lat[i], lon[i], h[i], rotv); if (rotp) { for (mwIndex k = 0; k < 9; ++k) rot[m * k + i] = rotv[k]; } } } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.45/matlab/geographiclib/geocent_fwd.m0000644000771000077100000000331612602735126022530 0ustar ckarneyckarneyfunction [X, Y, Z, M] = geocent_fwd(lat, lon, h, ellipsoid) %GEOCENT_FWD Conversion from geographic to geocentric coordinates % % [X, Y, Z] = GEOCENT_FWD(lat, lon) % [X, Y, Z] = GEOCENT_FWD(lat, lon, h) % [X, Y, Z, M] = GEOCENT_FWD(lat, lon, h, ellipsoid) % % converts from geographic coordinates, lat, lon, h to geocentric % coordinates X, Y, Z. lat, lon, h can be scalars or arrays of equal % size. lat and lon are in degrees. h (default 0) and X, Y, Z are in % meters. The ellipsoid vector is of the form [a, e], where a is the % equatorial radius in meters, e is the eccentricity. If ellipsoid is % omitted, the WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. The inverse operation is given by % geocent_inv. % % M is the 3 x 3 rotation matrix for the conversion. Pre-multiplying a % unit vector in local cartesian coordinates (east, north, up) by M % transforms the vector to geocentric coordinates. % % See also GEOCENT_INV, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2015) . narginchk(2, 4) if nargin < 3, h = 0; end if nargin < 4, ellipsoid = defaultellipsoid; end try z = zeros(size(lat + lon + h)); catch error('lat, lon, h have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end lat = LatFix(lat) + z; lon = lon + z; h = h + z; a = ellipsoid(1); e2 = ellipsoid(2)^2; e2m = 1 - e2; [slam, clam] = sincosdx(lon); [sphi, cphi] = sincosdx(lat); n = a./sqrt(1 - e2 * sphi.^2); Z = (e2m * n + h) .* sphi; X = (n + h) .* cphi; Y = X .* slam; X = X .* clam; if nargout > 3 M = GeoRotation(sphi, cphi, slam, clam); end end GeographicLib-1.45/matlab/geographiclib/geoddoc.m0000644000771000077100000002075612602735126021657 0ustar ckarneyckarneyfunction geoddoc %GEODDOC Geodesics on an ellipsoid of revolution % % The routines geoddistance, geodreckon, and geodarea solve various % problems involving geodesics on the surface of an ellipsoid of % revolution. These are based on the paper % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://dx.doi.org/10.1007/s00190-012-0578-z % Addenda: http://geographiclib.sf.net/geod-addenda.html % % which, in turn, is based on the classic solution of the geodesic % problems pioneered by Legendre (1806), Bessel (1825), and Helmert % (1880). Links for these and other original papers on geodesics are % given in % % http://geographiclib.sf.net/geodesic-papers/biblio.html % % The shortest path between two points on the ellipsoid at (lat1, lon1) % and (lat2, lon2) is called the geodesic. Its length is s12 and the % geodesic from point 1 to point 2 has forward azimuths azi1 and azi2 at % the two end points. % % Traditionally two geodesic problems are considered: % * the direct problem -- given lat1, lon1, s12, and azi1, determine % lat2, lon2, and azi2. This is solved by geodreckon. % * the inverse problem -- given lat1, lon1, lat2, lon2, determine s12, % azi1, and azi2. This is solved by geoddistance. % In addition, geodarea computes the area of an ellipsoidal polygon % where the edges are defined as shortest geodesics. % % The parameters of the ellipsoid are specified by the optional ellipsoid % argument to the routines. This is a two-element vector of the form % [a,e], where a is the equatorial radius, e is the eccentricity e = % sqrt(a^2-b^2)/a, and b is the polar semi-axis. Typically, a and b are % measured in meters and the linear and area quantities returned by the % routines are then in meters and meters^2. However, other units can be % employed. If ELLIPSOID is omitted, then the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is assumed [6378137, % 0.0818191908426215] corresponding to a = 6378137 meters and a % flattening f = (a-b)/a = 1/298.257223563. The flattening and % eccentricity are related by % % e = sqrt(f * (2 - f)) % f = e^2 / (1 + sqrt(1 - e^2)) % % (The functions ecc2flat and flat2ecc implement these conversions.) For % a sphere, set e = 0; for a prolate ellipsoid (b > a), specify e as a % pure imaginary number. % % All angles (latitude, longitude, azimuth) are measured in degrees with % latitudes increasing northwards, longitudes increasing eastwards, and % azimuths measured clockwise from north. For a point at a pole, the % azimuth is defined by keeping the longitude fixed, writing lat = % +/-(90-eps), and taking the limit eps -> 0+. % % The routines also calculate several other quantities of interest % * 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 (lat1,lon1), (0,lon1), (0,lon2), and % (lat2,lon2). It is given in meters^2. % * m12, the reduced length of the geodesic is defined such that if the % initial azimuth is perturbed by dazi1 (radians) then the second % point is displaced by m12 dazi1 in the direction perpendicular to % the geodesic. m12 is given in meters. On a curved surface the % reduced length obeys a symmetry relation, m12 + m21 = 0. On a flat % surface, we have m12 = s12. % * M12 and M21 are geodesic scales. If two geodesics are parallel at % point 1 and separated by a small distance dt, then they are % separated by a distance M12 dt at point 2. M21 is defined % similarly (with the geodesics being parallel to one another at % point 2). M12 and M21 are dimensionless quantities. On a flat % surface, we have M12 = M21 = 1. % * a12 is the arc length on the auxiliary sphere. This is a construct % for converting the problem to one in spherical trigonometry. a12 % is measured in degrees. The spherical arc length from one equator % crossing to the next is always 180 degrees. % % If points 1, 2, and 3 lie on a single geodesic, then the following % addition rules hold: % * s13 = s12 + s23 % * a13 = a12 + a23 % * S13 = S12 + S23 % * m13 = m12*M23 + m23*M21 % * M13 = M12*M23 - (1 - M12*M21) * m23/m12 % * M31 = M32*M21 - (1 - M23*M32) * m12/m23 % % Restrictions on the inputs: % * All latitudes must lie in [-90, 90]. % * The distance s12 is unrestricted. This allows geodesics to wrap % around the ellipsoid. Such geodesics are no longer shortest paths. % However they retain the property that they are the straightest % curves on the surface. % * Similarly, the spherical arc length, a12, is unrestricted. % * The equatorial radius, a, must be positive. % * The eccentricity, e, should satisfy abs(e) < 0.2 in order to % retain full accuracy (this corresponds to flattenings satisfying % abs(f) <= 1/50, approximately). This condition holds for most % applications in geodesy. % % Larger values of e can be used with a corresponding drop in accuracy. % The following table gives the approximate maximum error in % geoddistance and geodreckon (expressed as a distance) for an ellipsoid % with the same major radius as the WGS84 ellipsoid and different values % of the flattening (nm means nanometer and um means micrometer). % % |f| error % 0.01 25 nm % 0.02 30 nm % 0.05 10 um % 0.1 1.5 mm % 0.2 300 mm % % The shortest distance returned by GEODDISTANCE 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: % * lat1 = -lat2 (with neither point at a pole). If azi1 = azi2, the % geodesic is unique. Otherwise there are two geodesics and the % second one is obtained by setting [azi1,azi2] = [azi2,azi1], % [M12,M21] = [M21,M12], S12 = -S12. (This occurs when the longitude % difference is near +/-180 for oblate ellipsoids.) % * lon2 = lon1 +/- 180 (with neither point at a pole). If azi1 = 0 or % +/-180, the geodesic is unique. Otherwise there are two geodesics % and the second one is obtained by setting [azi1,azi2] = % [-azi1,-azi2], S12 = -S12. (This occurs when lat2 is near -lat1 % for prolate ellipsoids.) % * Points 1 and 2 at opposite poles. There are infinitely many % geodesics which can be generated by setting [azi1,azi2] = % [azi1,azi2] + [d,-d], for arbitrary d. (For spheres, this % prescription applies when points 1 and 2 are antipodal.) % * s12 = 0 (coincident points). There are infinitely many geodesics % which can be generated by setting [azi1,azi2] = [azi1,azi2] + % [d,d], for arbitrary d. % % In order to compute intermediate points on a geodesic, proceed as in % the following example which plots the track from JFK Airport to % Singapore Changi Airport. % % lat1 = 40.64; lon1 = -73.78; % lat2 = 1.36; lon2 = 103.99; % [s12, azi1] = geoddistance(lat1, lon1, lat2, lon2); % [lats, lons] = geodreckon(lat1, lon1, s12 * [0:100]/100, azi1); % plot(lons, lats); % % The restriction on e above arises because the formulation is in terms % of series expansions in e^2. The exact solutions (valid for any e) can % be expressed in terms of elliptic integrals. These are provided by the % C++ classes GeodesicExact and GeodesicLineExact. % % The routines duplicate some of the functionality of the distance, % reckon, and areaint functions in the MATLAB mapping toolbox. The major % improvements offered by geoddistance, geodreckon, and geodarea are % % * The routines are accurate to round off for abs(e) < 0.2. For % example, for the WGS84 ellipsoid, the error in the distance % returned by geoddistance is less then 15 nanometers. % * The routines work for prolate (as well as oblate) ellipsoids. % * geoddistance converges for all inputs. % * Differential and integral properties of the geodesics are computed. % * geodarea is accurate regardless of the length of the edges of the % polygon. % % See also GEODDISTANCE, GEODRECKON, GEODAREA, % DEFAULTELLIPSOID, ECC2FLAT, FLAT2ECC, % GEODESICDIRECT, GEODESICLINE, GEODESICINVERSE, POLYGONAREA. % Copyright (c) Charles Karney (2012-2015) . help geoddoc end GeographicLib-1.45/matlab/geographiclib/cassini_fwd.m0000644000771000077100000000552512602735126022541 0ustar ckarneyckarneyfunction [x, y, azi, rk] = cassini_fwd(lat0, lon0, lat, lon, ellipsoid) %CASSINI_FWD Forward Cassini-Soldner projection % % [x, y] = CASSINI_FWD(lat0, lon0, lat, lon) % [x, y, azi, rk] = CASSINI_FWD(lat0, lon0, lat, lon, ellipsoid) % % performs the forward Cassini-Soldner projection of points (lat,lon) to % (x,y) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. projdoc % defines the projection and gives the restrictions on the allowed ranges % of the arguments. The inverse projection is given by cassini_inv. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the easting (x) direction and rk is the reciprocal of % the northing (y) scale. The scale in the easting direction is 1. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % See also PROJDOC, CASSINI_INV, GEODDISTANCE, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try Z = zeros(size(lat0 + lon0 + lat + lon)); catch error('lat0, lon0, lat, lon have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end degree = pi/180; f = ecc2flat(ellipsoid(2)); dlon = AngDiff(lon0, lon) + Z; [s12, azi1, azi2, ~, ~, ~, ~, sig12] = ... geoddistance(lat, -abs(dlon), lat, abs(dlon), ellipsoid); sig12 = 0.5 * sig12; s12 = 0.5 * s12; c = s12 == 0; da = AngDiff(azi1, azi2)/2; s = abs(dlon) <= 90; azi1(c & s) = 90 - da(c & s); azi2(c & s) = 90 + da(c & s); s = ~s; azi1(c & s) = -90 - da(c & s); azi2(c & s) = -90 + da(c & s); c = dlon < 0; azi2(c) = azi1(c); s12(c) = -s12(c); sig12(c) = -sig12(c); x = s12; azi = AngNormalize(azi2); [~, ~, ~, ~, ~, ~, rk] = ... geodreckon(lat, dlon, -sig12, azi, ellipsoid, true); [sbet, cbet] = sincosdx(lat); [sbet, cbet] = norm2((1-f) * sbet, cbet); [sbet0, cbet0] = sincosdx(lat0); [sbet0, cbet0] = norm2((1-f) * sbet0, cbet0); [salp, calp] = sincosdx(azi); salp0 = salp .* cbet; calp0 = hypot(calp, salp .* sbet); sbet1 = calp0; c = lat + Z >= 0; sbet1(~c) = -sbet1(~c); cbet1 = abs(salp0); c = abs(dlon) <= 90; cbet1(~c) = -cbet1(~c); sbet01 = sbet1 .* cbet0 - cbet1 .* sbet0; cbet01 = cbet1 .* cbet0 + sbet1 .* sbet0; sig01 = atan2(sbet01, cbet01) / degree; [~, ~, ~, ~, ~, ~, ~, y] = geodreckon(lat0, 0, sig01, 0, ellipsoid, true); end GeographicLib-1.45/matlab/geographiclib/cassini_inv.m0000644000771000077100000000324512602735126022552 0ustar ckarneyckarneyfunction [lat, lon, azi, rk] = cassini_inv(lat0, lon0, x, y, ellipsoid) %CASSINI_INV Inverse Cassini-Soldner projection % % [lat, lon] = CASSINI_INV(lat0, lon0, x, y) % [lat, lon, azi, rk] = CASSINI_INV(lat0, lon0, x, y, ellipsoid) % % performs the inverse Cassini-Soldner projection of points (x,y) to % (lat,lon) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. projdoc % defines the projection and gives the restrictions on the allowed ranges % of the arguments. The forward projection is given by cassini_fwd. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the easting (x) direction and rk is the reciprocal of % the northing (y) scale. The scale in the easting direction is 1. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % See also PROJDOC, CASSINI_FWD, GEODRECKON, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try [~] = lat0 + lon0 + x + y; catch error('lat0, lon0, x, y have incompatible sizes') end [lat1, lon1, azi0] = geodreckon(lat0, lon0, y, 0, ellipsoid); [lat, lon, azi, ~, ~, rk] = ... geodreckon(lat1, lon1, x, azi0 + 90, ellipsoid); end GeographicLib-1.45/matlab/geographiclib/defaultellipsoid.m0000644000771000077100000000064312602735126023575 0ustar ckarneyckarneyfunction ellipsoid = defaultellipsoid %DEFAULTELLIPSOID Return the WGS84 ellipsoid % % ellipsoid = DEFAULTELLIPSOID % % returns a vector of the equatorial radius and eccentricity for the % WGS84 ellipsoid. use ecc2flat and flat2ecc to convert between % the eccentricity and the flattening. % % See also ECC2FLAT, FLAT2ECC. a = 6378137; f = 1/298.257223563; e = flat2ecc(f); ellipsoid = [a, e]; end GeographicLib-1.45/matlab/geographiclib/geoid_load.m0000644000771000077100000000447412602735126022340 0ustar ckarneyckarneyfunction geoid = geoid_load(name, dir) %GEOID_LOAD Load a geoid model % % geoid = GEOID_LOAD % geoid = GEOID_LOAD(geoidname) % geoid = GEOID_LOAD(geoidname, geoiddir) % % Loads geoid data into the workspace. geoid_height uses this function % to load the geoid data it needs. The possible geoids are % % egm84-30 egm84-15 % egm96-15 egm96-5 % egm2008-5 egm2008-2_5 egm2008-1 % % The first part of the name is the geoid model. The second part gives % the resolution of the gridded data (in arc-seconds). Thus egm2008-2_5 % is the egm2008 geoid model at a resolution of 2.5". % % If geoidname is not specified (or is empty), the environment variable % GEOGRAPHICLIB_GEOID_NAME is used; if this is not defined then egm96-5 % is used. % % GEOID_LOAD determines the directory with the geoid data as follows % (here an empty string is the same as undefined): % % * if geoiddir is specified, then look there; otherwise ... % * if the environment variable GEOGRAPHICLIB_GEOID_PATH is defined, % look there; otherwise ... % * if the environment variable GEOGRAPHICLIB_DATA is defined, look in % [GEOGRAPHICLIB_DATA '/geoids']; otherwise ... % * look in /usr/local/share/GeographicLib/geoids (for non-Windows % systems) or C:/ProgramData/GeographicLib/geoids (for Windows % systems). % % If your geoid models are installed in /usr/share/GeographicLib/geoids, % for example, you can avoid the need to supply the geoiddir argument % with % % setenv GEOGRAPHICLIB_DATA /usr/share/GeographicLib % % The geoid data is loaded from the image file obtained by concatenating % the components to give geoiddir/geoidname.pgm. These files store a % grid of geoid heights above the ellipsoid encoded as 16-bit integers. % % The returned geoid can be passed to geoid_height to determine the % height of the geoid above the ellipsoid. % % Information on downloading and installing the data for the supported % geoid models is available at % % http://geographiclib.sf.net/html/geoid.html#geoidinst % % See also GEOID_HEIGHT. % Copyright (c) Charles Karney (2015) . if nargin < 1 file = geoid_file; elseif nargin < 2 file = geoid_file(name); else file = geoid_file(name, dir); end geoid = geoid_load_file(file); end GeographicLib-1.45/matlab/geographiclib/loccart_inv.m0000644000771000077100000000374712602735126022557 0ustar ckarneyckarneyfunction [lat, lon, h, M] = loccart_inv(lat0, lon0, h0, x, y, z, ellipsoid) %LOCCART_INV Convert local cartesian to geographic coordinates % % [lat, lon, h] = LOCCART_INV(lat0, lon0, h0, x, y, z) % [lat, lon, h, M] = LOCCART_INV(lat0, lon0, h0, x, y, z, ellipsoid) % % converts from local cartesian coordinates, x, y, z, centered at lat0, % lon0, h0 to geodetic coordinates, lat, lon, h. Latitudes and % longitudes are in degrees; h, h0, x, y, z are in meters. x, y, z can % be scalars or arrays of equal size. lat0, lon0, h0 must be scalars. % The ellipsoid vector is of the form [a, e], where a is the equatorial % radius in meters, e is the eccentricity. If ellipsoid is omitted, the % WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. The forward operation is given by % loccart_fwd. % % M is the 3 x 3 rotation matrix for the conversion. Pre-multiplying a % unit vector in local cartesian coordinates at (lat0, lon0, h0) by the % transpose of M transforms the vector to local cartesian coordinates at % (lat, lon, h). % % See also LOCCART_FWD, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2015) . narginchk(6, 7) if nargin < 7, ellipsoid = defaultellipsoid; end try S = size(x + y + z); catch error('x, y, z have incompatible sizes') end if ~(isscalar(lat0) && isscalar(lon0) && isscalar(h0)) error('lat0, lon0, h0 must be scalar') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end num = prod(S); Z = zeros(num, 1); x = x(:) + Z; y = y(:) + Z; z = z(:) + Z; [X0, Y0, Z0, M0] = geocent_fwd(lat0, lon0, h0, ellipsoid); r = [x, y, z] * M0'; X = r(:, 1) + X0; Y = r(:, 2) + Y0; Z = r(:, 3) + Z0; [lat , lon , h , M] = geocent_inv(X, Y, Z, ellipsoid); lat = reshape(lat, S); lon = reshape(lon, S); h = reshape(h, S); if nargout > 3 for i = 1:num M(:,:, i) = M0' * M(:,:, i); end M = reshape(M, [3, 3, S]); end end GeographicLib-1.45/matlab/geographiclib/gnomonic_fwd.m0000644000771000077100000000512112602735126022711 0ustar ckarneyckarneyfunction [x, y, azi, rk] = gnomonic_fwd(lat0, lon0, lat, lon, ellipsoid) %GNOMONIC_FWD Forward ellipsoidal gnomonic projection % % [x, y] = GNOMONIC_FWD(lat0, lon0, lat, lon) % [x, y, azi, rk] = GNOMONIC_FWD(lat0, lon0, lat, lon, ellipsoid) % % performs the forward ellipsoidal gnomonic projection of points % (lat,lon) to (x,y) using (lat0,lon0) as the center of projection. % These input arguments can be scalars or arrays of equal size. The % ellipsoid vector is of the form [a, e], where a is the equatorial % radius in meters, e is the eccentricity. If ellipsoid is omitted, the % WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. projdoc defines the projection and gives % the restrictions on the allowed ranges of the arguments. The inverse % projection is given by gnomonic_inv. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the geodesic from the center of projection and rk is % the reciprocal of the azimuthal scale. The scale in the radial % direction is 1/rk^2. % % If the point lies "over the horizon", i.e., if rk <= 0, then NaNs are % returned for x and y (the correct values are returned for azi and rk). % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % The ellipsoidal gnomonic projection is an azimuthal projection about a % center point. All geodesics through the center point are projected % into straight lines with the correct azimuth relative to the center % point. In addition all geodesics are pass close to the center point % are very nearly straight. The projection is derived in Section 8 of % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://dx.doi.org/10.1007/s00190-012-0578-z % Addenda: http://geographiclib.sf.net/geod-addenda.html % % which also includes methods for solving the "intersection" and % "interception" problems using the gnomonic projection. % % See also PROJDOC, GNOMONIC_INV, GEODDISTANCE, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try [~] = lat0 + lon0 + lat + lon; catch error('lat0, lon0, lat, lon have incompatible sizes') end [~, azi0, azi, ~, m, M] = geoddistance(lat0, lon0, lat, lon, ellipsoid); rho = m ./ M; [x, y] = sincosdx(azi0); x = rho .* x; y = rho .* y; rk = M; x(M <= 0) = nan; y(M <= 0) = nan; end GeographicLib-1.45/matlab/geographiclib/geoddistance.m0000644000771000077100000004430012602735126022673 0ustar ckarneyckarneyfunction [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ... (lat1, lon1, lat2, lon2, ellipsoid) %GEODDISTANCE Distance between points on an ellipsoid % % [s12, azi1, azi2] = GEODDISTANCE(lat1, lon1, lat2, lon2) % [s12, azi1, azi2, S12, m12, M12, M21, a12] = % GEODDISTANCE(lat1, lon1, lat2, lon2, ellipsoid) % % solves the inverse geodesic problem of finding of length and azimuths % of the shortest geodesic between points specified by lat1, lon1, lat2, % lon2. The input latitudes and longitudes, lat1, lon1, lat2, lon2, can % be scalars or arrays of equal size and must be expressed in degrees. % The ellipsoid vector is of the form [a, e], where a is the equatorial % radius in meters, e is the eccentricity. If ellipsoid is omitted, the % WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. The output s12 is the distance in meters % and azi1 and azi2 are the forward azimuths at the end points in % degrees. The other optional outputs, S12, m12, M12, M21, a12 are % documented in geoddoc. geoddoc also gives the restrictions on the % allowed ranges of the arguments. % % When given a combination of scalar and array inputs, the scalar inputs % are automatically expanded to match the size of the arrays. % % This is an implementation of the algorithm given in % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://dx.doi.org/10.1007/s00190-012-0578-z % Addenda: http://geographiclib.sf.net/geod-addenda.html % % This function duplicates some of the functionality of the distance % function in the MATLAB mapping toolbox. Differences are % % * When the ellipsoid argument is omitted, use the WGS84 ellipsoid. % * The routines work for prolate (as well as oblate) ellipsoids. % * The azimuth at the second end point azi2 is returned. % * The solution is accurate to round off for abs(e) < 0.2. % * The algorithm converges for all pairs of input points. % * Additional properties of the geodesic are calcuated. % % See also GEODDOC, GEODRECKON, GEODAREA, GEODESICINVERSE, % DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . % % This is a straightforward transcription of the C++ implementation in % GeographicLib and the C++ source should be consulted for additional % documentation. This is a vector implementation and the results returned % with array arguments are identical to those obtained with multiple calls % with scalar arguments. The biggest change was to eliminate the branching % to allow a vectorized solution. narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat1 + lon1 + lat2 + lon2); catch error('lat1, lon1, s12, azi1 have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end Z = zeros(S); lat1 = lat1 + Z; lon1 = lon1 + Z; lat2 = lat2 + Z; lon2 = lon2 + Z; Z = Z(:); degree = pi/180; tiny = sqrt(realmin); tol0 = eps; tolb = eps * sqrt(eps); maxit1 = 20; maxit2 = maxit1 + (-log2(eps) + 1) + 10; a = ellipsoid(1); e2 = ellipsoid(2)^2; f = e2 / (1 + sqrt(1 - e2)); f1 = 1 - f; ep2 = e2 / (1 - e2); n = f / (2 - f); b = a * f1; distp = true; areap = nargout >= 4; redp = nargout >= 5; scalp = nargout >= 6; % mask for Lengths: 1 = distance, 2 = reduced length, 4 = geodesic scale lengthmask = distp; if redp lengthmask = 2; end if scalp lengthmask = lengthmask + 4; end A3x = A3coeff(n); C3x = C3coeff(n); lon12 = AngRound(AngDiff(lon1(:), lon2(:))); lonsign = 2 * (lon12 >= 0) - 1; lon12 = lonsign .* lon12; lat1 = AngRound(LatFix(lat1(:))); lat2 = AngRound(LatFix(lat2(:))); swapp = 2 * ~(abs(lat1) < abs(lat2)) - 1; lonsign(swapp < 0) = - lonsign(swapp < 0); [lat1(swapp < 0), lat2(swapp < 0)] = swap(lat1(swapp < 0), lat2(swapp < 0)); latsign = 2 * (lat1 < 0) - 1; lat1 = latsign .* lat1; lat2 = latsign .* lat2; [sbet1, cbet1] = sincosdx(lat1); sbet1 = f1 * sbet1; [sbet1, cbet1] = norm2(sbet1, cbet1); cbet1 = max(tiny, cbet1); [sbet2, cbet2] = sincosdx(lat2); sbet2 = f1 * sbet2; [sbet2, cbet2] = norm2(sbet2, cbet2); cbet2 = max(tiny, cbet2); c = cbet1 < -sbet1 & cbet2 == cbet1; sbet2(c) = (2 * (sbet2(c) < 0) - 1) .* sbet1(c); c = ~(cbet1 < -sbet1) & abs(sbet2) == - sbet1; cbet2(c) = cbet1(c); dn1 = sqrt(1 + ep2 * sbet1.^2); dn2 = sqrt(1 + ep2 * sbet2.^2); lam12 = lon12 * degree; [slam12, clam12] = sincosdx(lon12); sig12 = Z; ssig1 = Z; csig1 = Z; ssig2 = Z; csig2 = Z; calp1 = Z; salp1 = Z; calp2 = Z; salp2 = Z; s12 = Z; m12 = Z; M12 = Z; M21 = Z; omg12 = Z; m = lat1 == -90 | slam12 == 0; if any(m) calp1(m) = clam12(m); salp1(m) = slam12(m); calp2(m) = 1; salp2(m) = 0; ssig1(m) = sbet1(m); csig1(m) = calp1(m) .* cbet1(m); ssig2(m) = sbet2(m); csig2(m) = calp2(m) .* cbet2(m); sig12(m) = ... atan2(0 + max(0, csig1(m) .* ssig2(m) - ssig1(m) .* csig2(m)), ... csig1(m) .* csig2(m) + ssig1(m) .* ssig2(m)); [s12(m), m12(m), ~, M12(m), M21(m)] = ... Lengths(n, sig12(m), ... ssig1(m), csig1(m), dn1(m), ssig2(m), csig2(m), dn2(m), ... cbet1(m), cbet2(m), bitor(1+2, lengthmask), ep2); m = m & (sig12 < 1 | m12 >= 0); g = m & sig12 < 3 * tiny; sig12(g) = 0; s12(g) = 0; m12(g) = 0; m12(m) = m12(m) * b; s12(m) = s12(m) * b; end eq = ~m & sbet1 == 0; if f > 0 eq = eq & lam12 < pi - f * pi; end calp1(eq) = 0; calp2(eq) = 0; salp1(eq) = 1; salp2(eq) = 1; s12(eq) = a * lam12(eq); sig12(eq) = lam12(eq) / f1; omg12(eq) = sig12(eq); m12(eq) = b * sin(omg12(eq)); M12(eq) = cos(omg12(eq)); M21(eq) = M12(eq); g = ~eq & ~m; if any(g) dnm = Z; [sig12(g), salp1(g), calp1(g), salp2(g), calp2(g), dnm(g)] = ... InverseStart(sbet1(g), cbet1(g), dn1(g), sbet2(g), cbet2(g), dn2(g), ... lam12(g), f, A3x); s = g & sig12 >= 0; s12(s) = b * sig12(s) .* dnm(s); m12(s) = b * dnm(s).^2 .* sin(sig12(s) ./ dnm(s)); if scalp M12(s) = cos(sig12(s) ./ dnm(s)); M21(s) = M12(s); end omg12(s) = lam12(s) ./ (f1 * dnm(s)); g = g & sig12 < 0; salp1a = Z + tiny; calp1a = Z + 1; salp1b = Z + tiny; calp1b = Z - 1; ssig1 = Z; csig1 = Z; ssig2 = Z; csig2 = Z; epsi = Z; v = Z; dv = Z; numit = Z; tripn = Z > 0; tripb = tripn; if any(g) gsave = g; for k = 0 : maxit2 - 1 if k == 0 && ~any(g), break, end numit(g) = k; [v(g), dv(g), ... salp2(g), calp2(g), sig12(g), ... ssig1(g), csig1(g), ssig2(g), csig2(g), epsi(g), omg12(g)] = ... Lambda12(sbet1(g), cbet1(g), dn1(g), ... sbet2(g), cbet2(g), dn2(g), ... salp1(g), calp1(g), f, A3x, C3x); v = v - lam12; g = g & ~(tripb | ~(abs(v) >= ((tripn * 6) + 2) * tol0)); if ~any(g), break, end c = g & v > 0; if k <= maxit1 c = c & calp1 ./ salp1 > calp1b ./ salp1b; end salp1b(c) = salp1(c); calp1b(c) = calp1(c); c = g & v < 0; if k <= maxit1 c = c & calp1 ./ salp1 < calp1a ./ salp1a; end salp1a(c) = salp1(c); calp1a(c) = calp1(c); if k == maxit1, tripn(g) = false; end if k < maxit1 dalp1 = -v ./ dv; sdalp1 = sin(dalp1); cdalp1 = cos(dalp1); nsalp1 = salp1 .* cdalp1 + calp1 .* sdalp1; calp1(g) = calp1(g) .* cdalp1(g) - salp1(g) .* sdalp1(g); salp1(g) = nsalp1(g); tripn = g & abs(v) <= 16 * tol0; c = g & ~(dv > 0 & nsalp1 > 0 & abs(dalp1) < pi); tripn(c) = false; else c = g; end salp1(c) = (salp1a(c) + salp1b(c))/2; calp1(c) = (calp1a(c) + calp1b(c))/2; [salp1(g), calp1(g)] = norm2(salp1(g), calp1(g)); tripb(c) = abs(salp1a(c)-salp1(c)) + (calp1a(c)-calp1(c)) < tolb ... | abs(salp1(c)-salp1b(c)) + (calp1(c)-calp1b(c)) < tolb; end g = gsave; if bitand(2+4, lengthmask) % set distance bit if redp or scalp, so that J12 is computed in a % canonical way. lengthmask = bitor(1, lengthmask); end [s12(g), m12(g), ~, M12(g), M21(g)] = ... Lengths(epsi(g), sig12(g), ... ssig1(g), csig1(g), dn1(g), ssig2(g), csig2(g), dn2(g), ... cbet1(g), cbet2(g), lengthmask, ep2); m12(g) = m12(g) * b; s12(g) = s12(g) * b; omg12(g) = lam12(g) - omg12(g); end end s12 = 0 + s12; if areap salp0 = salp1 .* cbet1; calp0 = hypot(calp1, salp1 .* sbet1); ssig1 = sbet1; csig1 = calp1 .* cbet1; ssig2 = sbet2; csig2 = calp2 .* cbet2; k2 = calp0.^2 * ep2; epsi = k2 ./ (2 * (1 + sqrt(1 + k2)) + k2); A4 = (a^2 * e2) * calp0 .* salp0; [ssig1, csig1] = norm2(ssig1, csig1); [ssig2, csig2] = norm2(ssig2, csig2); C4x = C4coeff(n); Ca = C4f(epsi, C4x); B41 = SinCosSeries(false, ssig1, csig1, Ca); B42 = SinCosSeries(false, ssig2, csig2, Ca); S12 = A4 .* (B42 - B41); S12(calp0 == 0 | salp0 == 0) = 0; l = ~m & omg12 < 0.75 * pi & sbet2 - sbet1 < 1.75; alp12 = Z; somg12 = sin(omg12(l)); domg12 = 1 + cos(omg12(l)); dbet1 = 1 + cbet1(l); dbet2 = 1 + cbet2(l); alp12(l) = 2 * atan2(somg12 .* (sbet1(l) .* dbet2 + sbet2(l) .* dbet1), ... domg12 .* (sbet1(l) .* sbet2(l) + dbet1 .* dbet2)); l = ~l; salp12 = salp2(l) .* calp1(l) - calp2(l) .* salp1(l); calp12 = calp2(l) .* calp1(l) + salp2(l) .* salp1(l); s = salp12 == 0 & calp12 < 0; salp12(s) = tiny * calp1(s); calp12(s) = -1; alp12(l) = atan2(salp12, calp12); if e2 ~= 0 c2 = (a^2 + b^2 * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end S12 = 0 + swapp .* lonsign .* latsign .* (S12 + c2 * alp12); end [salp1(swapp<0), salp2(swapp<0)] = swap(salp1(swapp<0), salp2(swapp<0)); [calp1(swapp<0), calp2(swapp<0)] = swap(calp1(swapp<0), calp2(swapp<0)); if scalp [M12(swapp<0), M21(swapp<0)] = swap(M12(swapp<0), M21(swapp<0)); M12 = reshape(M12, S); M21 = reshape(M21, S); end salp1 = salp1 .* swapp .* lonsign; calp1 = calp1 .* swapp .* latsign; salp2 = salp2 .* swapp .* lonsign; calp2 = calp2 .* swapp .* latsign; azi1 = atan2dx(salp1, calp1); azi2 = atan2dx(salp2, calp2); a12 = sig12 / degree; s12 = reshape(s12, S); azi1 = reshape(azi1, S); azi2 = reshape(azi2, S); if redp m12 = reshape(m12, S); end if nargout >= 8 a12 = reshape(a12, S); end if areap S12 = reshape(S12, S); end end function [sig12, salp1, calp1, salp2, calp2, dnm] = ... InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, f, A3x) %INVERSESTART Compute a starting point for Newton's method N = length(sbet1); f1 = 1 - f; e2 = f * (2 - f); ep2 = e2 / (1 - e2); n = f / (2 - f); tol0 = eps; tol1 = 200 * tol0; tol2 = sqrt(eps); etol2 = 0.1 * tol2 / sqrt( max(0.001, abs(f)) * min(1, 1 - f/2) / 2 ); xthresh = 1000 * tol2; sig12 = -ones(N, 1); salp2 = nan(N, 1); calp2 = nan(N, 1); sbet12 = sbet2 .* cbet1 - cbet2 .* sbet1; cbet12 = cbet2 .* cbet1 + sbet2 .* sbet1; sbet12a = sbet2 .* cbet1 + cbet2 .* sbet1; s = cbet12 >= 0 & sbet12 < 0.5 & cbet2 .* lam12 < 0.5; omg12 = lam12; dnm = nan(N, 1); sbetm2 = (sbet1(s) + sbet2(s)).^2; sbetm2 = sbetm2 ./ (sbetm2 + (cbet1(s) + cbet2(s)).^2); dnm(s) = sqrt(1 + ep2 * sbetm2); omg12(s) = omg12(s) ./ (f1 * dnm(s)); somg12 = sin(omg12); comg12 = cos(omg12); salp1 = cbet2 .* somg12; t = cbet2 .* sbet1 .* somg12.^2; calp1 = cvmgt(sbet12 + t ./ max(1, 1 + comg12), ... sbet12a - t ./ max(1, 1 - comg12), ... comg12 >= 0); ssig12 = hypot(salp1, calp1); csig12 = sbet1 .* sbet2 + cbet1 .* cbet2 .* comg12; s = s & ssig12 < etol2; salp2(s) = cbet1(s) .* somg12(s); calp2(s) = somg12(s).^2 ./ (1 + comg12(s)); calp2(s & comg12 < 0) = 1 - comg12(s & comg12 < 0); calp2(s) = sbet12(s) - cbet1(s) .* sbet2(s) .* calp2(s); [salp2, calp2] = norm2(salp2, calp2); sig12(s) = atan2(ssig12(s), csig12(s)); s = ~(s | abs(n) > 0.1 | csig12 >= 0 | ssig12 >= 6 * abs(n) * pi * cbet1.^2); if any(s) if f >= 0 k2 = sbet1(s).^2 * ep2; epsi = k2 ./ (2 * (1 + sqrt(1 + k2)) + k2); lamscale = f * cbet1(s) .* A3f(epsi, A3x) * pi; betscale = lamscale .* cbet1(s); x = (lam12(s) - pi) ./ lamscale; y = sbet12a(s) ./ betscale; else cbet12a = cbet2(s) .* cbet1(s) - sbet2(s) .* sbet1(s); bet12a = atan2(sbet12a(s), cbet12a); [~, m12b, m0] = ... Lengths(n, pi + bet12a, ... sbet1(s), -cbet1(s), dn1(s), sbet2(s), cbet2(s), dn2(s), ... cbet1(s), cbet2(s), 2); x = -1 + m12b ./ (cbet1(s) .* cbet2(s) .* m0 * pi); betscale = cvmgt(sbet12a(s) ./ min(-0.01, x), - f * cbet1(s).^2 * pi, ... x < -0.01); lamscale = betscale ./ cbet1(s); y = (lam12(s) - pi) ./ lamscale; end k = Astroid(x, y); str = y > -tol1 & x > -1 - xthresh; k(str) = 1; if f >= 0 omg12a = -x .* k ./ (1 + k); else omg12a = -y .* (1 + k) ./ k; end omg12a = lamscale .* omg12a; somg12 = sin(omg12a); comg12 = -cos(omg12a); salp1(s) = cbet2(s) .* somg12; calp1(s) = sbet12a(s) - cbet2(s) .* sbet1(s) .* somg12.^2 ./ (1 - comg12); if any(str) salp1s = salp1(s); calp1s = calp1(s); if f >= 0 salp1s(str) = min(1, -x(str)); calp1s(str) = -sqrt(1 - salp1s(str).^2); else calp1s(str) = max(cvmgt(0, -1, x(str) > -tol1), x(str)); salp1s(str) = sqrt(1 - calp1s(str).^2); end salp1(s) = salp1s; calp1(s) = calp1s; end end calp1(salp1 <= 0) = 0; salp1(salp1 <= 0) = 1; [salp1, calp1] = norm2(salp1, calp1); end function k = Astroid(x, y) % ASTROID Solve the astroid equation % % K = ASTROID(X, Y) solves the quartic polynomial Eq. (55) % % K^4 + 2 * K^3 - (X^2 + Y^2 - 1) * K^2 - 2*Y^2 * K - Y^2 = 0 % % for the positive root K. X and Y are column vectors of the same size % and the returned value K has the same size. k = zeros(length(x), 1); p = x.^2; q = y.^2; r = (p + q - 1) / 6; fl1 = ~(q == 0 & r <= 0); p = p(fl1); q = q(fl1); r = r(fl1); S = p .* q / 4; r2 = r.^2; r3 = r .* r2; disc = S .* (S + 2 * r3); u = r; fl2 = disc >= 0; T3 = S(fl2) + r3(fl2); T3 = T3 + (1 - 2 * (T3 < 0)) .* sqrt(disc(fl2)); T = cbrtx(T3); u(fl2) = u(fl2) + T + cvmgt(r2(fl2) ./ T, 0, T ~= 0); ang = atan2(sqrt(-disc(~fl2)), -(S(~fl2) + r3(~fl2))); u(~fl2) = u(~fl2) + 2 * r(~fl2) .* cos(ang / 3); v = sqrt(u.^2 + q); uv = u + v; fl2 = u < 0; uv(fl2) = q(fl2) ./ (v(fl2) - u(fl2)); w = (uv - q) ./ (2 * v); k(fl1) = uv ./ (sqrt(uv + w.^2) + w); end function [lam12, dlam12, ... salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, epsi, domg12] = ... Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, f, A3x, C3x) %LAMBDA12 Solve the hybrid problem tiny = sqrt(realmin); f1 = 1 - f; e2 = f * (2 - f); ep2 = e2 / (1 - e2); calp1(sbet1 == 0 & calp1 == 0) = -tiny; salp0 = salp1 .* cbet1; calp0 = hypot(calp1, salp1 .* sbet1); ssig1 = sbet1; somg1 = salp0 .* sbet1; csig1 = calp1 .* cbet1; comg1 = csig1; [ssig1, csig1] = norm2(ssig1, csig1); salp2 = cvmgt(salp0 ./ cbet2, salp1, cbet2 ~= cbet1); calp2 = cvmgt(sqrt((calp1 .* cbet1).^2 + ... cvmgt((cbet2 - cbet1) .* (cbet1 + cbet2), ... (sbet1 - sbet2) .* (sbet1 + sbet2), ... cbet1 < -sbet1)) ./ cbet2, ... abs(calp1), cbet2 ~= cbet1 | abs(sbet2) ~= -sbet1); ssig2 = sbet2; somg2 = salp0 .* sbet2; csig2 = calp2 .* cbet2; comg2 = csig2; [ssig2, csig2] = norm2(ssig2, csig2); sig12 = atan2(0 + max(0, csig1 .* ssig2 - ssig1 .* csig2), ... csig1 .* csig2 + ssig1 .* ssig2); omg12 = atan2(0 + max(0, comg1 .* somg2 - somg1 .* comg2), ... comg1 .* comg2 + somg1 .* somg2); k2 = calp0.^2 * ep2; epsi = k2 ./ (2 * (1 + sqrt(1 + k2)) + k2); Ca = C3f(epsi, C3x); B312 = SinCosSeries(true, ssig2, csig2, Ca) - ... SinCosSeries(true, ssig1, csig1, Ca); h0 = -f * A3f(epsi, A3x); domg12 = salp0 .* h0 .* (sig12 + B312); lam12 = omg12 + domg12; [~, dlam12] = ... Lengths(epsi, sig12, ... ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, 2); z = calp2 == 0; dlam12(~z) = dlam12(~z) .* f1 ./ (calp2(~z) .* cbet2(~z)); dlam12(z) = - 2 * f1 .* dn1(z) ./ sbet1(z); end function [s12b, m12b, m0, M12, M21] = ... Lengths(epsi, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, ... cbet1, cbet2, outmask, ep2) %LENGTHS Compute various lengths associate with a geodesic N = nan(size(sig12)); if bitand(1+2+4, outmask) A1 = A1m1f(epsi); Ca = C1f(epsi); if bitand(2+4, outmask) A2 = A2m1f(epsi); Cb = C2f(epsi); m0 = A1 - A2; A2 = 1 + A2; end A1 = 1 + A1; end if bitand(1, outmask) B1 = SinCosSeries(true, ssig2, csig2, Ca) - ... SinCosSeries(true, ssig1, csig1, Ca); s12b = A1 .* (sig12 + B1); if bitand(2+4, outmask) B2 = SinCosSeries(true, ssig2, csig2, Cb) - ... SinCosSeries(true, ssig1, csig1, Cb); J12 = m0 .* sig12 + (A1 .* B1 - A2 .* B2); end else s12b = N; % assign arbitrary unused result if bitand(2+4, outmask) for l = 1 : size(Cb, 2) % Assume here that size(Ca, 2) >= size(Cb, 2) Cb(:, l) = A1 .* Ca(:, l) - A2 .* Cb(:, l); end J12 = m0 .* sig12 + (SinCosSeries(true, ssig2, csig2, Cb) - ... SinCosSeries(true, ssig1, csig1, Cb)); end end if bitand(2, outmask) m12b = dn2 .* (csig1 .* ssig2) - dn1 .* (ssig1 .* csig2) - ... csig1 .* csig2 .* J12; else m0 = N; m12b = N; % assign arbitrary unused result end if bitand(4, outmask) csig12 = csig1 .* csig2 + ssig1 .* ssig2; t = ep2 * (cbet1 - cbet2) .* (cbet1 + cbet2) ./ (dn1 + dn2); M12 = csig12 + (t .* ssig2 - csig2 .* J12) .* ssig1 ./ dn1; M21 = csig12 - (t .* ssig1 - csig1 .* J12) .* ssig2 ./ dn2; else M12 = N; M21 = N; % assign arbitrary unused result end end GeographicLib-1.45/matlab/geographiclib/geoid_height.m0000644000771000077100000001613112602735126022662 0ustar ckarneyckarneyfunction N = geoid_height(lat, lon, geoidname, geoiddir) %GEOID_HEIGHT Compute the height of the geoid above the ellipsoid % % N = GEOID_HEIGHT(lat, lon) % N = GEOID_HEIGHT(lat, lon, geoidname) % N = GEOID_HEIGHT(lat, lon, geoidname, geoiddir) % GEOID_HEIGHT([]) % N = GEOID_HEIGHT(lat, lon, geoid) % % computes the height, N, of the geoid above the WGS84 ellipsoid. lat % and lon are the latitude and longitude in degrees; these can be scalars % or arrays of the same size. N is in meters. % % The height of the geoid above the ellipsoid, N, is sometimes called the % geoid undulation. It can be used to convert a height above the % ellipsoid, h, to the corresponding height above the geoid (the % orthometric height, roughly the height above mean sea level), H, using % the relations % % h = N + H; H = -N + h. % % The possible geoids are % % egm84-30 egm84-15 % egm96-15 egm96-5 % egm2008-5 egm2008-2_5 egm2008-1 % % The first part of the name is the geoid model. The second part gives % the resolution of the gridded data (in arc-seconds). Thus egm2008-2_5 % is the egm2008 geoid model at a resolution of 2.5". % % By default the egm96-5 geoid is used. This can be overridden by % specifying geoidname. The geoiddir argument overrides the default % directory for the model. See the documentation on geoid_load for how % these arguments are interpreted. % % When geoid_height is invoked with a particular geoidname, the geoid % data is loaded from disk and cached. A subsequent invocation of % geoid_height with the same geoidname uses the cached data. Use % GEOID_HEIGHT([]) to clear this cached data. % % Alternatively, you can load a geoid with geoid_load and use the % returned structure as the third argument. This use does not change the % cached data. % % In order to use this routine with Octave, Octave needs to have been % compiled with a version of GraphicsMagick which supports 16-bit images. % Also, the first time you uses this routine, you may receive a warning % message "your version of GraphicsMagick limits images to 16 bits per % pixel"; this can safely be ignored. % % Information on downloading and installing the data for the supported % geoid models is available at % % http://geographiclib.sf.net/html/geoid.html#geoidinst % % GEOID_HEIGHT uses cubic interpolation on gridded data that has been % quantized at a resolution of 3mm. % % See also GEOID_LOAD. % Copyright (c) Charles Karney (2015) . persistent saved_geoid if nargin == 1 && isempty(lat) saved_geoid = []; return end narginchk(2, 4) if nargin == 3 && isstruct(geoidname) N = geoid_height_int(lat, lon, geoidname, true); else if nargin < 3 geoidname = ''; end if nargin < 4 geoiddir = ''; end geoidfile = geoid_file(geoidname, geoiddir); if ~(isstruct(saved_geoid) && strcmp(saved_geoid.file, geoidfile)) saved_geoid = geoid_load_file(geoidfile); end N = geoid_height_int(lat, lon, saved_geoid, true); end end function N = geoid_height_int(lat, lon, geoid, cubic) persistent c0 c3 c0n c3n c0s c3s if isempty(c3s) c0 = 240; c3 = [ 9, -18, -88, 0, 96, 90, 0, 0, -60, -20;... -9, 18, 8, 0, -96, 30, 0, 0, 60, -20;... 9, -88, -18, 90, 96, 0, -20, -60, 0, 0;... 186, -42, -42, -150, -96, -150, 60, 60, 60, 60;... 54, 162, -78, 30, -24, -90, -60, 60, -60, 60;... -9, -32, 18, 30, 24, 0, 20, -60, 0, 0;... -9, 8, 18, 30, -96, 0, -20, 60, 0, 0;... 54, -78, 162, -90, -24, 30, 60, -60, 60, -60;... -54, 78, 78, 90, 144, 90, -60, -60, -60, -60;... 9, -8, -18, -30, -24, 0, 20, 60, 0, 0;... -9, 18, -32, 0, 24, 30, 0, 0, -60, 20;... 9, -18, -8, 0, -24, -30, 0, 0, 60, 20]; c0n = 372; c3n = [ 0, 0, -131, 0, 138, 144, 0, 0, -102, -31;... 0, 0, 7, 0, -138, 42, 0, 0, 102, -31;... 62, 0, -31, 0, 0, -62, 0, 0, 0, 31;... 124, 0, -62, 0, 0, -124, 0, 0, 0, 62;... 124, 0, -62, 0, 0, -124, 0, 0, 0, 62;... 62, 0, -31, 0, 0, -62, 0, 0, 0, 31;... 0, 0, 45, 0, -183, -9, 0, 93, 18, 0;... 0, 0, 216, 0, 33, 87, 0, -93, 12, -93;... 0, 0, 156, 0, 153, 99, 0, -93, -12, -93;... 0, 0, -45, 0, -3, 9, 0, 93, -18, 0;... 0, 0, -55, 0, 48, 42, 0, 0, -84, 31;... 0, 0, -7, 0, -48, -42, 0, 0, 84, 31]; c0s = 372; c3s = [ 18, -36, -122, 0, 120, 135, 0, 0, -84, -31;... -18, 36, -2, 0, -120, 51, 0, 0, 84, -31;... 36, -165, -27, 93, 147, -9, 0, -93, 18, 0;... 210, 45, -111, -93, -57, -192, 0, 93, 12, 93;... 162, 141, -75, -93, -129, -180, 0, 93, -12, 93;... -36, -21, 27, 93, 39, 9, 0, -93, -18, 0;... 0, 0, 62, 0, 0, 31, 0, 0, 0, -31;... 0, 0, 124, 0, 0, 62, 0, 0, 0, -62;... 0, 0, 124, 0, 0, 62, 0, 0, 0, -62;... 0, 0, 62, 0, 0, 31, 0, 0, 0, -31;... -18, 36, -64, 0, 66, 51, 0, 0, -102, 31;... 18, -36, 2, 0, -66, -51, 0, 0, 102, 31]; end try s = size(lat + lon); catch error('lat, lon have incompatible sizes') end num = prod(s); Z = zeros(num,1); lat = lat(:) + Z; lon = lon(:) + Z; h = geoid.h; w = geoid.w; % lat is in [0, h] flat = min(max((90 - lat) * (h - 1) / 180, 0), (h - 1)); % lon is in [0, w) flon = mod(lon * w / 360, w); flon(isnan(flon)) = 0; ilat = min(floor(flat), h - 2); ilon = floor(flon); flat = flat - ilat; flon = flon - ilon; if ~cubic ind = imgind(ilon + [0,0,1,1], ilat + [0,1,0,1], w, h); hf = double(geoid.im(ind)); N = (1 - flon) .* ((1 - flat) .* hf(:,1) + flat .* hf(:,2)) + ... flon .* ((1 - flat) .* hf(:,3) + flat .* hf(:,4)); else ind = imgind(repmat(ilon, 1, 12) + ... repmat([ 0, 1,-1, 0, 1, 2,-1, 0, 1, 2, 0, 1], num, 1), ... repmat(ilat, 1, 12) + ... repmat([-1,-1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2], num, 1), ... w, h); hf = double(geoid.im(ind)); hfx = hf * c3 / c0; hfx(ilat == 0,:) = hf(ilat == 0,:) * c3n / c0n; hfx(ilat == h-2,:) = hf(ilat == h-2,:) * c3s / c0s; N = sum(hfx .* [Z+1, flon, flat, flon.^2, flon.*flat, flat.^2, ... flon.^3, flon.^2.*flat, flon.*flat.^2, flat.^3], ... 2); end N = geoid.offset + geoid.scale * N; N(~(abs(lat) <= 90 & isfinite(lon))) = nan; N = reshape(N, s); end function ind = imgind(ix, iy, w, h) % return 1-based 1d index to w*h array for 0-based 2d indices (ix,iy) c = iy < 0; iy(c) = - iy(c); ix(c) = ix(c) + w/2; c = iy >= h; iy(c) = 2 * (h-1) - iy(c); ix(c) = ix(c) + w/2; ix = mod(ix, w); ind = 1 + iy + ix * h; end GeographicLib-1.45/matlab/geographiclib/utmups_fwd.m0000644000771000077100000001033612602735126022441 0ustar ckarneyckarneyfunction [x, y, zone, isnorth, gam, k] = utmups_fwd(lat, lon, setzone) %UTMUPS_FWD Convert to UTM/UPS system % % [x, y, zone, isnorth] = UTMUPS_FWD(lat, lon) % [x, y, zone, isnorth, gam, k] = UTMUPS_FWD(lat, lon, setzone) % % convert from geographical coordinates, (lat,lon), to the UTM/UPS % system. The output is (x,y) = (easting,northing), zone which is either % the UTM zone or 0 for UPS, and a hemisphere selector, isnorth (0 for % the southern hemisphere, 1 for the northern). If setzone = -1 (the % default), the standard choice is made between UTM and UPS and, if UTM, % the standard zone is picked (the Norway and Svalbard exceptions are % honored). lat, lon, and setzone can be scalars or arrays of equal % size. The inverse operation is performed by utmups_inv. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat, lon, gam are in degrees. The projected coordinates x, y are in % meters. k is dimensionless. % % The optional argument, setzone, allows the UTM/UPS and zone % assignment to be overridden. The choices are % 0, use UPS % [1,60], use the corresponding UTM zone % -1, use the standard assigment (the default) % -2, use closest UTM zone % -4, an undefined zone % % The allowed values of (x,y) are % UTM: x in [0 km, 1000 km] % y in [0 km, 9600 km] for northern hemisphere % y in [900 km, 10000 km] for southern hemisphere % UPS: x and y in [1200 km, 2800 km] for northern hemisphere % x and y in [700 km, 3300 km] for southern hemisphere % % The ranges are 100 km more restrictive than for mgrs_fwd. % % UTMUPS_FWD checks its arguments and requires that lat is in % [-90deg,90deg] and that (x,y) lie in the limits given above. If these % conditions don't hold (x,y), gam, k are converted to NaN, zone to -4 % and isnorthp to 0. % % See also UTMUPS_INV, TRANMERC_FWD, POLARST_FWD, MGRS_FWD. % Copyright (c) Charles Karney (2015) . narginchk(2, 3) if nargin < 3, setzone = -1; end try Z = zeros(size(lat + lon + setzone)); catch error('lat, lon, setzone have incompatible sizes') end lat = lat + Z; lon = lon + Z; isnorth = lat >= 0; zone = StandardZone(lat, lon, setzone); Z = nan(size(Z)); x = Z; y = Z; gam = Z; k = Z; utm = zone > 0; [x(utm), y(utm), gam(utm), k(utm)] = ... utm_fwd(zone(utm), isnorth(utm), lat(utm), lon(utm)); ups = zone == 0; [x(ups), y(ups), gam(ups), k(ups)] = ... ups_fwd(isnorth(ups), lat(ups), lon(ups)); zone(isnan(x)) = -4; isnorth(isnan(x)) = false; end function [x, y, gam, k] = utm_fwd(zone, isnorth, lat, lon) %UTM_FWD Forward UTM projection lon0 = -183 + 6 * floor(zone); lat0 = 0; bad = ~(abs(mod(lon - lon0 + 180, 360) - 180) <= 60); fe = 5e5; fn = 100e5 * (1-isnorth); k0 = 0.9996; [x, y, gam, k] = tranmerc_fwd(lat0, lon0, lat, lon); x = x * k0; y = y * k0; k = k * k0; bad = bad | ~(abs(x) <= 5e5 & y >= -91e5 & y <= 96e5); x = x + fe; y = y + fn; x(bad) = nan; y(bad) = nan; gam(bad) = nan; k(bad) = nan; end function [x, y, gam, k] = ups_fwd(isnorth, lat, lon) %UPS_FWD Forward UPS projection fe = 20e5; fn = 20e5; k0 = 0.994; [x, y, gam, k] = polarst_fwd(isnorth, lat, lon); x = x * k0; y = y * k0; k = k * k0; lim = (13 - 5 * isnorth) * 1e5; bad = ~(abs(x) <= lim & abs(y) <= lim); x = x + fe; y = y + fn; x(bad) = nan; y(bad) = nan; gam(bad) = nan; k(bad) = nan; end function zone = StandardZone(lat, lon, setzone) INVALID = -4; UTM = -2; MINZONE = 0; MAXZONE = 60; UPS = 0; zone = floor(setzone) + zeros(size(lat)); zone(~(zone >= INVALID & zone <= MAXZONE)) = INVALID; g = zone < MINZONE & zone ~= INVALID; c = abs(lat) <= 90 & isfinite(lon); zone(g & ~c) = INVALID; g = g & c; c = zone == UTM | (lat >= -80 & lat < 84); u = g & c; ilon = mod(floor(lon(u)) + 180, 360) - 180; z = floor((ilon + 186) / 6); % Norway exception exception = z == 31 & floor(lat(u) / 8) == 7 & ilon >= 3; z(exception) = 32; % Svalbard exception exception = lat(u) >= 72 & ilon >= 0 & ilon < 42; z(exception) = 2 * floor((ilon(exception) + 183)/12) + 1; zone(u) = z; zone(g & ~c) = UPS; end GeographicLib-1.45/matlab/geographiclib/mgrs_inv.m0000644000771000077100000002151612602735126022072 0ustar ckarneyckarneyfunction [x, y, zone, isnorth, prec] = mgrs_inv(mgrs, center) %MGRS_INV Convert MGRS to UTM/UPS coordinates % % [x, y, zone, isnorth] = MGRS_INV(mgrs) % [x, y, zone, isnorth, prec] = MGRS_INV(mgrs, center) % % converts MGRS grid references to the UTM/UPS system. mgrs is either a % 2d character array of MGRS grid references or a cell array of character % strings; leading and trailing white space is ignored. (x,y) are the % easting and northing (in meters); zone is the UTM zone in [1,60] or 0 % for UPS; isnorth is 1 (0) for the northern (southern) hemisphere. prec % is the precision of the grid reference, i.e., 1/2 the number of % trailing digits; for example 38SMB4488 has prec = 2 (denoting a 1 km % square). If center = 1 (the default), then for prec >= 0, the position % of the center of the grid square is returned; to obtain the SW corner % subtract 0.5 * 10^(5-prec) from the easting and northing. If center = % 0, then the SW corner is returned. center must be a scalar. prec = -1 % means that the grid reference consists of a grid zone, e.g., 38S, only; % in this case some representative position in the grid zone is returned. % Illegal MGRS references result in x = y = NaN, zone = -4, isnorth = 0, % prec = -2. The forward operation is performed by mgrs_fwd. % % See also MGRS_FWD, UTMUPS_INV. % Copyright (c) Charles Karney (2015) . narginchk(1, 2) if nargin < 2 center = true; else center = logical(center); end if ischar(mgrs) mgrs = cellstr(mgrs); end if iscell(mgrs) s = size(mgrs); mgrs = char(strtrim(mgrs)); else error('mgrs must be cell array of strings or 2d char array') end if ~isscalar(center) error('center must if a scalar logical') end mgrs = upper(mgrs); num = size(mgrs, 1); x = nan(num, 1); y = x; prec = -2 * ones(num, 1); isnorth = false(num, 1); zone = 2 * prec; if num == 0, return, end % pad with 5 spaces so we can access letter positions without checks mgrs = [mgrs, repmat(' ', num, 5)]; d = isstrprop(mgrs(:,1), 'digit') & ~isstrprop(mgrs(:,2), 'digit'); mgrs(d,2:end) = mgrs(d,1:end-1); mgrs(d,1) = '0'; % check that spaces only at end contig = sum(abs(diff(isspace(mgrs), 1, 2)), 2) <= 1; utm = isstrprop(mgrs(:,1), 'digit') & contig; upss = (mgrs(:,1) == 'A' | mgrs(:,1) == 'B') & contig; upsn = (mgrs(:,1) == 'Y' | mgrs(:,1) == 'Z') & contig; [x(utm), y(utm), zone(utm), isnorth(utm), prec(utm)] = ... mgrs_inv_utm(mgrs(utm,:), center); [x(upsn), y(upsn), zone(upsn), isnorth(upsn), prec(upsn)] = ... mgrs_inv_upsn(mgrs(upsn,:), center); [x(upss), y(upss), zone(upss), isnorth(upss), prec(upss)] = ... mgrs_inv_upss(mgrs(upss,:), center); x = reshape(x, s); y = reshape(y, s); prec = reshape(prec, s); isnorth = reshape(isnorth, s); zone = reshape(zone, s); end function [x, y, zone, northp, prec] = mgrs_inv_utm(mgrs, center) persistent latband utmcols utmrow if isempty(utmrow) latband = 'CDEFGHJKLMNPQRSTUVWX'; utmcols = ['ABCDEFGH', 'JKLMNPQR', 'STUVWXYZ']; utmrow = 'ABCDEFGHJKLMNPQRSTUV'; end zone = (mgrs(:,1) - '0') * 10 + (mgrs(:,2) - '0'); ok = zone > 0 & zone <= 60; band = lookup(latband, mgrs(:,3)); ok = ok & band >= 0; band = band - 10; northp = band >= 0; colind = lookup(utmcols, mgrs(:, 4)) - ... mod(zone - 1, 3) * 8; % good values in [0,8), bad values = -1 colind(colind >= 8) = -1; rowind = lookup(utmrow, mgrs(:, 5)); even = mod(zone, 2) == 0; bad = rowind < 0; rowind(even) = mod(rowind(even) - 5, 20); % good values in [0,20), bad values = -1 rowind(bad) = -1; rowfix = fixutmrow(band, colind, rowind); [x, y, prec] = decodexy(mgrs(:, 6:end), ... colind + 1, rowfix + (1-northp) * 100, center); prec(mgrs(:,4) == ' ') = -1; zoneonly = prec == -1; ok = ok & (zoneonly | (colind >= 0 & rowind >= 0 & rowfix < 100)); x(zoneonly) = (5 - (zone(zoneonly) == 31 & band(zoneonly) == 7)) * 1e5; y(zoneonly) = floor(8 * (band(zoneonly) + 0.5) * 100/90 + 0.5) * 1e5 + ... (1- northp(zoneonly)) * 100e5; x(~ok) = nan; y(~ok) = nan; northp(~ok) = false; zone(~ok) = -4; prec(~ok) = -2; end function [x, y, zone, northp, prec] = mgrs_inv_upsn(mgrs, center) persistent upsband upscols upsrow if isempty(upsrow) upsband = 'YZ'; upscols = ['RSTUXYZ', 'ABCFGHJ']; upsrow = 'ABCDEFGHJKLMNP'; end zone = zeros(size(mgrs,1),1); ok = zone == 0; northp = ok; eastp = lookup(upsband, mgrs(:,1)); ok = ok & eastp >= 0; colind = lookup(upscols, mgrs(:, 2)); ok = ok & (colind < 0 | mod(floor(colind / 7) + eastp, 2) == 0); rowind = lookup(upsrow, mgrs(:, 3)); rowind = rowind + 13; colind = colind + 13; [x, y, prec] = decodexy(mgrs(:, 4:end), colind, rowind, center); prec(mgrs(:,2) == ' ') = -1; zoneonly = prec == -1; ok = ok & (zoneonly | (colind >= 0 & rowind >= 0)); x(zoneonly) = ((2*eastp(zoneonly) - 1) * floor(4 * 100/90 + 0.5) + 20) * 1e5; y(zoneonly) = 20e5; x(~ok) = nan; y(~ok) = nan; northp(~ok) = false; zone(~ok) = -4; prec(~ok) = -2; end function [x, y, zone, northp, prec] = mgrs_inv_upss(mgrs, center) persistent upsband upscolA upscolB upsrow if isempty(upsrow) upsband = 'AB'; upscolA = 'JKLPQRSTUXYZ'; upscolB = 'ABCFGHJKLPQR'; upsrow = 'ABCDEFGHJKLMNPQRSTUVWXYZ'; end zone = zeros(size(mgrs,1),1); ok = zone == 0; northp = ~ok; eastp = lookup(upsband, mgrs(:,1)); ok = ok & eastp >= 0; eastp = eastp > 0; colind = lookup(upscolA, mgrs(:, 2)); colind(eastp) = lookup(upscolB, mgrs(eastp, 2)) + 12; colind(eastp & colind < 12) = -1; ok = ok & (colind < 0 | mod(floor(colind / 12) + eastp, 2) == 0); rowind = lookup(upsrow, mgrs(:, 3)); rowind = rowind + 8; colind = colind + 8; [x, y, prec] = decodexy(mgrs(:, 4:end), colind, rowind, center); prec(mgrs(:,2) == ' ') = -1; zoneonly = prec == -1; ok = ok & (zoneonly | (colind >= 0 & rowind >= 0)); x(zoneonly) = ((2*eastp(zoneonly) - 1) * floor(4 * 100/90 + 0.5) + 20) * 1e5; y(zoneonly) = 20e5; x(~ok) = nan; y(~ok) = nan; zone(~ok) = -4; prec(~ok) = -2; end function [x, y, prec] = decodexy(xy, xh, yh, center) num = size(xy, 1); x = nan(num, 1); y = x; len = strlen(xy); prec = len / 2; digits = sum(isspace(xy) | isstrprop(xy, 'digit'), 2) == size(xy, 2); ok = len <= 22 & mod(len, 2) == 0 & digits; prec(~ok) = -2; if ~any(ok), return, end cent = center * 0.5; in = prec == 0; if any(in) x(in) = (xh(in) + cent) * 1e5; y(in) = (yh(in) + cent) * 1e5; end minprec = max(1,min(prec(ok))); maxprec = max(prec(ok)); for p = minprec:maxprec in = prec == p; if ~any(in) continue end m = 10^p; x(in) = xh(in) * m + str2double(cellstr(xy(in, 0+(1:p)))) + cent; y(in) = yh(in) * m + str2double(cellstr(xy(in, p+(1:p)))) + cent; if p < 5 m = 1e5 / m; x(in) = x(in) * m; y(in) = y(in) * m; elseif p > 5 m = m / 1e5; x(in) = x(in) / m; y(in) = y(in) / m; end end end function irow = fixutmrow(iband, icol, irow) % Input is MGRS (periodic) row index and output is true row index. Band % index is in [-10, 10) (as returned by LatitudeBand). Column index % origin is easting = 100km. Returns 100 if irow and iband are % incompatible. Row index origin is equator. % Estimate center row number for latitude band % 90 deg = 100 tiles; 1 band = 8 deg = 100*8/90 tiles c = 100 * (8 * iband + 4)/90; northp = iband >= 0; minrow = cvmgt(floor(c - 4.3 - 0.1 * northp), -90, iband > -10); maxrow = cvmgt(floor(c + 4.4 - 0.1 * northp), 94, iband < 9); baserow = floor((minrow + maxrow) / 2) - 10; irow = mod(irow - baserow, 20) + baserow; fix = ~(irow >= minrow & irow <= maxrow); if ~any(fix), return, end % Northing = 71*100km and 80*100km intersect band boundaries % The following deals with these special cases. % Fold [-10,-1] -> [9,0] sband = cvmgt(iband, -iband - 1, iband >= 0); % Fold [-90,-1] -> [89,0] srow = cvmgt(irow, -irow - 1, irow >= 0); % Fold [4,7] -> [3,0] scol = cvmgt(icol, -icol + 7, icol < 4); irow(fix & ~( (srow == 70 & sband == 8 & scol >= 2) | ... (srow == 71 & sband == 7 & scol <= 2) | ... (srow == 79 & sband == 9 & scol >= 1) | ... (srow == 80 & sband == 8 & scol <= 1) ) ) = 100; end function len = strlen(strings) num = size(strings, 1); len = repmat(size(strings, 2), num, 1); strings = strings(:); r = cumsum(ones(num,1)); d = 1; while any(d) d = len > 0 & strings(num * (max(len, 1) - 1) + r) == ' '; len(d) = len(d) - 1; end end function ind = lookup(str, test) % str is uppercase row string to look up in. test is col array to % lookup. Result is zero-based index or -1 if not found. q = str - 'A' + 1; t = zeros(27,1); t(q) = cumsum(ones(length(q),1)); test = test - 'A' + 1; test(~(test >= 1 & test <= 26)) = 27; ind = t(test) - 1; end GeographicLib-1.45/matlab/geographiclib/gnomonic_inv.m0000644000771000077100000000662312602735126022735 0ustar ckarneyckarneyfunction [lat, lon, azi, rk] = gnomonic_inv(lat0, lon0, x, y, ellipsoid) %GNOMONIC_INV Inverse ellipsoidal gnomonic projection % % [lat, lon] = GNOMONIC_INV(lat0, lon0, x, y) % [lat, lon, azi, rk] = GNOMONIC_INV(lat0, lon0, x, y, ellipsoid) % % performs the inverse ellipsoidal gnomonic projection of points (x,y) to % (lat,lon) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. projdoc % defines the projection and gives the restrictions on the allowed ranges % of the arguments. The forward projection is given by gnomonic_fwd. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the geodesic from the center of projection and rk is % the reciprocal of the azimuthal scale. The scale in the radial % direction is 1/rk^2. % % In principle, all finite x and y are allowed. However, it's possible % that the inverse projection fails for very large x and y (when the % geographic position is close to the "horizon"). In that case, NaNs are % returned for the corresponding output variables. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % The ellipsoidal gnomonic projection is an azimuthal projection about a % center point. All geodesics through the center point are projected % into straight lines with the correct azimuth relative to the center % point. In addition all geodesics are pass close to the center point % are very nearly straight. The projection is derived in Section 8 of % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://dx.doi.org/10.1007/s00190-012-0578-z % Addenda: http://geographiclib.sf.net/geod-addenda.html % % which also includes methods for solving the "intersection" and % "interception" problems using the gnomonic projection. % % See also PROJDOC, GNOMONIC_FWD, GEODRECKON, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try Z = zeros(size(lat0 + lon0 + x + y)); catch error('lat0, lon0, x, y have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end a = ellipsoid(1); numit = 10; eps1 = a * 0.01 * sqrt(eps); lat0 = lat0 + Z; lon0 = lon0 + Z; x = x + Z; y = y + Z; azi0 = atan2dx(x, y); rho = hypot(x, y); s = a * atan(rho / a); little = rho <= a; rho(~little) = 1 ./ rho(~little); g = Z == 0; trip = ~g; lat = Z; lon = Z; azi = Z; m = Z; M = Z; ds = Z; for k = 1 : numit [lat(g), lon(g), azi(g), ~, m(g), M(g)] = ... geodreckon(lat0(g), lon0(g), s(g), azi0(g), ellipsoid); g = g & ~trip; if ~any(g), break, end c = little & g; ds(c) = (m(c) ./ M(c) - rho(c)) .* M(c).^2; c = ~little & g; ds(c) = (rho(c) - M(c) ./ m(c)) .* m(c).^2; s(g) = s(g) - ds(g); trip(g) = ~(abs(ds(g)) >= eps1); end c = ~trip; if any(c) lat(c) = nan; lon(c) = nan; azi(c) = nan; M(c) = nan; end rk = M; end GeographicLib-1.45/matlab/geographiclib/polarst_inv.m0000644000771000077100000000414312602735126022603 0ustar ckarneyckarneyfunction [lat, lon, gam, k] = polarst_inv(isnorth, x, y, ellipsoid) %POLARST_INV Inverse polar stereographic projection % % [lat, lon] = POLARST_INV(isnorth, x, y) % [lat, lon, gam, k] = POLARST_INV(isnorth, x, y, ellipsoid) % % performs the inverse polar stereographic projection of points (x,y) to % (lat,lon) using the north (south) as the center of projection depending % on whether isnortp is 1 (0). These input arguments can be scalars or % arrays of equal size. The ellipsoid vector is of the form [a, e], % where a is the equatorial radius in meters, e is the eccentricity. If % ellipsoid is omitted, the WGS84 ellipsoid (more precisely, the value % returned by defaultellipsoid) is used. projdoc defines the projection % and gives the restrictions on the allowed ranges of the arguments. The % forward projection is given by polarst_fwd. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat, lon, gam are in degrees. The projected coordinates x, y are in % meters (more precisely the units used for the equatorial radius). k is % dimensionless. % % See also PROJDOC, POLARST_FWD, UTMUPS_FWD, UTMUPS_INV, % DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2015) . narginchk(3, 4) if nargin < 4, ellipsoid = defaultellipsoid; end try Z = zeros(size(isnorth + x + y)); catch error('isnorth, x, y have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end a = ellipsoid(1); e2 = ellipsoid(2)^2; e2m = 1 - e2; c = sqrt(e2m) * exp(eatanhe(1, e2)); isnorth = 2 * logical(isnorth) - 1; rho = hypot(x, y); t = rho / (2 * a / c); taup = (1 ./ t - t) / 2; tau = tauf(taup, e2); lat = atand(tau); lat(rho == 0) = 90; lat = isnorth .* lat; lon = atan2dx(x, -isnorth .* y); if nargout > 2 gam = AngNormalize(isnorth .* lon); if nargout > 3 secphi = hypot(1, tau); k = (rho / a) .* secphi .* sqrt(e2m + e2 .* secphi.^-2) + Z; k(rho == 0) = 1; end end end GeographicLib-1.45/matlab/geographiclib/projdoc.m0000644000771000077100000000640012602735126021701 0ustar ckarneyckarneyfunction projdoc %PROJDOC Projections for an ellipsoid % % This package implements five projections: % * the transverse Mercator projection (tranmerc) % * the polar stereographic projection (polarst) % * the azimuthal equidistant projection (eqdazim) % * the Cassini-Soldner projection (cassini) % * the ellipsoidal gnomonic projection (gnomonic) % % The package implements the forward projection (from geographic to % projected coordinates) and inverse projection (from projected to % geographic coordinates) with abbreviated function names (listed in % parentheses in the list above) suffixed by _fwd and _inv. For each % function, metric properties of the projection are also returned. % % The ellipsoidal gnomonic projection is defined by % % [~,azi0,~,~,m,M] = geoddistance(lat0,lon0,lat,lon) % rho = m./M, x = rho.*sind(azi0), y = rho.*cosd(azi0) % % Obviously this is an azimuthal projection. It also enjoys % approximately the property of the spherical gnomonic projection, that % geodesics map to straight lines. The projection is derived in Section % 8 of % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://dx.doi.org/10.1007/s00190-012-0578-z % Addenda: http://geographiclib.sf.net/geod-addenda.html % % The parameters of the ellipsoid are specified by the optional ellipsoid % argument to the routines. This is a two-element vector of the form % [a,e], where a is the equatorial radius, e is the eccentricity e = % sqrt(a^2-b^2)/a, and b is the polar semi-axis. Typically, a and b are % measured in meters and the linear and area quantities returned by the % routines are then in meters and meters^2. However, other units can be % employed. If ellipsoid is omitted, then the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is assumed [6378137, % 0.0818191908426215] corresponding to a = 6378137 meters and a % flattening f = (a-b)/a = 1/298.257223563. The flattening and % eccentricity are related by % % e = sqrt(f * (2 - f)) % f = e^2 / (1 + sqrt(1 - e^2)) % % (The functions ecc2flat and flat2ecc implement these conversions.) For % a sphere, set e = 0; for a prolate ellipsoid (b > a), specify e as a % pure imaginary number. % % All angles (latitude, longitude, azimuth) are measured in degrees with % latitudes increasing northwards, longitudes increasing eastwards, and % azimuths measured clockwise from north. For a point at a pole, the % azimuth is defined by keeping the longitude fixed, writing lat = % +/-(90-eps), and taking the limit eps -> 0+. % % Restrictions on the inputs: % * All latitudes must lie in [-90, 90]. % * The equatorial radius, a, must be positive. % * The eccentricity, e, should be satisfy abs(e) < 0.2 in order to % retain full accuracy (this corresponds to flattenings satisfying % abs(f) <= 1/50, approximately). This condition holds for most % applications in geodesy. % % See also TRANMERC_FWD, TRANMERC_INV, POLARST_FWD, POLARST_INV, % EQDAZIM_FWD, EQDAZIM_INV, CASSINI_FWD, CASSINI_INV, % GNOMONIC_FWD, GNOMONIC_INV, DEFAULTELLIPSOID, ECC2FLAT, FLAT2ECC. % Copyright (c) Charles Karney (2012-2015) . help projdoc end GeographicLib-1.45/matlab/geographiclib/eqdazim_fwd.m0000644000771000077100000000410012602735126022526 0ustar ckarneyckarneyfunction [x, y, azi, rk] = eqdazim_fwd(lat0, lon0, lat, lon, ellipsoid) %EQDAZIM_FWD Forward azimuthal equidistant projection % % [x, y] = EQDAZIM_FWD(lat0, lon0, lat, lon) % [x, y, azi, rk] = EQDAZIM_FWD(lat0, lon0, lat, lon, ellipsoid) % % performs the forward azimuthal equidistant projection of points % (lat,lon) to (x,y) using (lat0,lon0) as the center of projection. % These input arguments can be scalars or arrays of equal size. The % ellipsoid vector is of the form [a, e], where a is the equatorial % radius in meters, e is the eccentricity. If ellipsoid is omitted, the % WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. projdoc defines the projection and gives % the restrictions on the allowed ranges of the arguments. The inverse % projection is given by eqdazim_inv. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the geodesic from the center of projection and rk is % the reciprocal of the azimuthal scale. The scale in the radial % direction is 1. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % Section 14 of % % C. F. F. Karney, Geodesics on an ellipsoid of revolution (2011), % http://arxiv.org/abs/1102.1215 % Errata: http://geographiclib.sf.net/geod-addenda.html#geod-errata % % describes how to use this projection in the determination of maritime % boundaries (finding the median line). % % See also PROJDOC, EQDAZIM_INV, GEODDISTANCE, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try [~] = lat0 + lon0 + lat + lon; catch error('lat0, lon0, lat, lon have incompatible sizes') end [s, azi0, azi, ~, m, ~, ~, sig] = ... geoddistance(lat0, lon0, lat, lon, ellipsoid); [x, y] = sincosdx(azi0); x = s .* x; y = s .* y; rk = m ./ s; rk(sig <= 0.01 * sqrt(realmin)) = 1; end GeographicLib-1.45/matlab/geographiclib/geodreckon.m0000644000771000077100000002303012602735126022357 0ustar ckarneyckarneyfunction [lat2, lon2, azi2, S12, m12, M12, M21, a12_s12] = geodreckon ... (lat1, lon1, s12_a12, azi1, ellipsoid, flags) %GEODRECKON Point at specified azimuth, range on an ellipsoid % % [lat2, lon2, azi2] = GEODRECKON(lat1, lon1, s12, azi1) % [lat2, lon2, azi2, S12, m12, M12, M21, a12_s12] = % GEODRECKON(lat1, lon1, s12_a12, azi1, ellipsoid, flags) % % solves the direct geodesic problem of finding the final point and % azimuth given lat1, lon1, s12, and azi1. The input arguments lat1, % lon1, s12, azi1, can be scalars or arrays of equal size. lat1, lon1, % azi1 are given in degrees and s12 in meters. The ellipsoid vector is % of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. lat2, % lon2, and azi2 give the position and forward azimuths at the end point % in degrees. The other outputs, S12, m12, M12, M21, a12 are documented % in geoddoc. geoddoc also gives the restrictions on the allowed ranges % of the arguments. % % flags (default 0) is a combination of 2 flags: % arcmode = bitand(flags, 1) % long_unroll = bitand(flags, 2) % % If arcmode is unset (the default), then, in the long form of the call, % the input argument s12_a12 is the distance s12 (in meters) and the % final output variable a12_s12 is the arc length on the auxiliary sphere % a12 (in degrees). If arcmode is set, then the roles of s12_a12 and % a12_s12 are reversed; s12_a12 is interpreted as the arc length on the % auxiliary sphere a12 (in degrees) and the corresponding distance s12 is % returned in the final output variable a12_s12 (in meters). % % If long_unroll is unset (the default), then the value lon2 is in the % range [-180,180). If long_unroll is set, the longitude is "unrolled" % so that the quantity lon2 - lon1 indicates how many times and in what % sense the geodesic encircles the ellipsoid. % % The two optional arguments, ellipsoid and flags, may be given in any % order and either or both may be omitted. % % When given a combination of scalar and array inputs, GEODRECKON behaves % as though the inputs were expanded to match the size of the arrays. % However, in the particular case where lat1 and azi1 are the same for % all the input points, they should be specified as scalars since this % will considerably speed up the calculations. (In particular a series % of points along a single geodesic is efficiently computed by specifying % an array for s12 only.) % % This is an implementation of the algorithm given in % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://dx.doi.org/10.1007/s00190-012-0578-z % Addenda: http://geographiclib.sf.net/geod-addenda.html % % This function duplicates some of the functionality of the RECKON % function in the MATLAB mapping toolbox. Differences are % % * When the ellipsoid argument is omitted, use the WGS84 ellipsoid. % * The routines work for prolate (as well as oblate) ellipsoids. % * The azimuth at the end point azi2 is returned. % * The solution is accurate to round off for abs(e) < 0.2. % * Redundant calculations are avoided when computing multiple % points on a single geodesic. % * Additional properties of the geodesic are calcuated. % % See also GEODDOC, GEODDISTANCE, GEODAREA, GEODESICDIRECT, GEODESICLINE, % DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . % % This is a straightforward transcription of the C++ implementation in % GeographicLib and the C++ source should be consulted for additional % documentation. This is a vector implementation and the results returned % with array arguments are identical to those obtained with multiple calls % with scalar arguments. narginchk(4, 6) try S = size(lat1 + lon1 + s12_a12 + azi1); catch error('lat1, lon1, s12, azi1 have incompatible sizes') end if nargin <= 4 ellipsoid = defaultellipsoid; flags = 0; elseif nargin == 5 arg5 = ellipsoid(:); if length(arg5) == 2 ellipsoid = arg5; flags = 0; else flags = arg5; ellipsoid = defaultellipsoid; end else arg5 = ellipsoid(:); arg6 = flags; if length(arg5) == 2 ellipsoid = arg5; flags = arg6; else flags = arg5; ellipsoid = arg6; end end if length(ellipsoid) ~= 2 error('ellipsoid must be a vector of size 2') end if ~isscalar(flags) error('flags must be a scalar') end arcmode = bitand(flags, 1); long_unroll = bitand(flags, 2); Z = zeros(prod(S),1); degree = pi/180; tiny = sqrt(realmin); a = ellipsoid(1); e2 = ellipsoid(2)^2; f = e2 / (1 + sqrt(1 - e2)); f1 = 1 - f; ep2 = e2 / (1 - e2); n = f / (2 - f); b = a * f1; areap = nargout >= 4; redlp = nargout >= 5; scalp = nargout >= 6; A3x = A3coeff(n); C3x = C3coeff(n); lat1 = AngRound(LatFix(lat1(:))); lon1 = lon1(:); azi1 = AngRound(azi1(:)); s12_a12 = s12_a12(:); [salp1, calp1] = sincosdx(azi1); [sbet1, cbet1] = sincosdx(lat1); sbet1 = f1 * sbet1; cbet1 = max(tiny, cbet1); [sbet1, cbet1] = norm2(sbet1, cbet1); dn1 = sqrt(1 + ep2 * sbet1.^2); salp0 = salp1 .* cbet1; calp0 = hypot(calp1, salp1 .* sbet1); ssig1 = sbet1; somg1 = salp0 .* sbet1; csig1 = cbet1 .* calp1; csig1(sbet1 == 0 & calp1 == 0) = 1; comg1 = csig1; [ssig1, csig1] = norm2(ssig1, csig1); k2 = calp0.^2 * ep2; epsi = k2 ./ (2 * (1 + sqrt(1 + k2)) + k2); A1m1 = A1m1f(epsi); C1a = C1f(epsi); B11 = SinCosSeries(true, ssig1, csig1, C1a); s = sin(B11); c = cos(B11); stau1 = ssig1 .* c + csig1 .* s; ctau1 = csig1 .* c - ssig1 .* s; C1pa = C1pf(epsi); C3a = C3f(epsi, C3x); A3c = -f * salp0 .* A3f(epsi, A3x); B31 = SinCosSeries(true, ssig1, csig1, C3a); if arcmode sig12 = s12_a12 * degree; [ssig12, csig12] = sincosdx(s12_a12); else tau12 = s12_a12 ./ (b * (1 + A1m1)); s = sin(tau12); c = cos(tau12); B12 = - SinCosSeries(true, stau1 .* c + ctau1 .* s, ... ctau1 .* c - stau1 .* s, C1pa); sig12 = tau12 - (B12 - B11); ssig12 = sin(sig12); csig12 = cos(sig12); if abs(f) > 0.01 ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; B12 = SinCosSeries(true, ssig2, csig2, C1a); serr = (1 + A1m1) .* (sig12 + (B12 - B11)) - s12_a12/b; sig12 = sig12 - serr ./ sqrt(1 + k2 .* ssig2.^2); ssig12 = sin(sig12); csig12 = cos(sig12); end end ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; dn2 = sqrt(1 + k2 .* ssig2.^2); if arcmode || redlp || scalp if arcmode || abs(f) > 0.01 B12 = SinCosSeries(true, ssig2, csig2, C1a); end AB1 = (1 + A1m1) .* (B12 - B11); end sbet2 = calp0 .* ssig2; cbet2 = hypot(salp0, calp0 .* csig2); cbet2(cbet2 == 0) = tiny; somg2 = salp0 .* ssig2; comg2 = csig2; salp2 = salp0; calp2 = calp0 .* csig2; if long_unroll E = 1 - 2*(salp0 < 0); omg12 = E .* (sig12 ... - (atan2( ssig2, csig2) - atan2( ssig1, csig1)) ... + (atan2(E.*somg2, comg2) - atan2(E.*somg1, comg1))); else omg12 = atan2(somg2 .* comg1 - comg2 .* somg1, ... comg2 .* comg1 + somg2 .* somg1); end lam12 = omg12 + ... A3c .* ( sig12 + (SinCosSeries(true, ssig2, csig2, C3a) - B31)); lon12 = lam12 / degree; if long_unroll lon2 = lon1 + lon12; else lon12 = AngNormalize(lon12); lon2 = AngNormalize(AngNormalize(lon1) + lon12); end lat2 = atan2dx(sbet2, f1 * cbet2); azi2 = atan2dx(salp2, calp2); if arcmode a12_s12 = b * ((1 + A1m1) .* sig12 + AB1); else a12_s12 = sig12 / degree; end a12_s12 = reshape(a12_s12 + Z, S); if redlp || scalp A2m1 = A2m1f(epsi); C2a = C2f(epsi); B21 = SinCosSeries(true, ssig1, csig1, C2a); B22 = SinCosSeries(true, ssig2, csig2, C2a); AB2 = (1 + A2m1) .* (B22 - B21); J12 = (A1m1 - A2m1) .* sig12 + (AB1 - AB2); if redlp m12 = b * ((dn2 .* (csig1 .* ssig2) - dn1 .* (ssig1 .* csig2)) ... - csig1 .* csig2 .* J12); m12 = reshape(m12 + Z, S); end if scalp t = k2 .* (ssig2 - ssig1) .* (ssig2 + ssig1) ./ (dn1 + dn2); M12 = csig12 + (t .* ssig2 - csig2 .* J12) .* ssig1 ./ dn1; M21 = csig12 - (t .* ssig1 - csig1 .* J12) .* ssig2 ./ dn2; M12 = reshape(M12 + Z, S); M21 = reshape(M21 + Z, S); end end if areap C4x = C4coeff(n); C4a = C4f(epsi, C4x); A4 = (a^2 * e2) * calp0 .* salp0; B41 = SinCosSeries(false, ssig1, csig1, C4a); B42 = SinCosSeries(false, ssig2, csig2, C4a); salp12 = calp0 .* salp0 .* ... cvmgt(csig1 .* (1 - csig12) + ssig12 .* ssig1, ... ssig12 .* (csig1 .* ssig12 ./ (1 + csig12) + ssig1), ... csig12 <= 0); calp12 = salp0.^2 + calp0.^2 .* csig1 .* csig2; % Enlarge salp1, calp1 is case lat1 is an array and azi1 is a scalar s = zeros(size(salp0)); salp1 = salp1 + s; calp1 = calp1 + s; s = calp0 == 0 | salp0 == 0; salp12(s) = salp2(s) .* calp1(s) - calp2(s) .* salp1(s); calp12(s) = calp2(s) .* calp1(s) + salp2(s) .* salp1(s); s = s & salp12 == 0 & calp12 < 0; salp12(s) = tiny * calp1(s); calp12(s) = -1; if e2 ~= 0 c2 = (a^2 + b^2 * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end S12 = c2 * atan2(salp12, calp12) + A4 .* (B42 - B41); S12 = reshape(S12 + Z, S); end lat2 = reshape(lat2 + Z, S); lon2 = reshape(lon2, S); azi2 = reshape(azi2 + Z, S); end GeographicLib-1.45/matlab/geographiclib/Contents.m0000644000771000077100000001006512602735126022040 0ustar ckarneyckarney% GeographicLib toolbox % Version 1.45 2015-09-30 % % This toolbox provides native MATLAB implementations of a subset of the % C++ library, GeographicLib. Key components of this toolbox are % % * Geodesics, direct, inverse, area calculations. % * Projections, transverse Mercator, polar stereographic, etc. % * Grid systems, UTM, UPS, MGRS. % * Geoid lookup, egm84, egm96, egm2008 geoids supported. % * Geometric transformations, geocentric, local cartesian. % * Great ellipse, direct, inverse, area calculations. % % All the functions are vectorized and so offer speeds comparable to % compiled C++ code when operating on arrays. Additional information is % available in the documentation for the GeographicLib, which is % available at % % http://geographiclib.sf.net/html % % Some common features of these functions: % * Angles (latitude, longitude, azimuth, meridian convergence) are % measured in degrees. % * Distances are measured in meters, areas in meters^2. % * Latitudes must lie in [-90,90]. However most routines don't check % that this condition holds. (Exceptions are the grid system and % geoid functions. These return NaNs for invalid inputs.) % * The ellipsoid is specified as [a, e], where a = equatorial radius % and e = eccentricity. The eccentricity can be pure imaginary to % denote a prolate ellipsoid. % * Keep abs(e) < 0.2 (i.e., abs(f) <= 1/50) for full double precision % accuracy. % % There is some overlap between this toolbox and MATLAB's Mapping % Toolbox. However, this toolbox offers: % * better accuracy; % * treatment of oblate and prolate ellipsoid; % * guaranteed convergence for geoddistance; % * calculation of area and differential properties of geodesics; % * ellipsoidal versions of the equidistant azimuthal and gnomonic % projections. % % Function summary: % % Geodesics % geoddistance - Distance between points on an ellipsoid % geodreckon - Point at specified azimuth, range on an ellipsoid % geodarea - Surface area of polygon on an ellipsoid % % Projections % tranmerc_fwd - Forward transverse Mercator projection % tranmerc_inv - Inverse transverse Mercator projection % polarst_fwd - Forward polar stereographic projection % polarst_inv - Inverse polar stereographic projection % eqdazim_fwd - Forward azimuthal equidistant projection % eqdazim_inv - Inverse azimuthal equidistant projection % cassini_fwd - Forward Cassini-Soldner projection % cassini_inv - Inverse Cassini-Soldner projection % gnomonic_fwd - Forward ellipsoidal gnomonic projection % gnomonic_inv - Inverse ellipsoidal gnomonic projection % % Grid systems % utmups_fwd - Convert to UTM/UPS system % utmups_inv - Convert from UTM/UPS system % mgrs_fwd - Convert UTM/UPS coordinates to MGRS % mgrs_inv - Convert MGRS to UTM/UPS coordinates % % Geoid lookup % geoid_height - Compute the height of the geoid above the ellipsoid % geoid_load - Load a geoid model % % Geometric transformations % geocent_fwd - Conversion from geographic to geocentric coordinates % geocent_inv - Conversion from geocentric to geographic coordinates % loccart_fwd - Convert geographic to local cartesian coordinates % loccart_inv - Convert local cartesian to geographic coordinates % % Great ellipses % gedistance - Great ellipse distance on an ellipsoid % gereckon - Point along great ellipse at given azimuth and range % % Utility % defaultellipsoid - Return the WGS84 ellipsoid % ecc2flat - Convert eccentricity to flattening % flat2ecc - Convert flattening to eccentricity % geographiclib_test - The test suite for the geographiclib package % % Documentation % geoddoc - Geodesics on an ellipsoid of revolution % projdoc - Projections for an ellipsoid % gedoc - Great ellipses on an ellipsoid of revolution % Copyright (c) Charles Karney (2015) . GeographicLib-1.45/matlab/geographiclib/eqdazim_inv.m0000644000771000077100000000403712602735126022553 0ustar ckarneyckarneyfunction [lat, lon, azi, rk] = eqdazim_inv(lat0, lon0, x, y, ellipsoid) %EQDAZIM_INV Inverse azimuthal equidistant projection % % [lat, lon] = EQDAZIM_INV(lat0, lon0, x, y) % [lat, lon, azi, rk] = EQDAZIM_INV(lat0, lon0, x, y, ellipsoid) % % performs the inverse azimuthal equidistant projection of points (x,y) % to (lat,lon) using (lat0,lon0) as the center of projection. These % input arguments can be scalars or arrays of equal size. The ellipsoid % vector is of the form [a, e], where a is the equatorial radius in % meters, e is the eccentricity. If ellipsoid is omitted, the WGS84 % ellipsoid (more precisely, the value returned by defaultellipsoid) is % used. projdoc defines the projection and gives the restrictions on % the allowed ranges of the arguments. The forward projection is given % by eqdazim_fwd. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the geodesic from the center of projection and rk is % the reciprocal of the azimuthal scale. The scale in the radial % direction is 1. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % Section 14 of % % C. F. F. Karney, Geodesics on an ellipsoid of revolution (2011), % http://arxiv.org/abs/1102.1215 % Errata: http://geographiclib.sf.net/geod-addenda.html#geod-errata % % describes how to use this projection in the determination of maritime % boundaries (finding the median line). % % See also PROJDOC, EQDAZIM_FWD, GEODRECKON, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try [~] = lat0 + lon0 + x + y; catch error('lat0, lon0, x, y have incompatible sizes') end azi0 = atan2dx(x, y); s = hypot(x, y); [lat, lon, azi, ~, m, ~, ~, sig] = geodreckon(lat0, lon0, s, azi0, ellipsoid); rk = m ./ s; rk(sig <= 0.01 * sqrt(realmin)) = 1; end GeographicLib-1.45/matlab/geographiclib/geographiclib_test.m0000644000771000077100000005431412602735126024106 0ustar ckarneyckarneyfunction geographiclib_test %GEOGRAPHICLIB_TEST The test suite for the geographiclib package % % GEOGRAPHICLIB_TEST % % runs a variety of tests and produces no output it they are successful. n = 0; i = testrand; if i, n=n+1; fprintf('testrand fail: %d\n', i); end i = GeodSolve0; if i, n=n+1; fprintf('GeodSolve0 fail: %d\n', i); end i = GeodSolve1; if i, n=n+1; fprintf('GeodSolve1 fail: %d\n', i); end i = GeodSolve2; if i, n=n+1; fprintf('GeodSolve2 fail: %d\n', i); end i = GeodSolve4; if i, n=n+1; fprintf('GeodSolve4 fail: %d\n', i); end i = GeodSolve5; if i, n=n+1; fprintf('GeodSolve5 fail: %d\n', i); end i = GeodSolve6; if i, n=n+1; fprintf('GeodSolve6 fail: %d\n', i); end i = GeodSolve9; if i, n=n+1; fprintf('GeodSolve9 fail: %d\n', i); end i = GeodSolve10; if i, n=n+1; fprintf('GeodSolve10 fail: %d\n', i); end i = GeodSolve11; if i, n=n+1; fprintf('GeodSolve11 fail: %d\n', i); end i = GeodSolve12; if i, n=n+1; fprintf('GeodSolve12 fail: %d\n', i); end i = GeodSolve14; if i, n=n+1; fprintf('GeodSolve14 fail: %d\n', i); end i = GeodSolve15; if i, n=n+1; fprintf('GeodSolve15 fail: %d\n', i); end i = GeodSolve17; if i, n=n+1; fprintf('GeodSolve17 fail: %d\n', i); end i = GeodSolve26; if i, n=n+1; fprintf('GeodSolve26 fail: %d\n', i); end i = GeodSolve28; if i, n=n+1; fprintf('GeodSolve28 fail: %d\n', i); end i = GeodSolve33; if i, n=n+1; fprintf('GeodSolve33 fail: %d\n', i); end i = GeodSolve55; if i, n=n+1; fprintf('GeodSolve55 fail: %d\n', i); end i = Planimeter0; if i, n=n+1; fprintf('Planimeter0 fail: %d\n', i); end i = Planimeter5; if i, n=n+1; fprintf('Planimeter5 fail: %d\n', i); end i = Planimeter6; if i, n=n+1; fprintf('Planimeter6 fail: %d\n', i); end i = Planimeter12; if i, n=n+1; fprintf('Planimeter12 fail: %d\n', i); end i = Planimeter13; if i, n=n+1; fprintf('Planimeter13 fail: %d\n', i); end i = gedistance0; if i, n=n+1; fprintf('gedistance0 fail: %d\n', i); end i = tranmerc0; if i, n=n+1; fprintf('tranmerc0 fail: %d\n', i); end i = mgrs0; if i, n=n+1; fprintf('mgrs0 fail: %d\n', i); end i = mgrs1; if i, n=n+1; fprintf('mgrs1 fail: %d\n', i); end i = mgrs2; if i, n=n+1; fprintf('mgrs2 fail: %d\n', i); end i = mgrs3; if i, n=n+1; fprintf('mgrs3 fail: %d\n', i); end i = mgrs4; if i, n=n+1; fprintf('mgrs4 fail: %d\n', i); end assert(n == 0); end function n = assertEquals(x, y, d) n = abs(x - y) <= d; n = sum(~n(:)); end function n = assertNaN(x) n = isnan(x); n = sum(~n(:)); end function n = testrand n = 0; testcases = [ 35.60777, -139.44815, 111.098748429560326, ... -11.17491, -69.95921, 129.289270889708762, ... 8935244.5604818305, 80.50729714281974, 6273170.2055303837, ... 0.16606318447386067, 0.16479116945612937, 12841384694976.432; 55.52454, 106.05087, 22.020059880982801, ... 77.03196, 197.18234, 109.112041110671519, ... 4105086.1713924406, 36.892740690445894, 3828869.3344387607, ... 0.80076349608092607, 0.80101006984201008, 61674961290615.615; -21.97856, 142.59065, -32.44456876433189, ... 41.84138, 98.56635, -41.84359951440466, ... 8394328.894657671, 75.62930491011522, 6161154.5773110616, ... 0.24816339233950381, 0.24930251203627892, -6637997720646.717; -66.99028, 112.2363, 173.73491240878403, ... -12.70631, 285.90344, 2.512956620913668, ... 11150344.2312080241, 100.278634181155759, 6289939.5670446687, ... -0.17199490274700385, -0.17722569526345708, -121287239862139.744; -17.42761, 173.34268, -159.033557661192928, ... -15.84784, 5.93557, -20.787484651536988, ... 16076603.1631180673, 144.640108810286253, 3732902.1583877189, ... -0.81273638700070476, -0.81299800519154474, 97825992354058.708; 32.84994, 48.28919, 150.492927788121982, ... -56.28556, 202.29132, 48.113449399816759, ... 16727068.9438164461, 150.565799985466607, 3147838.1910180939, ... -0.87334918086923126, -0.86505036767110637, -72445258525585.010; 6.96833, 52.74123, 92.581585386317712, ... -7.39675, 206.17291, 90.721692165923907, ... 17102477.2496958388, 154.147366239113561, 2772035.6169917581, ... -0.89991282520302447, -0.89986892177110739, -1311796973197.995; -50.56724, -16.30485, -105.439679907590164, ... -33.56571, -94.97412, -47.348547835650331, ... 6455670.5118668696, 58.083719495371259, 5409150.7979815838, ... 0.53053508035997263, 0.52988722644436602, 41071447902810.047; -58.93002, -8.90775, 140.965397902500679, ... -8.91104, 133.13503, 19.255429433416599, ... 11756066.0219864627, 105.755691241406877, 6151101.2270708536, ... -0.26548622269867183, -0.27068483874510741, -86143460552774.735; -68.82867, -74.28391, 93.774347763114881, ... -50.63005, -8.36685, 34.65564085411343, ... 3956936.926063544, 35.572254987389284, 3708890.9544062657, ... 0.81443963736383502, 0.81420859815358342, -41845309450093.787; -10.62672, -32.0898, -86.426713286747751, ... 5.883, -134.31681, -80.473780971034875, ... 11470869.3864563009, 103.387395634504061, 6184411.6622659713, ... -0.23138683500430237, -0.23155097622286792, 4198803992123.548; -21.76221, 166.90563, 29.319421206936428, ... 48.72884, 213.97627, 43.508671946410168, ... 9098627.3986554915, 81.963476716121964, 6299240.9166992283, ... 0.13965943368590333, 0.14152969707656796, 10024709850277.476; -19.79938, -174.47484, 71.167275780171533, ... -11.99349, -154.35109, 65.589099775199228, ... 2319004.8601169389, 20.896611684802389, 2267960.8703918325, ... 0.93427001867125849, 0.93424887135032789, -3935477535005.785; -11.95887, -116.94513, 92.712619830452549, ... 4.57352, 7.16501, 78.64960934409585, ... 13834722.5801401374, 124.688684161089762, 5228093.177931598, ... -0.56879356755666463, -0.56918731952397221, -9919582785894.853; -87.85331, 85.66836, -65.120313040242748, ... 66.48646, 16.09921, -4.888658719272296, ... 17286615.3147144645, 155.58592449699137, 2635887.4729110181, ... -0.90697975771398578, -0.91095608883042767, 42667211366919.534; 1.74708, 128.32011, -101.584843631173858, ... -11.16617, 11.87109, -86.325793296437476, ... 12942901.1241347408, 116.650512484301857, 5682744.8413270572, ... -0.44857868222697644, -0.44824490340007729, 10763055294345.653; -25.72959, -144.90758, -153.647468693117198, ... -57.70581, -269.17879, -48.343983158876487, ... 9413446.7452453107, 84.664533838404295, 6356176.6898881281, ... 0.09492245755254703, 0.09737058264766572, 74515122850712.444; -41.22777, 122.32875, 14.285113402275739, ... -7.57291, 130.37946, 10.805303085187369, ... 3812686.035106021, 34.34330804743883, 3588703.8812128856, ... 0.82605222593217889, 0.82572158200920196, -2456961531057.857; 11.01307, 138.25278, 79.43682622782374, ... 6.62726, 247.05981, 103.708090215522657, ... 11911190.819018408, 107.341669954114577, 6070904.722786735, ... -0.29767608923657404, -0.29785143390252321, 17121631423099.696; -29.47124, 95.14681, -163.779130441688382, ... -27.46601, -69.15955, -15.909335945554969, ... 13487015.8381145492, 121.294026715742277, 5481428.9945736388, ... -0.51527225545373252, -0.51556587964721788, 104679964020340.318]; lat1 = testcases(:,1); lon1 = testcases(:,2); azi1 = testcases(:,3); lat2 = testcases(:,4); lon2 = testcases(:,5); azi2 = testcases(:,6); s12 = testcases(:,7); a12 = testcases(:,8); m12 = testcases(:,9); M12 = testcases(:,10); M21 = testcases(:,11); S12 = testcases(:,12); [s12a, azi1a, azi2a, S12a, m12a, M12a, M21a, a12a] = ... geoddistance(lat1, lon1, lat2, lon2); n = n + assertEquals(azi1, azi1a, 1e-13); n = n + assertEquals(azi2, azi2a, 1e-13); n = n + assertEquals(s12, s12a, 1e-8); n = n + assertEquals(a12, a12a, 1e-13); n = n + assertEquals(m12, m12a, 1e-8); n = n + assertEquals(M12, M12a, 1e-15); n = n + assertEquals(M21, M21a, 1e-15); n = n + assertEquals(S12, S12a, 0.1); [lat2a, lon2a, azi2a, S12a, m12a, M12a, M21a, a12a] = ... geodreckon(lat1, lon1, s12, azi1, 2); n = n + assertEquals(lat2, lat2a, 1e-13); n = n + assertEquals(lon2, lon2a, 1e-13); n = n + assertEquals(azi2, azi2a, 1e-13); n = n + assertEquals(a12, a12a, 1e-13); n = n + assertEquals(m12, m12a, 1e-8); n = n + assertEquals(M12, M12a, 1e-15); n = n + assertEquals(M21, M21a, 1e-15); n = n + assertEquals(S12, S12a, 0.1); [lat2a, lon2a, azi2a, S12a, m12a, M12a, M21a, s12a] = ... geodreckon(lat1, lon1, a12, azi1, 1+2); n = n + assertEquals(lat2, lat2a, 1e-13); n = n + assertEquals(lon2, lon2a, 1e-13); n = n + assertEquals(azi2, azi2a, 1e-13); n = n + assertEquals(s12, s12a, 1e-8); n = n + assertEquals(m12, m12a, 1e-8); n = n + assertEquals(M12, M12a, 1e-15); n = n + assertEquals(M21, M21a, 1e-15); n = n + assertEquals(S12, S12a, 0.1); end function ell = ellipsoid(a, f) ell = [a, flat2ecc(f)]; end function n = GeodSolve0 n = 0; [s12, azi1, azi2] = geoddistance(40.6, -73.8, 49.01666667, 2.55); n = n + assertEquals(azi1, 53.47022, 0.5e-5); n = n + assertEquals(azi2, 111.59367, 0.5e-5); n = n + assertEquals(s12, 5853226, 0.5); end function n = GeodSolve1 n = 0; [lat2, lon2, azi2] = geodreckon(40.63972222, -73.77888889, 5850e3, 53.5); n = n + assertEquals(lat2, 49.01467, 0.5e-5); n = n + assertEquals(lon2, 2.56106, 0.5e-5); n = n + assertEquals(azi2, 111.62947, 0.5e-5); end function n = GeodSolve2 % Check fix for antipodal prolate bug found 2010-09-04 n = 0; ell = ellipsoid(6.4e6, -1/150.0); [s12, azi1, azi2] = geoddistance(0.07476, 0, -0.07476, 180, ell); n = n + assertEquals(azi1, 90.00078, 0.5e-5); n = n + assertEquals(azi2, 90.00078, 0.5e-5); n = n + assertEquals(s12, 20106193, 0.5); [s12, azi1, azi2] = geoddistance(0.1, 0, -0.1, 180, ell); n = n + assertEquals(azi1, 90.00105, 0.5e-5); n = n + assertEquals(azi2, 90.00105, 0.5e-5); n = n + assertEquals(s12, 20106193, 0.5); end function n = GeodSolve4 % Check fix for short line bug found 2010-05-21 % This also checks the MATLAB specific bug: % Ensure that Lengths in geoddistance is not invoked with zero-length % vectors, 2015-08-25. n = 0; s12 = geoddistance(36.493349428792, 0, 36.49334942879201, .0000008); n = n + assertEquals(s12, 0.072, 0.5e-3); end function n = GeodSolve5 % Check fix for point2=pole bug found 2010-05-03 n = 0; [lat2, lon2, azi2] = geodreckon(0.01777745589997, 30, 10e6, 0); n = n + assertEquals(lat2, 90, 0.5e-5); if lon2 < 0 n = n + assertEquals(lon2, -150, 0.5e-5); n = n + assertEquals(azi2, -180, 0.5e-5); else n = n + assertEquals(lon2, 30, 0.5e-5); n = n + assertEquals(azi2, 0, 0.5e-5); end end function n = GeodSolve6 % Check fix for volatile sbet12a bug found 2011-06-25 (gcc 4.4.4 % x86 -O3). Found again on 2012-03-27 with tdm-mingw32 (g++ 4.6.1). n = 0; s12 = geoddistance(88.202499451857, 0, ... -88.202499451857, 179.981022032992859592); n = n + assertEquals(s12, 20003898.214, 0.5e-3); s12 = geoddistance(89.262080389218, 0, ... -89.262080389218, 179.992207982775375662); n = n + assertEquals(s12, 20003925.854, 0.5e-3); s12 = geoddistance(89.333123580033, 0, ... -89.333123580032997687, 179.99295812360148422); n = n + assertEquals(s12, 20003926.881, 0.5e-3); end function n = GeodSolve9 % Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) n = 0; s12 = geoddistance(56.320923501171, 0, ... -56.320923501171, 179.664747671772880215); n = n + assertEquals(s12, 19993558.287, 0.5e-3); end function n = GeodSolve10 % Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio % 10 rel + debug) n = 0; s12 = geoddistance(52.784459512564, 0, ... -52.784459512563990912, 179.634407464943777557); n = n + assertEquals(s12, 19991596.095, 0.5e-3); end function n = GeodSolve11 % Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio % 10 rel + debug) n = 0; s12 = geoddistance(48.522876735459, 0, ... -48.52287673545898293, 179.599720456223079643); n = n + assertEquals(s12, 19989144.774, 0.5e-3); end function n = GeodSolve12 % Check fix for inverse geodesics on extreme prolate/oblate % ellipsoids Reported 2012-08-29 Stefan Guenther % ; fixed 2012-10-07 n = 0; ell = ellipsoid(89.8, -1.83); [s12, azi1, azi2] = geoddistance(0, 0, -10, 160, ell); n = n + assertEquals(azi1, 120.27, 1e-2); n = n + assertEquals(azi2, 105.15, 1e-2); n = n + assertEquals(s12, 266.7, 1e-1); end function n = GeodSolve14 % Check fix for inverse ignoring lon12 = nan n = 0; [s12, azi1, azi2] = geoddistance(0, 0, 1, NaN); n = n + assertNaN(azi1); n = n + assertNaN(azi2); n = n + assertNaN(s12); end function n = GeodSolve15 % Initial implementation of Math::eatanhe was wrong for e^2 < 0. This % checks that this is fixed. n = 0; ell = ellipsoid(6.4e6, -1/150.0); [~, ~, ~, S12] = geodreckon(1, 2, 4, 3, ell); n = n + assertEquals(S12, 23700, 0.5); end function n = GeodSolve17 % Check fix for LONG_UNROLL bug found on 2015-05-07 n = 0; [lat2, lon2, azi2] = geodreckon(40, -75, 2e7, -10, 2); n = n + assertEquals(lat2, -39, 1); n = n + assertEquals(lon2, -254, 1); n = n + assertEquals(azi2, -170, 1); [lat2, lon2, azi2] = geodreckon(40, -75, 2e7, -10); n = n + assertEquals(lat2, -39, 1); n = n + assertEquals(lon2, 105, 1); n = n + assertEquals(azi2, -170, 1); end function n = GeodSolve26 % Check 0/0 problem with area calculation on sphere 2015-09-08 n = 0; ell = ellipsoid(6.4e6, 0); [~, ~, ~, S12] = geoddistance(1, 2, 3, 4, ell); n = n + assertEquals(S12, 49911046115.0, 0.5); end function n = GeodSolve28 % Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in % Java implementation fixed on 2015-05-19). n = 0; ell = ellipsoid(6.4e6, 0.1); [~, ~, ~, ~, ~, ~, ~, a12] = geodreckon(1, 2, 5e6, 10, ell); n = n + assertEquals(a12, 48.55570690, 0.5e-8); end function n = GeodSolve33 % Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- % sind(-0.0) = +0.0 -- and in some version of Visual Studio -- % fmod(-0.0, 360.0) = +0.0. n = 0; [s12, azi1, azi2] = geoddistance(0, 0, 0, 179); n = n + assertEquals(azi1, 90.00000, 0.5e-5); n = n + assertEquals(azi2, 90.00000, 0.5e-5); n = n + assertEquals(s12, 19926189, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0, 179.5); n = n + assertEquals(azi1, 55.96650, 0.5e-5); n = n + assertEquals(azi2, 124.03350, 0.5e-5); n = n + assertEquals(s12, 19980862, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0, 180); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(azi2, -180.00000, 0.5e-5); n = n + assertEquals(s12, 20003931, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 1, 180); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(azi2, -180.00000, 0.5e-5); n = n + assertEquals(s12, 19893357, 0.5); ell = ellipsoid(6.4e6, 0); [s12, azi1, azi2] = geoddistance(0, 0, 0, 179, ell); n = n + assertEquals(azi1, 90.00000, 0.5e-5); n = n + assertEquals(azi2, 90.00000, 0.5e-5); n = n + assertEquals(s12, 19994492, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0, 180, ell); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(azi2, -180.00000, 0.5e-5); n = n + assertEquals(s12, 20106193, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 1, 180, ell); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(azi2, -180.00000, 0.5e-5); n = n + assertEquals(s12, 19994492, 0.5); ell = ellipsoid(6.4e6, -1/300.0); [s12, azi1, azi2] = geoddistance(0, 0, 0, 179, ell); n = n + assertEquals(azi1, 90.00000, 0.5e-5); n = n + assertEquals(azi2, 90.00000, 0.5e-5); n = n + assertEquals(s12, 19994492, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0, 180, ell); n = n + assertEquals(azi1, 90.00000, 0.5e-5); n = n + assertEquals(azi2, 90.00000, 0.5e-5); n = n + assertEquals(s12, 20106193, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0.5, 180, ell); n = n + assertEquals(azi1, 33.02493, 0.5e-5); n = n + assertEquals(azi2, 146.97364, 0.5e-5); n = n + assertEquals(s12, 20082617, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 1, 180, ell); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(azi2, -180.00000, 0.5e-5); n = n + assertEquals(s12, 20027270, 0.5); % Check also octave-specific versions of this problem. % In 1.44 this returned [-2.0004e+07, -2.0004e+07, 0.0000e+00, 0.0000e+00] s12 = geoddistance(0,0,0,[179.5, 179.6, 180, 180]); n = n + assertEquals(s12, [19980862, 19989165, 20003931, 20003931], 0.5); end function n = GeodSolve55 % Check fix for nan + point on equator or pole not returning all nans in % Geodesic::Inverse, found 2015-09-23. n = 0; [s12, azi1, azi2] = geoddistance(NaN, 0, 0, 90); n = n + assertNaN(azi1); n = n + assertNaN(azi2); n = n + assertNaN(s12); [s12, azi1, azi2] = geoddistance(NaN, 0, 90, 9); n = n + assertNaN(azi1); n = n + assertNaN(azi2); n = n + assertNaN(s12); end function n = Planimeter0 % Check fix for pole-encircling bug found 2011-03-16 n = 0; pa = [89, 0; 89, 90; 89, 180; 89, 270]; pb = [-89, 0; -89, 90; -89, 180; -89, 270]; pc = [0, -1; -1, 0; 0, 1; 1, 0]; pd = [90, 0; 0, 0; 0, 90]; [area, perimeter] = geodarea(pa(:,1), pa(:,2)); n = n + assertEquals(perimeter, 631819.8745, 1e-4); n = n + assertEquals(area, 24952305678.0, 1); [area, perimeter] = geodarea(pb(:,1), pb(:,2)); n = n + assertEquals(perimeter, 631819.8745, 1e-4); n = n + assertEquals(area, -24952305678.0, 1); [area, perimeter] = geodarea(pc(:,1), pc(:,2)); n = n + assertEquals(perimeter, 627598.2731, 1e-4); n = n + assertEquals(area, 24619419146.0, 1); [area, perimeter] = geodarea(pd(:,1), pd(:,2)); n = n + assertEquals(perimeter, 30022685, 1); n = n + assertEquals(area, 63758202715511.0, 1); end function n = Planimeter5 % Check fix for Planimeter pole crossing bug found 2011-06-24 n = 0; points = [89, 0.1; 89, 90.1; 89, -179.9]; [area, perimeter] = geodarea(points(:,1), points(:,2)); n = n + assertEquals(perimeter, 539297, 1); n = n + assertEquals(area, 12476152838.5, 1); end function n = Planimeter6 % Check fix for Planimeter lon12 rounding bug found 2012-12-03 n = 0; pa = [9, -0.00000000000001; 9, 180; 9, 0]; pb = [9, 0.00000000000001; 9, 0; 9, 180]; pc = [9, 0.00000000000001; 9, 180; 9, 0]; pd = [9, -0.00000000000001; 9, 0; 9, 180]; [area, perimeter] = geodarea(pa(:,1), pa(:,2)); n = n + assertEquals(perimeter, 36026861, 1); n = n + assertEquals(area, 0, 1); [area, perimeter] = geodarea(pb(:,1), pb(:,2)); n = n + assertEquals(perimeter, 36026861, 1); n = n + assertEquals(area, 0, 1); [area, perimeter] = geodarea(pc(:,1), pc(:,2)); n = n + assertEquals(perimeter, 36026861, 1); n = n + assertEquals(area, 0, 1); [area, perimeter] = geodarea(pd(:,1), pd(:,2)); n = n + assertEquals(perimeter, 36026861, 1); n = n + assertEquals(area, 0, 1); end function n = Planimeter12 % Area of arctic circle (not really -- adjunct to rhumb-area test) n = 0; points = [66.562222222, 0; 66.562222222, 180]; [area, perimeter] = geodarea(points(:,1), points(:,2)); n = n + assertEquals(perimeter, 10465729, 1); n = n + assertEquals(area, 0, 1); end function n = Planimeter13 % Check encircling pole twice n = 0; points = [89,-360; 89,-240; 89,-120; 89,0; 89,120; 89,240]; [area, perimeter] = geodarea(points(:,1), points(:,2)); n = n + assertEquals(perimeter, 1160741, 1); n = n + assertEquals(area, 32415230256.0, 1); end function n = gedistance0 % gedistance(0, 0, 0, 100) wrongly return nan; 2015-09-23 n = 0; s12 = gedistance(0, 0, 0, 100); n = n + assertEquals(s12, 11131949, 0.5); end function n = tranmerc0 % In 1.44, tranmerc_{fwd,inv} didn't work with array arguments. n = 0; % This used to result in an error [x, y, gam, k] = tranmerc_fwd(0, 0, [90,90;85,85], [10,20;10,20]); k0 = 0.9996; n = n + assertEquals(x, [0, 0; 96820.412637, 190740.935334]/k0, 0.5e-6); n = n + assertEquals(y, [9997964.943021, 9997964.943021; ... 9448171.516284, 9473242.646190]/k0, 0.5e-6); n = n + assertEquals(gam, [10, 20; ... 9.962710901776, 19.929896900550], 0.5e-12); n = n + assertEquals(k, [0.9996, 0.9996; ... 0.999714504947, 1.000044424775]/k0, 0.5e-12); % This used to result in NaNs [x, y, gam, k] = tranmerc_fwd(0, 0, [90,90;85,85]', [10,20;10,20]'); k0 = 0.9996; n = n + assertEquals(x, [0, 0; 96820.412637, 190740.935334]'/k0, 0.5e-6); n = n + assertEquals(y, [9997964.943021, 9997964.943021; ... 9448171.516284, 9473242.646190]'/k0, 0.5e-6); n = n + assertEquals(gam, [10, 20; ... 9.962710901776, 19.929896900550]', 0.5e-12); n = n + assertEquals(k, [0.9996, 0.9996; ... 0.999714504947, 1.000044424775]'/k0, 0.5e-12); end function n = mgrs0 % In 1.43, mgrs_inv didn't detect illegal letter combinations. n = 0; % This used to result in finite x, y [x, y, zone, northp] = mgrs_inv('38RMB'); n = n + assertNaN(x) + assertNaN(y); n = n + assertEquals(zone, -4, 0); n = n + assertEquals(northp, false, 0); end function n = mgrs1 % In 1.44, mgrs_fwd gives the wrong results with prec = 10 or 11 in octave n = 0; % This used to result in '38SMB-1539607552-1539607552' mgrs = mgrs_fwd(450000, 3650000, 38, 1, 11); n = n + assertEquals(mgrs{1}, '38SMB5000000000050000000000', 0); end function n = mgrs2 % In 1.43, mgrs_inv doesn't decode prec 11 string correctly n = 0; % This used to result in x = y = NaN [x, y, zone, northp] = mgrs_inv('38SMB5000000000050000000000'); n = n + assertEquals(x, 450000.0000005, 0.5e-6); n = n + assertEquals(y, 3650000.0000005, 0.5e-6); n = n + assertEquals(zone, 38, 0); n = n + assertEquals(northp, true, 0); end function n = mgrs3 % GeoConvert16: Check MGRS::Forward improved rounding fix, 2015-07-22 n = 0; mgrs = mgrs_fwd(444140.6, 3684706.3, 38, 1, 8); n = n + assertEquals(mgrs{1}, '38SMB4414060084706300', 0); end function n = mgrs4 % GeoConvert17: Check MGRS::Forward digit consistency fix, 2015-07-23 n = 0; mgrs = mgrs_fwd(500000, 63.811, 38, 1, 8); n = n + assertEquals(mgrs{1}, '38NNF0000000000063811', 0); mgrs = mgrs_fwd(500000, 63.811, 38, 1, 9); n = n + assertEquals(mgrs{1}, '38NNF000000000000638110', 0); end GeographicLib-1.45/matlab/geographiclib/polarst_fwd.m0000644000771000077100000000442312602735126022570 0ustar ckarneyckarneyfunction [x, y, gam, k] = polarst_fwd(isnorth, lat, lon, ellipsoid) %POLARST_FWD Forward polar stereographic projection % % [x, y] = POLARST_FWD(isnorth, lat, lon) % [x, y, gam, k] = POLARST_FWD(isnorth, lat, lon, ellipsoid) % % performs the forward polar stereographic projection of points (lat,lon) % to (x,y) using the north (south) as the center of projection depending % on whether isnortp is 1 (0). These input arguments can be scalars or % arrays of equal size. The ellipsoid vector is of the form [a, e], % where a is the equatorial radius in meters, e is the eccentricity. If % ellipsoid is omitted, the WGS84 ellipsoid (more precisely, the value % returned by defaultellipsoid) is used. projdoc defines the projection % and gives the restrictions on the allowed ranges of the arguments. The % inverse projection is given by polarst_inv. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat, lon, gam are in degrees. The projected coordinates x, y are in % meters (more precisely the units used for the equatorial radius). k is % dimensionless. % % See also PROJDOC, POLARST_INV, UTMUPS_FWD, UTMUPS_INV, % DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2015) . narginchk(3, 4) if nargin < 4, ellipsoid = defaultellipsoid; end try Z = zeros(size(isnorth + lat + lon)); catch error('isnorth, lat, lon have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end overflow = 1/eps^2; a = ellipsoid(1); e2 = ellipsoid(2)^2; e2m = 1 - e2; c = sqrt(e2m) * exp(eatanhe(1, e2)); isnorth = 2 * logical(isnorth) - 1; lat = LatFix(lat) .* isnorth; tau = tand(lat); tau(abs(lat) == 90) = sign(lat(abs(lat) == 90)) * overflow; taup = taupf(tau, e2); rho = hypot(1, taup) + abs(taup); rho(taup >= 0) = cvmgt(1./rho(taup >= 0), 0, lat(taup >= 0) ~= 90); rho = rho * (2 * a / c); [x, y] = sincosdx(lon); x = rho .* x; y = -isnorth .* rho .* y; if nargout > 2 gam = AngNormalize(isnorth .* lon) + Z; if nargout > 3 secphi = hypot(1, tau); k = (rho / a) .* secphi .* sqrt(e2m + e2 .* secphi.^-2) + Z; k(lat == 90) = 1; end end end GeographicLib-1.45/matlab/geographiclib/gedistance.m0000644000771000077100000001076412602735126022357 0ustar ckarneyckarneyfunction [s12, azi1, azi2, S12] = gedistance(lat1, lon1, lat2, lon2, ellipsoid) %GEDISTANCE Great ellipse distance on an ellipsoid % % [s12, azi1, azi2] = GEDISTANCE(lat1, lon1, lat2, lon2) % [s12, azi1, azi2, S12] = GEDISTANCE(lat1, lon1, lat2, lon2, ellipsoid) % % solves the inverse great ellipse problem of finding of length and % azimuths of the great ellipse between points specified by lat1, lon1, % lat2, lon2. The input latitudes and longitudes, lat1, lon1, lat2, % lon2, can be scalars or arrays of equal size and must be expressed in % degrees. The ellipsoid vector is of the form [a, e], where a is the % equatorial radius in meters, e is the eccentricity. If ellipsoid is % omitted, the WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. The output s12 is the distance in meters % and azi1 and azi2 are the forward azimuths at the end points in % degrees. The optional output S12 is the area between the great ellipse % and the equator (in meters^2). gedoc gives an example and provides % additional background information. gedoc also gives the restrictions % on the allowed ranges of the arguments. % % When given a combination of scalar and array inputs, the scalar inputs % are automatically expanded to match the size of the arrays. % % geoddistance solves the equivalent geodesic problem and usually this is % preferable to using GEDISTANCE. % % See also GEDOC, GERECKON, DEFAULTELLIPSOID, GEODDISTANCE, GEODRECKON. % Copyright (c) Charles Karney (2014-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat1 + lon1 + lat2 + lon2); catch error('lat1, lon1, s12, azi1 have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end Z = zeros(S); lat1 = lat1 + Z; lon1 = lon1 + Z; lat2 = lat2 + Z; lon2 = lon2 + Z; tiny = sqrt(realmin); a = ellipsoid(1); e2 = ellipsoid(2)^2; f = e2 / (1 + sqrt(1 - e2)); f1 = 1 - f; areap = nargout >= 4; lat1 = AngRound(LatFix(lat1(:))); lat2 = AngRound(LatFix(lat2(:))); lon12 = AngRound(AngDiff(lon1(:), lon2(:))); [sbet1, cbet1] = sincosdx(lat1); sbet1 = f1 * sbet1; cbet1 = max(tiny, cbet1); [sbet1, cbet1] = norm2(sbet1, cbet1); [sbet2, cbet2] = sincosdx(lat2); sbet2 = f1 * sbet2; cbet2 = max(tiny, cbet2); [sbet2, cbet2] = norm2(sbet2, cbet2); [slam12, clam12] = sincosdx(lon12); % Solve great circle sgam1 = cbet2 .* slam12; cgam1 = +cbet1 .* sbet2 - sbet1 .* cbet2 .* clam12; sgam2 = cbet1 .* slam12; cgam2 = -sbet1 .* cbet2 + cbet1 .* sbet2 .* clam12; ssig12 = hypot(sgam1, cgam1); csig12 = sbet1 .* sbet2 + cbet1 .* cbet2 .* clam12; [sgam1, cgam1] = norm2(sgam1, cgam1); [sgam2, cgam2] = norm2(sgam2, cgam2); % no need to normalize [ssig12, csig12] cgam0 = hypot(cgam1, sgam1 .* sbet1); ssig1 = sbet1; csig1 = cbet1 .* cgam1; csig1(ssig1 == 0 & csig1 == 0) = 1; [ssig1, csig1] = norm2(ssig1, csig1); ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; k2 = e2 * cgam0.^2; epsi = k2 ./ (2 * (1 + sqrt(1 - k2)) - k2); C1a = C1f(epsi); A1 = a * (1 + A1m1f(epsi)) .* (1 - epsi)./(1 + epsi); s12 = A1 .* (atan2(ssig12, csig12) + ... (SinCosSeries(true, ssig2, csig2, C1a) - ... SinCosSeries(true, ssig1, csig1, C1a))); azi1 = atan2dx(sgam1, cgam1 .* sqrt(1 - e2 * cbet1.^2)); azi2 = atan2dx(sgam2, cgam2 .* sqrt(1 - e2 * cbet2.^2)); s12 = reshape(s12, S); azi1 = reshape(azi1, S); azi2 = reshape(azi2, S); if areap sgam0 = sgam1 .* cbet1; A4 = (a^2 * e2) * cgam0 .* sgam0; n = f / (2 - f); G4x = G4coeff(n); G4a = C4f(epsi, G4x); B41 = SinCosSeries(false, ssig1, csig1, G4a); B42 = SinCosSeries(false, ssig2, csig2, G4a); S12 = A4 .* (B42 - B41); S12(cgam0 == 0 | sgam0 == 0) = 0; sgam12 = sgam2 .* cgam1 - cgam2 .* sgam1; cgam12 = cgam2 .* cgam1 + sgam2 .* sgam1; s = sgam12 == 0 & cgam12 < 0; sgam12(s) = tiny * cgam1(s); cgam12(s) = -1; gam12 = atan2(sgam12, cgam12); l = abs(gam12) < 1; dlam12 = 1 + clam12(l); dbet1 = 1 + cbet1(l); dbet2 = 1 + cbet2(l); gam12(l) = ... 2 * atan2(slam12(l) .* (sbet1(l) .* dbet2 + sbet2(l) .* dbet1), ... dlam12 .* (sbet1(l) .* sbet2(l) + dbet1 .* dbet2)); if e2 ~= 0 c2 = a^2 * (1 + (1 - e2) * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end S12 = S12 + c2 * gam12; S12 = reshape(S12, S); end end GeographicLib-1.45/matlab/geographiclib/geodarea.m0000644000771000077100000001013112602735126022004 0ustar ckarneyckarneyfunction [A, P, N] = geodarea(lats, lons, ellipsoid) %GEODAREA Surface area of polygon on an ellipsoid % % A = GEODAREA(lats, lons) % [A, P, N] = GEODAREA(lats, lons, ellipsoid) % % calculates the surface area A of the geodesic polygon specified by the % input vectors lats, lons (in degrees). The ellipsoid vector is of the % form [a, e], where a is the equatorial radius in meters, e is the % eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. There is % no need to "close" the polygon by repeating the first point. Multiple % polygons can be specified by separating the vertices by NaNs in the % vectors. Thus a series of quadrilaterals can be specified as two 5 x K % arrays where the 5th row is NaN. The output, A, is in meters^2. % Counter-clockwise traversal counts as a positive area. Only simple % polygons (which do not intersect themselves) are supported. Also % returned are the perimeters of the polygons in P (meters) and the % numbers of vertices in N. geoddoc gives the restrictions on the % allowed ranges of the arguments. % % GEODAREA loosely duplicates the functionality of the areaint function % in the MATLAB mapping toolbox. The major difference is that the % polygon edges are taken to be geodesics and the area contributed by % each edge is computed using a series expansion with is accurate % regardless of the length of the edge. The formulas are derived in % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://dx.doi.org/10.1007/s00190-012-0578-z % Addenda: http://geographiclib.sf.net/geod-addenda.html % % See also GEODDOC, GEODDISTANCE, GEODRECKON, POLYGONAREA, % DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . narginchk(2, 3) if nargin < 3, ellipsoid = defaultellipsoid; end if ~isequal(size(lats), size(lons)) error('lats, lons have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end lat1 = lats(:); lon1 = lons(:); M = length(lat1); ind = [0; find(isnan(lat1 + lon1))]; if length(ind) == 1 || ind(end) ~= M ind = [ind; M + 1]; end K = length(ind) - 1; A = zeros(K, 1); P = A; N = A; if M == 0, return, end lat2 = [lat1(2:end, 1); 0]; lon2 = [lon1(2:end, 1); 0]; m0 = min(M, ind(1:end-1) + 1); m1 = max(1, ind(2:end) - 1); lat2(m1) = lat1(m0); lon2(m1) = lon1(m0); a = ellipsoid(1); e2 = ellipsoid(2)^2; f = e2 / (1 + sqrt(1 - e2)); b = (1 - f) * a; if e2 ~= 0 c2 = (a^2 + b^2 * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end area0 = 4 * pi * c2; [s12, ~, ~, S12] = geoddistance(lat1, lon1, lat2, lon2, ellipsoid); cross = transit(lon1, lon2); for k = 1 : K N(k) = m1(k) - m0(k) + 1; P(k) = accumulator(s12(m0(k):m1(k))); [As, At] = accumulator(S12(m0(k):m1(k))); crossings = sum(cross(m0(k):m1(k))); if mod(crossings, 2) ~= 0 [As, At] = accumulator( ((As < 0) * 2 - 1) * area0 / 2, As, At); end As = -As; At = -At; if As > area0/2 As = accumulator(-area0, As, At); elseif As <= -area0/2 As = accumulator( area0, As, At); end A(k) = As; end end function cross = transit(lon1, lon2) %TRANSIT Count crossings of prime meridian % % CROSS = TRANSIT(LON1, LON2) return 1 or -1 if crossing prime meridian % in east or west direction. Otherwise return zero. lon1 = AngNormalize(lon1); lon2 = AngNormalize(lon2); lon12 = AngDiff(lon1, lon2); cross = zeros(length(lon1), 1); cross(lon1 < 0 & lon2 >= 0 & lon12 > 0) = 1; cross(lon2 < 0 & lon1 >= 0 & lon12 < 0) = -1; end function [s, t] = accumulator(x, s, t) %ACCUMULATOR Accurately sum x % % [S, T] = ACCUMULATOR(X, S, T) accumulate the sum of the elements of X % into [S, T] using extended precision. S and T are scalars. if nargin < 3, t = 0; end if nargin < 2, s = 0; end for y = x(:)' % Here's Shewchuk's solution... [z, u] = sumx(y, t); [s, t] = sumx(z, s); if s == 0 s = u; else t = t + u; end end end GeographicLib-1.45/matlab/geographiclib/private/eatanhe.m0000644000771000077100000000040312602735126023315 0ustar ckarneyckarneyfunction y = eatanhe(x, e2) %EATANHE e*atanh(e*x) % % EATANHE(x, e2) returns e*atanh(e*x) where e = sqrt(e2) % e2 is a scalar; x can be any shape. e = sqrt(abs(e2)); if (e2 >= 0) y = e * atanh(e * x); else y = -e * atan(e * x); end end GeographicLib-1.45/matlab/geographiclib/private/geoid_file.m0000644000771000077100000000127612602735126024007 0ustar ckarneyckarneyfunction filename = geoid_file(name, dir) %GEOID_FILE Return filename for geoid data % % filename = geoid_file(name, dir). See the documentation on geoid_load. if nargin < 1 || isempty(name) name = getenv('GEOGRAPHICLIB_GEOID_NAME'); if isempty(name) name = 'egm96-5'; end end if nargin < 2 || isempty(dir) dir = getenv('GEOGRAPHICLIB_GEOID_PATH'); if isempty(dir) dir = getenv('GEOGRAPHICLIB_DATA'); if isempty(dir) if ispc dir = 'C:/ProgramData/GeographicLib'; else dir = '/usr/local/share/GeographicLib'; end end dir = [dir, '/geoids']; end end filename = [dir, '/', name, '.pgm']; end GeographicLib-1.45/matlab/geographiclib/private/SinCosSeries.m0000644000771000077100000000152312602735126024265 0ustar ckarneyckarneyfunction y = SinCosSeries(sinp, sinx, cosx, c) %SINSCOSERIES Evaluate a sine or cosine series using Clenshaw summation % % y = SINCOSSERIES(sinp, sinx, cosx, c) evaluate % y = sum(c[i] * sin( 2*i * x), i, 1, n), if sinp % y = sum(c[i] * cos((2*i-1) * x), i, 1, n), if ~sinp % % where n is the size of c. x is given via its sine and cosine in sinx % and cosx. sinp is a scalar. sinx, cosx, and y are K x 1 arrays. c is % a K x N array. if isempty(sinx), y = []; return, end n = size(c, 2); ar = 2 * (cosx - sinx) .* (cosx + sinx); y1 = zeros(length(sinx), 1); if mod(n, 2) y0 = c(:, n); n = n - 1; else y0 = y1; end for k = n : -2 : 1 y1 = ar .* y0 - y1 + c(:, k); y0 = ar .* y1 - y0 + c(:, k-1); end if sinp y = 2 * sinx .* cosx .* y0; else y = cosx .* (y0 - y1); end end GeographicLib-1.45/matlab/geographiclib/private/G4coeff.m0000644000771000077100000000277212602735126023200 0ustar ckarneyckarneyfunction G4x = G4coeff(n) %G4COEFF Evaluate coefficients for C_4 for great ellipse % % G4x = G4COEFF(n) evaluates the coefficients of epsilon^l in expansion % of the greate ellipse area (expressed in terms of n and epsi). n is a % scalar. G4x is a 1 x 21 array. persistent coeff nG4 nG4x if isempty(coeff) nG4 = 6; nG4x = (nG4 * (nG4 + 1)) / 2; coeff = [ ... -13200233, 1537536, ... 138833443, 13938873, 5765760, ... -135037988, -32774196, -4232371, 5765760, ... 6417449, 3013374, 1012583, 172458, 720720, ... -117944, -110552, -84227, -41184, -9009, 120120, ... 200, 416, 1144, 6864, 21021, 15015, 90090, ... 2625577, 1537536, ... -39452953, -3753828, 8648640, ... 71379996, 16424252, 1987557, 17297280, ... -5975241, -2676466, -847847, -136422, 4324320, ... 117944, 110552, 84227, 41184, 9009, 1081080, ... -5512967, 15375360, ... 2443153, 208182, 2882880, ... -3634676, -741988, -76219, 5765760, ... 203633, 80106, 20735, 2574, 1441440, ... 22397, 439296, ... -71477, -5317, 768768, ... 48020, 8372, 715, 1153152, ... -5453, 1317888, ... 1407, 91, 329472, ... 21, 146432, ... ]; end G4x = zeros(1, nG4x); o = 1; k = 1; for l = 0 : nG4 - 1 for j = nG4 - 1 : -1 : l m = nG4 - j - 1; G4x(k) = polyval(coeff(o : o + m), n) / coeff(o + m + 1); k = k + 1; o = o + m + 2; end end end GeographicLib-1.45/matlab/geographiclib/private/norm2.m0000644000771000077100000000031712602735126022751 0ustar ckarneyckarneyfunction [x, y] = norm2(x, y) %NORM2 Normalize x and y % % [x, y] = NORM2(x, y) normalize x and y so that x^2 + y^2 = 1. x and y % can be any shape. r = hypot(x, y); x = x ./ r; y = y ./ r; end GeographicLib-1.45/matlab/geographiclib/private/cvmgt.m0000644000771000077100000000106412602735126023034 0ustar ckarneyckarneyfunction z = cvmgt(x, y, p) %CVMGT Conditional merge of two vectors % % z = CVMGT(x, y, p) return a vector z whose elements are x if p is true % and y otherwise. p, x, and y should be the same shape except that x % and y may be scalars. CVMGT stands for conditional vector merge true % (an intrinsic function for the Cray fortran compiler). It implements % the C++ statement % % z = p ? x : y; z = zeros(size(p)); if isscalar(x) z(p) = x; else z(p) = x(p); end if isscalar(y) z(~p) = y; else z(~p) = y(~p); end end GeographicLib-1.45/matlab/geographiclib/private/LatFix.m0000644000771000077100000000033512602735126023103 0ustar ckarneyckarneyfunction y = LatFix(x) %LATFIX Check that latitiude is in [-90, 90] % % y = LATFIX(x) returns x is it is in the range [-90, 90]; otherwise it % returns NaN. x can be any shape. y = x; y(abs(x) > 90) = nan; end GeographicLib-1.45/matlab/geographiclib/private/atan2dx.m0000644000771000077100000000155512602735126023262 0ustar ckarneyckarneyfunction z = atan2dx(y, x) %ATAN2DX Compute 2 argument arctangent with result in degrees % % z = ATAN2DX(y, x) compute atan2(y, x) with result in degrees in % [-180,180) and quadrant symmetries enforced. x and y must be the same % shape. persistent octavep if isempty(octavep) octavep = exist('OCTAVE_VERSION', 'builtin') ~= 0; end if ~octavep % MATLAB implements symmetries already, just need to fix range z = 0 - atan2d(0 - y, x); else q1 = abs(y) > abs(x); t = y(q1); y(q1) = x(q1); x(q1) = t; q2 = x < 0; x(q2) = -x(q2); q = 2 * q1 + q2; z = atan2(y, x) * (180 / pi); % z in [-45, 45] % t = q == 0; z(t) = 0 + z(t); t = q == 1 & y > 0; z(t) = 180 - z(t); t = q == 1 & y <= 0; z(t) = -180 - z(t); t = q == 2; z(t) = 90 - z(t); t = q == 3; z(t) = -90 + z(t); end end GeographicLib-1.45/matlab/geographiclib/private/C3f.m0000644000771000077100000000066512602735126022335 0ustar ckarneyckarneyfunction C3 = C3f(epsi, C3x) %C3F Evaluate C_3 % % C3 = C3F(epsi, C3x) evaluates C_{3,l} using Eq. (25) and the % coefficient vector C3x. epsi is a K x 1 array. C3x is a 1 x 15 array. % C3 is a K x 5 array. nC3 = 6; C3 = zeros(length(epsi), nC3 - 1); mult = 1; o = 1; for l = 1 : nC3 - 1 m = nC3 - l - 1; mult = mult .* epsi; C3(:, l) = mult .* polyval(C3x(o : o + m), epsi); o = o + m + 1; end end GeographicLib-1.45/matlab/geographiclib/private/C1f.m0000644000771000077100000000120312602735126022320 0ustar ckarneyckarneyfunction C1 = C1f(epsi) %C1F Evaluate C_{1,k} % % C1 = C1F(epsi) evaluates C_{1,l} using Eq. (18). epsi is a K x 1 % array and C1 is a K x 6 array. persistent coeff nC1 if isempty(coeff) nC1 = 6; coeff = [ ... -1, 6, -16, 32, ... -9, 64, -128, 2048, ... 9, -16, 768, ... 3, -5, 512, ... -7, 1280, ... -7, 2048, ... ]; end C1 = zeros(length(epsi), nC1); eps2 = epsi.^2; d = epsi; o = 1; for l = 1 : nC1 m = floor((nC1 - l) / 2); C1(:,l) = d .* polyval(coeff(o : o + m), eps2) / coeff(o + m + 1); o = o + m + 2; d = d .* epsi; end end GeographicLib-1.45/matlab/geographiclib/private/A2m1f.m0000644000771000077100000000056712602735126022571 0ustar ckarneyckarneyfunction A2m1 = A2m1f(epsi) %A2M1F Evaluate A_2 - 1 % % A2m1 = A2M1F(epsi) evaluates A_2 - 1 using Eq. (42). epsi and A2m1 are % K x 1 arrays. persistent coeff if isempty(coeff) coeff = [ ... -11, -28, -192, 0, 256, ... ]; end eps2 = epsi.^2; t = polyval(coeff(1 : end - 1), eps2) / coeff(end); A2m1 = (t - epsi) ./ (1 + epsi); end GeographicLib-1.45/matlab/geographiclib/private/GeoRotation.m0000644000771000077100000000173012602735126024146 0ustar ckarneyckarneyfunction M = GeoRotation(sphi, cphi, slam, clam) %GEOROTATION The rotation from geodetic to geocentric % % M = GeoRotation(sphi, cphi, slam, clam) % % sphi, cphi, slam, clam must all have the same shape, S. M has the % shape [3, 3, S]. % This rotation matrix is given by the following quaternion operations % qrot(lam, [0,0,1]) * qrot(phi, [0,-1,0]) * [1,1,1,1]/2 % or % qrot(pi/2 + lam, [0,0,1]) * qrot(-pi/2 + phi , [-1,0,0]) % where % qrot(t,v) = [cos(t/2), sin(t/2)*v[1], sin(t/2)*v[2], sin(t/2)*v[3]] S = size(sphi); M = zeros(9, prod(S)); sphi = sphi(:); cphi = cphi(:); slam = slam(:); clam = clam(:); % Local X axis (east) in geocentric coords M(1,:) = -slam; M(2,:) = clam; M(3,:) = 0; % Local Y axis (north) in geocentric coords M(4,:) = -clam .* sphi; M(5,:) = -slam .* sphi; M(6,:) = cphi; % Local Z axis (up) in geocentric coords M(7,:) = clam .* cphi; M(8,:) = slam .* cphi; M(9,:) = sphi; M = reshape(M, [3, 3, S]); end GeographicLib-1.45/matlab/geographiclib/private/AngRound.m0000644000771000077100000000043712602735126023434 0ustar ckarneyckarneyfunction y = AngRound(x) %ANGROUND Round tiny values so that tiny values become zero. % % y = ANGROUND(x) rounds x by adding and subtracting 1/16 to it if it is % small. x can be any shape. z = 1/16; y = abs(x); y(y < z) = z - (z - y(y < z)); y(x < 0) = 0 - y(x < 0); end GeographicLib-1.45/matlab/geographiclib/private/C1pf.m0000644000771000077100000000125512602735126022507 0ustar ckarneyckarneyfunction C1p = C1pf(epsi) %C1PF Evaluate C'_{1,k} % % C1p = C1PF(epsi) evaluates C'_{1,l} using Eq. (21). epsi is a K x 1 % array and C1 is a K x 6 array. persistent coeff nC1p if isempty(coeff) nC1p = 6; coeff = [ ... 205, -432, 768, 1536, ... 4005, -4736, 3840, 12288, ... -225, 116, 384, ... -7173, 2695, 7680, ... 3467, 7680, ... 38081, 61440, ... ]; end C1p = zeros(length(epsi), nC1p); eps2 = epsi.^2; d = epsi; o = 1; for l = 1 : nC1p m = floor((nC1p - l) / 2); C1p(:,l) = d .* polyval(coeff(o : o + m), eps2) / coeff(o + m + 1); o = o + m + 2; d = d .* epsi; end end GeographicLib-1.45/matlab/geographiclib/private/sincosdx.m0000644000771000077100000000167512602735126023556 0ustar ckarneyckarneyfunction [sinx, cosx] = sincosdx(x) %SINCOSDX Compute sine and cosine with argument in degrees % % [sinx, cosx] = SINCOSDX(x) compute sine and cosine of x in degrees with % exact argument reduction and quadrant symmetries enforced. persistent octavep if isempty(octavep) octavep = exist('OCTAVE_VERSION', 'builtin') ~= 0; end if ~octavep % MATLAB implements argument reduction and symmetries already sinx = sind(x); cosx = cosd(x); else r = rem(x, 360); % workaround rem's bad handling of -0 in octave; fixed 2015-07-22 % http://savannah.gnu.org/bugs/?45587 r(x == 0 & signbit(x)) = -0; q = floor(r / 90 + 0.5); r = r - 90 * q; q = mod(q, 4); r = r * (pi/180); sinx = sin(r); cosx = cos(r); t = q == 1; z = 0 - sinx(t); sinx(t) = cosx(t); cosx(t) = z; t = q == 2; sinx(t) = 0 - sinx(t); cosx(t) = 0 - cosx(t); t = q == 3; z = sinx(t); sinx(t) = 0 - cosx(t); cosx(t) = z; end end GeographicLib-1.45/matlab/geographiclib/private/sumx.m0000644000771000077100000000047112602735126022711 0ustar ckarneyckarneyfunction [s, t] = sumx(u, v) %SUM Error free sum % % [s, t] = SUMX(u, v) returns the rounded sum u + v in s and the error in % t, such that s + t = u + v, exactly. u and v can be any compatible % shapes. s = u + v; up = s - v; vpp = s - up; up = up - u; vpp = vpp - v; t = -(up + vpp); end GeographicLib-1.45/matlab/geographiclib/private/A1m1f.m0000644000771000077100000000056112602735126022562 0ustar ckarneyckarneyfunction A1m1 = A1m1f(epsi) %A1M1F Evaluate A_1 - 1 % % A1m1 = A1M1F(epsi) evaluates A_1 - 1 using Eq. (17). epsi and A1m1 are % K x 1 arrays. persistent coeff if isempty(coeff) coeff = [ ... 1, 4, 64, 0, 256, ... ]; end eps2 = epsi.^2; t = polyval(coeff(1 : end - 1), eps2) / coeff(end); A1m1 = (t + epsi) ./ (1 - epsi); end GeographicLib-1.45/matlab/geographiclib/private/tauf.m0000644000771000077100000000123112602735126022647 0ustar ckarneyckarneyfunction tau = tauf(taup, e2) %TAUF tan(phi) % % TAUF(taup, e2) returns tangent of phi in terms of taup the tangent of % chi. e2, the square of the eccentricity, is a scalar; taup can be any % shape. numit = 5; e2m = 1 - e2; tau = taup / e2m; stol = 0.1 * sqrt(eps) * max(1, abs(taup)); g = isfinite(tau); for i = 1 : numit if ~any(g), break, end tau1 = hypot(1, tau); sig = sinh( eatanhe( tau ./ tau1, e2 ) ); taupa = hypot(1, sig) .* tau - sig .* tau1; dtau = (taup - taupa) .* (1 + e2m .* tau.^2) ./ ... (e2m * tau1 .* hypot(1, taupa)); tau(g) = tau(g) + dtau(g); g = g & abs(dtau) >= stol; end end GeographicLib-1.45/matlab/geographiclib/private/geoid_load_file.m0000644000771000077100000000206712602735126025005 0ustar ckarneyckarneyfunction geoid = geoid_load_file(filename) %GEOID_LOAD_FILE Loads geoid data from filename geoid.file = filename; geoid.offset = NaN; geoid.scale = NaN; fid = fopen(geoid.file, 'r'); if fid == -1, error(['Cannot open ', geoid.file]), end for i = 1:16 if isfinite(geoid.offset) && isfinite(geoid.scale), break, end text = fgetl(fid); if ~ischar(text), continue, end text = strsplit(text, ' '); if length(text) == 3 if strcmp(text{2}, 'Offset') geoid.offset = str2double(text{3}); elseif strcmp(text{2}, 'Scale') geoid.scale = str2double(text{3}); end elseif length(text) == 2 break end end fclose(fid); if ~isfinite(geoid.offset), error('Cannot find offset'), end if ~isfinite(geoid.scale), error('Cannot find scale'), end geoid.im = imread(geoid.file); if ~isa(geoid.im, 'uint16'), error('Wrong image type'), end geoid.h = size(geoid.im, 1); geoid.w = size(geoid.im, 2); if ~(bitand(geoid.w, 1) == 0 && bitand(geoid.h, 1) == 1) error('Image width/height not even/odd') end end GeographicLib-1.45/matlab/geographiclib/private/A3coeff.m0000644000771000077100000000115612602735126023164 0ustar ckarneyckarneyfunction A3x = A3coeff(n) %A3COEFF Evaluate coefficients for A_3 % % A3x = A3COEFF(n) evaluates the coefficients of epsilon^l in Eq. (24). % n is a scalar. A3x is a 1 x 6 array. persistent coeff nA3 if isempty(coeff) nA3 = 6; coeff = [ ... -3, 128, ... -2, -3, 64, ... -1, -3, -1, 16, ... 3, -1, -2, 8, ... 1, -1, 2, ... 1, 1, ... ]; end A3x = zeros(1, nA3); o = 1; k = 1; for j = nA3 - 1 : -1 : 0 m = min(nA3 - j - 1, j); A3x(k) = polyval(coeff(o : o + m), n) / coeff(o + m + 1); k = k + 1; o = o + m + 2; end end GeographicLib-1.45/matlab/geographiclib/private/C4f.m0000644000771000077100000000076512602735126022337 0ustar ckarneyckarneyfunction C4 = C4f(epsi, C4x) %C4F Evaluate C_4 % % C4 = C4F(epsi, C4x) evaluates C_{4,l} in the expansion for the area % (Eq. (65) expressed in terms of n and epsi) using the coefficient % vector C4x. epsi is a K x 1 array. C4x is a 1 x 21 array. C4 is a % K x 6 array. nC4 = 6; C4 = zeros(length(epsi), nC4); mult = 1; o = 1; for l = 0 : nC4 - 1 m = nC4 - l - 1; C4(:, l+1) = mult .* polyval(C4x(o : o + m), epsi); o = o + m + 1; mult = mult .* epsi; end end GeographicLib-1.45/matlab/geographiclib/private/swap.m0000644000771000077100000000015612602735126022667 0ustar ckarneyckarneyfunction [y, x] = swap(x, y) %SWAP Swap two variables. % % [a, b] = SWAP(x, y) sets A to Y and B to X. end GeographicLib-1.45/matlab/geographiclib/private/C4coeff.m0000644000771000077100000000252612602735126023171 0ustar ckarneyckarneyfunction C4x = C4coeff(n) %C4COEFF Evaluate coefficients for C_4 % % C4x = C4COEFF(n) evaluates the coefficients of epsilon^l in expansion % of the area (Eq. (65) expressed in terms of n and epsi). n is a % scalar. C4x is a 1 x 21 array. persistent coeff nC4 nC4x if isempty(coeff) nC4 = 6; nC4x = (nC4 * (nC4 + 1)) / 2; coeff = [ ... 97, 15015, ... 1088, 156, 45045, ... -224, -4784, 1573, 45045, ... -10656, 14144, -4576, -858, 45045, ... 64, 624, -4576, 6864, -3003, 15015, ... 100, 208, 572, 3432, -12012, 30030, 45045, ... 1, 9009, ... -2944, 468, 135135, ... 5792, 1040, -1287, 135135, ... 5952, -11648, 9152, -2574, 135135, ... -64, -624, 4576, -6864, 3003, 135135, ... 8, 10725, ... 1856, -936, 225225, ... -8448, 4992, -1144, 225225, ... -1440, 4160, -4576, 1716, 225225, ... -136, 63063, ... 1024, -208, 105105, ... 3584, -3328, 1144, 315315, ... -128, 135135, ... -2560, 832, 405405, ... 128, 99099, ... ]; end C4x = zeros(1, nC4x); o = 1; k = 1; for l = 0 : nC4 - 1 for j = nC4 - 1 : -1 : l m = nC4 - j - 1; C4x(k) = polyval(coeff(o : o + m), n) / coeff(o + m + 1); k = k + 1; o = o + m + 2; end end end GeographicLib-1.45/matlab/geographiclib/private/C2f.m0000644000771000077100000000120012602735126022316 0ustar ckarneyckarneyfunction C2 = C2f(epsi) %C2F Evaluate C_{2,k} % % C2 = C2F(epsi) evaluates C_{2,l} using Eq. (43). epsi is a K x 1 array % and C2 is a K x 6 array. persistent coeff nC2 if isempty(coeff) nC2 = 6; coeff = [ ... 1, 2, 16, 32, ... 35, 64, 384, 2048, ... 15, 80, 768, ... 7, 35, 512, ... 63, 1280, ... 77, 2048, ... ]; end C2 = zeros(length(epsi), nC2); eps2 = epsi.^2; d = epsi; o = 1; for l = 1 : nC2 m = floor((nC2 - l) / 2); C2(:, l) = d .* polyval(coeff(o : o + m), eps2) / coeff(o + m + 1); o = o + m + 2; d = d .* epsi; end end GeographicLib-1.45/matlab/geographiclib/private/taupf.m0000644000771000077100000000051012602735126023026 0ustar ckarneyckarneyfunction taup = taupf(tau, e2) %TAUPF tan(chi) % % TAUPF(tau, e2) returns tangent of chi in terms of tau the tangent of % phi. e2, the square of the eccentricity, is a scalar; taup can be any % shape. tau1 = hypot(1, tau); sig = sinh( eatanhe( tau ./ tau1, e2 ) ); taup = hypot(1, sig) .* tau - sig .* tau1; end GeographicLib-1.45/matlab/geographiclib/private/C3coeff.m0000644000771000077100000000162312602735126023165 0ustar ckarneyckarneyfunction C3x = C3coeff(n) %C3COEFF Evaluate coefficients for C_3 % % C3x = C3COEFF(n) evaluates the coefficients of epsilon^l in Eq. (25). % n is a scalar. C3x is a 1 x 15 array. persistent coeff nC3 nC3x if isempty(coeff) nC3 = 6; nC3x = (nC3 * (nC3 - 1)) / 2; coeff = [ ... 3, 128, ... 2, 5, 128, ... -1, 3, 3, 64, ... -1, 0, 1, 8, ... -1, 1, 4, ... 5, 256, ... 1, 3, 128, ... -3, -2, 3, 64, ... 1, -3, 2, 32, ... 7, 512, ... -10, 9, 384, ... 5, -9, 5, 192, ... 7, 512, ... -14, 7, 512, ... 21, 2560, ... ]; end C3x = zeros(1, nC3x); o = 1; k = 1; for l = 1 : nC3 - 1 for j = nC3 - 1 : -1 : l m = min(nC3 - j - 1, j); C3x(k) = polyval(coeff(o : o + m), n) / coeff(o + m + 1); k = k + 1; o = o + m + 2; end end end GeographicLib-1.45/matlab/geographiclib/private/A3f.m0000644000771000077100000000034112602735126022322 0ustar ckarneyckarneyfunction A3 = A3f(epsi, A3x) %A3F Evaluate A_3 % % A3 = A3F(epsi, A3x) evaluates A_3 using Eq. (24) and the coefficient % vector A3x. epsi and A3 are K x 1 arrays. A3x is a 1 x 6 array. A3 = polyval(A3x, epsi); end GeographicLib-1.45/matlab/geographiclib/private/cbrtx.m0000644000771000077100000000027512602735126023041 0ustar ckarneyckarneyfunction y = cbrtx(x) %CBRTX The real cube root % % CBRTX(x) is the real cube root of x (assuming x is real). x % can be any shape. y = abs(x).^(1/3); y(x < 0) = -y(x < 0); end GeographicLib-1.45/matlab/geographiclib/private/AngDiff.m0000644000771000077100000000056512602735126023217 0ustar ckarneyckarneyfunction d = AngDiff(x, y) %ANGDIFF Compute angle difference accurately % % d = ANGDIFF(x, y) computes y - x, reduces the result to (-180,180] and % rounds the result. x and y must be in [-180,180]. x and y can be any % compatible shapes. [d, t] = sumx(AngNormalize(x), AngNormalize(-y)); d = - AngNormalize(d); d(d == 180 & t < 0) = -180; d = d - t; end GeographicLib-1.45/matlab/geographiclib/private/AngNormalize.m0000644000771000077100000000041012602735126024274 0ustar ckarneyckarneyfunction x = AngNormalize(x) %ANGNORMALIZE Reduce angle to range [-180, 180) % % x = ANGNORMALIZE(x) reduces angles to the range [-180, 180). x can be % any shape. x = rem(x, 360); x(x >= 180) = x(x >= 180) - 360; x(x < -180) = x(x < -180) + 360; end GeographicLib-1.45/matlab/geographiclib/utmups_inv.m0000644000771000077100000000557312602735126022464 0ustar ckarneyckarneyfunction [lat, lon, gam, k] = utmups_inv(x, y, zone, isnorth) %UTMUPS_INV Convert from UTM/UPS system % % [lat, lon] = UTMUPS_INV(x, y, zone, isnorth) % [lat, lon, gam, k] = UTMUPS_INV(x, y, zone, isnorth) % % convert to the UTM/UPS system to geographical coordinates, (lat,lon). % The input is (x,y) = (easting,northing), the zone which is either the % UTM zone or 0 for UPS , and a hemisphere selector, isnorth (0 for the % southern hemisphere, 1 for the northern). x, y, zone, and isnorth can % be scalars or arrays of equal size. The forward operation is performed % by utmups_fwd. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat, lon, gam are in degrees. The projected coordinates x, y are in % meters. k is dimensionless. % % The argument zone has the following meanings % 0, use UPS % [1,60], use the corresponding UTM zone % -4, an undefined zone % % The allowed values of (x,y) are % UTM: x in [0 km, 1000 km] % y in [0 km, 9600 km] for northern hemisphere % y in [900 km, 10000 km] for southern hemisphere % UPS: x and y in [1200 km, 2800 km] for northern hemisphere % x and y in [700 km, 3300 km] for southern hemisphere % % UTMUPS_INV checks that (x,y) lie in the limits given above. If these % conditions don't hold (lat,lon), gam, k are converted to NaN. % % See also UTMUPS_FWD, TRANMERC_INV, POLARST_INV, MGRS_INV. % Copyright (c) Charles Karney (2015) . narginchk(4, 4) try Z = zeros(size(x + y + zone + isnorth)); catch error('x, y, zone, isnorth have incompatible sizes') end x = x + Z; y = y + Z; zone = floor(zone) + Z; isnorth = logical(isnorth + Z); Z = nan(size(Z)); lat = Z; lon = Z; gam = Z; k = Z; utm = zone > 0 & zone <= 60; [lat(utm), lon(utm), gam(utm), k(utm)] = ... utm_inv(zone(utm), isnorth(utm), x(utm), y(utm)); ups = zone == 0; [lat(ups), lon(ups), gam(ups), k(ups)] = ... ups_inv(isnorth(ups), x(ups), y(ups)); end function [lat, lon, gam, k] = utm_inv(zone, isnorth, x, y) %UTM_INV Inverse UTM projection lon0 = -183 + 6 * floor(zone); lat0 = 0; fe = 5e5; fn = 100e5 * (1-isnorth); k0 = 0.9996; x = x - fe; y = y - fn; bad = ~(abs(x) <= 5e5 & y >= -91e5 & y <= 96e5); x = x / k0; y = y / k0; [lat, lon, gam, k] = tranmerc_inv(lat0, lon0, x, y); k = k * k0; lat(bad) = nan; lon(bad) = nan; gam(bad) = nan; k(bad) = nan; end function [lat, lon, gam, k] = ups_inv(isnorth, x, y) %UPS_INV Inverse UPS projection fe = 20e5; fn = 20e5; k0 = 0.994; x = x - fe; y = y - fn; lim = (13 - 5 * isnorth) * 1e5; bad = ~(abs(x) <= lim & abs(y) <= lim); x = x / k0; y = y / k0; [lat, lon, gam, k] = polarst_inv(isnorth, x, y); k = k * k0; lat(bad) = nan; lon(bad) = nan; gam(bad) = nan; k(bad) = nan; end GeographicLib-1.45/matlab/geographiclib/loccart_fwd.m0000644000771000077100000000404612602735126022534 0ustar ckarneyckarneyfunction [x, y, z, M] = loccart_fwd(lat0, lon0, h0, lat, lon, h, ellipsoid) %LOCCART_FWD Convert geographic to local cartesian coordinates % % [x, y, z] = LOCCART_FWD(lat0, lon0, h0, lat, lon) % [x, y, z] = LOCCART_FWD(lat0, lon0, h0, lat, lon, h) % [x, y, z, M] = LOCCART_FWD(lat0, lon0, h0, lat, lon, h, ellipsoid) % % converts from geodetic coordinates, lat, lon, h to local cartesian % coordinates, x, y, z, centered at lat0, lon0, h0. Latitudes and % longitudes are in degrees; h (default 0), h0, x, y, z are in meters. % lat, lon, h can be scalars or arrays of equal size. lat0, lon0, h0 % must be scalars. The ellipsoid vector is of the form [a, e], where a % is the equatorial radius in meters, e is the eccentricity. If % ellipsoid is omitted, the WGS84 ellipsoid (more precisely, the value % returned by defaultellipsoid) is used. The inverse operation is given % by loccart_inv. % % M is the 3 x 3 rotation matrix for the conversion. Pre-multiplying a % unit vector in local cartesian coordinates at (lat, lon, h) by M % transforms the vector to local cartesian coordinates at (lat0, lon0, % h0). % % See also LOCCART_INV, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2015) . narginchk(5, 7) if nargin < 6, h = 0; end if nargin < 7, ellipsoid = defaultellipsoid; end try S = size(lat + lon + h); catch error('lat, lon, h have incompatible sizes') end if ~(isscalar(lat0) && isscalar(lon0) && isscalar(h0)) error('lat0, lon0, h0 must be scalar') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end num = prod(S); Z = zeros(num, 1); lat = lat(:) + Z; lon = lon(:) + Z; h = h(:) + Z; [X0, Y0, Z0, M0] = geocent_fwd(lat0, lon0, h0, ellipsoid); [X , Y , Z , M ] = geocent_fwd(lat , lon , h , ellipsoid); r = [X-X0, Y-Y0, Z-Z0] * M0; x = reshape(r(:, 1), S); y = reshape(r(:, 2), S); z = reshape(r(:, 3), S); if nargout > 3 for i = 1:num M(:,:, i) = M0' * M(:,:, i); end M = reshape(M, [3, 3, S]); end end GeographicLib-1.45/matlab/geographiclib/mgrs_fwd.m0000644000771000077100000001411712602735126022055 0ustar ckarneyckarneyfunction mgrs = mgrs_fwd(x, y, zone, isnorth, prec) %MGRS_FWD Convert UTM/UPS coordinates to MGRS % % mgrs = MGRS_FWD(x, y, zone, isnorth) % mgrs = MGRS_FWD(x, y, zone, isnorth, prec) % % converts from the UTM/UPS system to MGRS. (x,y) are the easting and % northing (in meters); zone is the UTM zone, in [1,60], or 0 for UPS; % isnorth is 1 (0) for the northern (southern) hemisphere. prec in % [-1,11] gives the precision of the grid reference; the default is 5 % giving 1 m precision. For example, prec = 2 corresponding to 1 km % precision, returns a string such as 38SMB4488. A value of -1 means % that only the grid zone, e.g., 38S, is returned. The maximum allowed % value of prec is 11 (denoting 1 um precision). prec < -1 is treated a % NaN, while prec > 11 is treated the same as prec = 11. The MGRS % references are returned in a cell array of strings. x, y, zone, % isnorth, prec can be scalars or arrays of the same size. Values that % can't be converted to MGRS return the "invalid" string, INV. The % inverse operation is performed by mgrs_inv. % % The allowed values of (x,y) are % UTM: x in [100 km, 900 km] % y in [0 km, 9500 km] for northern hemisphere % y in [1000 km, 10000 km] for southern hemisphere % UPS: x and y in [1300 km, 2700 km] for northern hemisphere % x and y in [800 km, 3200 km] for southern hemisphere % % The ranges are 100 km more restrictive than for utmups_fwd and % utmups_inv. % % See also MGRS_INV, UTMUPS_FWD. % Copyright (c) Charles Karney (2015) . narginchk(4, 5) if nargin < 5, prec = 5; end zone = floor(zone); prec = min(11, max(-2, floor(prec))); % this converts NaNs to -2. try s = size(x + y + zone + isnorth + prec); catch error('x, y, zone, isnorth, prec have incompatible sizes') end num = prod(s); if num == 0, mgrs = cell(0); return, end Z = zeros(num, 1); x = x(:) + Z; y = y(:) + Z; zone = zone(:) + Z; isnorth = isnorth(:) + Z; prec = prec(:) + Z; mgrs = repmat('INV', num, 1); if ~any(prec >= -1), mgrs = reshape(cellstr(mgrs), s); return, end maxprec = max(prec); mgrs = [mgrs, repmat(' ', num, 2 + 2*maxprec)]; minprec = min(prec(prec >= -1)); for p = minprec:maxprec in = prec == p; if ~any(in) continue end t = mgrs_fwd_p(x(in), y(in), zone(in), isnorth(in), p); mgrs(in,1:(5 + 2*p)) = t; end mgrs = reshape(cellstr(mgrs), s); end function mgrs = mgrs_fwd_p(x, y, zone, northp, prec) num = size(x, 1); delta = 10e-9; mgrs = repmat('INV', num, 1); mgrs = [mgrs, repmat(' ', num, 2 + 2*prec)]; utm = zone >= 1 & zone <= 60; y(utm & ~northp) = y(utm & ~northp) - 100e5; northp(utm) = 1; utm = utm & x >= 1e5 & x <= 9e5 & y >= -90e5 & y <= 95e5; x(utm & x == 9e5) = 9e5 - delta; y(utm & y == 95e5) = 95e5 - delta; upsn = zone == 0 & northp; upss = zone == 0 & ~northp; upsn = upsn & x >= 13e5 & x <= 27e5 & y >= 13e5 & y <= 27e5; x(upsn & x == 27e5) = 27e5 - delta; y(upsn & y == 27e5) = 27e5 - delta; upss = upss & x >= 8e5 & x <= 32e5 & y >= 8e5 & y <= 32e5; x(upss & x == 32e5) = 32e5 - delta; y(upss & y == 32e5) = 32e5 - delta; t = mgrs_fwd_utm(x(utm), y(utm), zone(utm), prec); mgrs(utm,:) = t; t = mgrs_fwd_upsn(x(upsn), y(upsn), prec); mgrs(upsn,1:end-2) = t; t = mgrs_fwd_upss(x(upss), y(upss), prec); mgrs(upss,1:end-2) = t; end function mgrs = mgrs_fwd_utm(x, y, zone, prec) persistent latband utmcols utmrow if isempty(utmrow) latband = 'CDEFGHJKLMNPQRSTUVWX'; utmcols = ['ABCDEFGH', 'JKLMNPQR', 'STUVWXYZ']; utmrow = 'ABCDEFGHJKLMNPQRSTUV'; end mgrs = char(zeros(length(x), 5 + 2 * prec) + ' '); if isempty(x), return, end mgrs(:,1) = '0' + floor(zone / 10); mgrs(:,2) = '0' + mod(zone, 10); ys = y / 1e5; latp = 0.901 * ys + ((ys > 0) * 2 - 1) * 0.135; late = 0.902 * ys .* (1 - 1.85e-6 * ys .* ys); latp(abs(ys) < 1) = 0.9 * ys(abs(ys) < 1); late(abs(ys) < 1) = latp(abs(ys) < 1); band = LatitudeBand(latp); bande = LatitudeBand(late); c = band ~= bande; band(c) = LatitudeBand(utmups_inv(x(c), y(c), zone(c), 1)); mgrs(:,3) = latband(band + 11); if prec < 0, return, end x = floor(x * 1e6); y = floor(y * 1e6); xh = floor(x / 1e11); yh = floor(y / 1e11); mgrs(:,4) = utmcols(mod(zone - 1, 3) * 8 + xh); mgrs(:,5) = utmrow(mod(yh + mod(zone - 1, 2) * 5, 20) + 1); if prec == 0, return, end xy = formatnum(x, xh, y, yh, prec); mgrs(:,5+(1:2*prec)) = xy; end function mgrs = mgrs_fwd_upsn(x, y, prec) persistent upsband upscols upsrow if isempty(upsrow) upsband = 'YZ'; upscols = ['RSTUXYZ', 'ABCFGHJ']; upsrow = 'ABCDEFGHJKLMNP'; end mgrs = char(zeros(length(x), 3 + 2 * prec) + ' '); if isempty(x), return, end x = floor(x * 1e6); y = floor(y * 1e6); xh = floor(x / 1e11); yh = floor(y / 1e11); eastp = xh >= 20; mgrs(:,1) = upsband(eastp + 1); if prec < 0, return, end mgrs(:,2) = upscols(eastp * 7 + xh - cvmgt(20, 13, eastp) + 1); mgrs(:,3) = upsrow(yh - 13 + 1); if prec == 0, return, end xy = formatnum(x, xh, y, yh, prec); mgrs(:,3+(1:2*prec)) = xy; end function mgrs = mgrs_fwd_upss(x, y, prec) persistent upsband upscols upsrow if isempty(upsrow) upsband = 'AB'; upscols = ['JKLPQRSTUXYZ', 'ABCFGHJKLPQR']; upsrow = 'ABCDEFGHJKLMNPQRSTUVWXYZ'; end mgrs = char(zeros(length(x), 3 + 2 * prec) + ' '); if isempty(x), return, end x = floor(x * 1e6); y = floor(y * 1e6); xh = floor(x / 1e11); yh = floor(y / 1e11); eastp = xh >= 20; mgrs(:,1) = upsband(eastp + 1); if prec < 0, return, end mgrs(:,2) = upscols(eastp * 12 + xh - cvmgt(20, 8, eastp) + 1); mgrs(:,3) = upsrow(yh - 8 + 1); if prec == 0, return, end xy = formatnum(x, xh, y, yh, prec); mgrs(:,3+(1:2*prec)) = xy; end function xy = formatnum(x, xh, y, yh, prec) x = x - xh * 1e11; y = y - yh * 1e11; d = 10 ^ (11 - prec); x = floor(x / d); y = floor(y / d); xy = [num2str(x, ['%0', int2str(prec), '.0f']), ... num2str(y, ['%0', int2str(prec), '.0f'])]; end function band = LatitudeBand(lat) band = max(-10, min(9, floor(lat / 8))); band(~(abs(lat) <= 90)) = nan; end GeographicLib-1.45/matlab/geographiclib/tranmerc_fwd.m0000644000771000077100000001275112602735126022722 0ustar ckarneyckarneyfunction [x, y, gam, k] = tranmerc_fwd(lat0, lon0, lat, lon, ellipsoid) %TRANMERC_FWD Forward transverse Mercator projection % % [x, y] = TRANMERC_FWD(lat0, lon0, lat, lon) % [x, y, gam, k] = TRANMERC_FWD(lat0, lon0, lat, lon, ellipsoid) % % performs the forward transverse Mercator projection of points (lat,lon) % to (x,y) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. The common % case of lat0 = 0 is treated efficiently provided that lat0 is specified % as a scalar. projdoc defines the projection and gives the restrictions % on the allowed ranges of the arguments. The inverse projection is % given by tranmerc_inv. The scale on the central meridian is 1. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat0, lon0, lat, lon, gam are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). k is dimensionless. % % This implementation of the projection is based on the series method % described in % % C. F. F. Karney, Transverse Mercator with an accuracy of a few % nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); % Addenda: http://geographiclib.sf.net/tm-addenda.html % % This extends the series given by Krueger (1912) to sixth order in the % flattening. This is a substantially better series than that used by % the MATLAB mapping toolbox. In particular the errors in the projection % are less than 5 nanometers withing 3900 km of the central meridian (and % less than 1 mm within 7600 km of the central meridian). The mapping % can be continued accurately over the poles to the opposite meridian. % % See also PROJDOC, TRANMERC_INV, UTMUPS_FWD, UTMUPS_INV, % DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat0 + lon0 + lat + lon); catch error('lat0, lon0, lat, lon have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end Z = zeros(prod(S),1); maxpow = 6; a = ellipsoid(1); f = ecc2flat(ellipsoid(2)); e2 = f * (2 - f); e2m = 1 - e2; cc = sqrt(e2m) * exp(eatanhe(1, e2)); n = f / (2 -f); alp = alpf(n); b1 = (1 - f) * (A1m1f(n) + 1); a1 = b1 * a; lat = LatFix(lat(:)) + Z; lon = AngDiff(lon0(:), lon(:)) + Z; latsign = 1 - 2 * (lat < 0); lonsign = 1 - 2 * (lon < 0); lon = lon .* lonsign; lat = lat .* latsign; backside = lon > 90; latsign(backside & lat == 0) = -1; lon(backside) = 180 - lon(backside); [sphi, cphi] = sincosdx(lat); [slam, clam] = sincosdx(lon); tau = sphi ./ max(sqrt(realmin), cphi); taup = taupf(tau, e2); xip = atan2(taup, clam); etap = asinh(slam ./ hypot(taup, clam)); gam = atan2dx(slam .* taup, clam .* hypot(1, taup)); k = sqrt(e2m + e2 * cphi.^2) .* hypot(1, tau) ./ hypot(taup, clam); c = ~(lat ~= 90); if any(c) xip(c) = pi/2; etap(c) = 0; gam(c) = lon(c); k(c) = cc; end c0 = cos(2 * xip); ch0 = cosh(2 * etap); s0 = sin(2 * xip); sh0 = sinh(2 * etap); ar = 2 * c0 .* ch0; ai = -2 * s0 .* sh0; j = maxpow; xi0 = Z; yr0 = Z; if mod(j, 2) xi0 = xi0 + alp(j); yr0 = yr0 + 2 * maxpow * alp(j); j = j - 1; end xi1 = Z; eta0 = Z; eta1 = Z; yi0 = Z; yr1 = Z; yi1 = Z; for j = j : -2 : 1 xi1 = ar .* xi0 - ai .* eta0 - xi1 + alp(j); eta1 = ai .* xi0 + ar .* eta0 - eta1; yr1 = ar .* yr0 - ai .* yi0 - yr1 + 2 * j * alp(j); yi1 = ai .* yr0 + ar .* yi0 - yi1; xi0 = ar .* xi1 - ai .* eta1 - xi0 + alp(j-1); eta0 = ai .* xi1 + ar .* eta1 - eta0; yr0 = ar .* yr1 - ai .* yi1 - yr0 + 2 * (j-1) * alp(j-1); yi0 = ai .* yr1 + ar .* yi1 - yi0; end ar = ar/2; ai = ai/2; yr1 = 1 - yr1 + ar .* yr0 - ai .* yi0; yi1 = - yi1 + ai .* yr0 + ar .* yi0; ar = s0 .* ch0; ai = c0 .* sh0; xi = xip + ar .* xi0 - ai .* eta0; eta = etap + ai .* xi0 + ar .* eta0; gam = gam - atan2dx(yi1, yr1); k = k .* (b1 * hypot(yr1, yi1)); xi(backside) = pi - xi(backside); y = a1 * xi .* latsign; x = a1 * eta .* lonsign; gam(backside) = 180 - gam(backside); gam = AngNormalize(gam .* latsign .* lonsign); if isscalar(lat0) && lat0 == 0 y0 = 0; else [sbet0, cbet0] = sincosdx(LatFix(lat0(:))); [sbet0, cbet0] = norm2((1-f) * sbet0, cbet0); y0 = a1 * (atan2(sbet0, cbet0) + ... SinCosSeries(true, sbet0, cbet0, C1f(n))); end y = y - y0; x = reshape(x, S); y = reshape(y, S); gam = reshape(gam, S); k = reshape(k, S); end function alp = alpf(n) persistent alpcoeff if isempty(alpcoeff) alpcoeff = [ ... 31564, -66675, 34440, 47250, -100800, 75600, 151200, ... -1983433, 863232, 748608, -1161216, 524160, 1935360, ... 670412, 406647, -533952, 184464, 725760, ... 6601661, -7732800, 2230245, 7257600, ... -13675556, 3438171, 7983360, ... 212378941, 319334400, ... ]; end maxpow = 6; alp = zeros(1, maxpow); o = 1; d = n; for l = 1 : maxpow m = maxpow - l; alp(l) = d * polyval(alpcoeff(o : o + m), n) / alpcoeff(o + m + 1); o = o + m + 2; d = d * n; end end GeographicLib-1.45/matlab/geographiclib/ecc2flat.m0000644000771000077100000000035612602735126021730 0ustar ckarneyckarneyfunction f = ecc2flat(e) %ECC2FLAT Convert eccentricity to flattening % % f = ECC2FLAT(e) % % returns the flattening of an ellipsoid given the eccentricity. % % See also FLAT2ECC. e2 = e.^2; f = e2 ./ (1 + sqrt(1 - e2)); end GeographicLib-1.45/matlab/geographiclib/gedoc.m0000644000771000077100000001314212602735126021323 0ustar ckarneyckarneyfunction gedoc %GEDOC Great ellipses on an ellipsoid of revolution % % The two routines GEDISTANCE and GERECKON solve the inverse and direct % problems for great ellipses on the surface of an ellipsoid of % revolution. For more information, see % % http://geographiclib.sf.net/html/greatellipse.html % % Great ellipses are sometimes proposed as alternatives to computing % ellipsoidal geodesics. However geodesic calculations are easy to % perform using geoddistance and geodreckon, and these should normally be % used instead of gedistance and gereckon. For a discussion, see % % http://geographiclib.sf.net/html/greatellipse.html#gevsgeodesic % % The method involves stretching the ellipse along the axis until it % becomes a sphere, solving the corresponding great circle problem on the % sphere and mapping the results back to the ellipsoid. For details, % see % % http://geographiclib.sf.net/html/greatellipse.html#geformulation % % Consider two points on the ellipsoid at (lat1, lon1) and (lat2, lon2). % The plane containing these points and the center of the ellipsoid % intersects the ellipsoid on a great ellipse. The length of the shorter % portion of the great ellipse between the two points is s12 and the % great ellipse from point 1 to point 2 has forward azimuths azi1 and % azi2 at the two end points. % % Two great ellipse problems can be considered: % * the direct problem -- given lat1, lon1, s12, and azi1, determine % lat2, lon2, and azi2. This is solved by gereckon. % * the inverse problem -- given lat1, lon1, lat2, lon2, determine s12, % azi1, and azi2. This is solved by gedistance. % % The routines also optionally calculate S12 ,the area between the great % ellipse from point 1 to point 2 and the equator; i.e., it is the area, % measured counter-clockwise, of the quadrilateral with corners % (lat1,lon1), (0,lon1), (0,lon2), and (lat2,lon2). It is given in % meters^2. % % The parameters of the ellipsoid are specified by the optional ellipsoid % argument to the routines. This is a two-element vector of the form % [a,e], where a is the equatorial radius, e is the eccentricity e = % sqrt(a^2-b^2)/a, and b is the polar semi-axis. Typically, a and b are % measured in meters and the distances returned by the routines are then % in meters. However, other units can be employed. If ellipsoid is % omitted, then the WGS84 ellipsoid (more precisely, the value returned % by defaultellipsoid) is assumed [6378137, 0.0818191908426215] % corresponding to a = 6378137 meters and a flattening f = (a-b)/a = % 1/298.257223563. The flattening and eccentricity are related by % % e = sqrt(f * (2 - f)) % f = e^2 / (1 + sqrt(1 - e^2)) % % (The functions ecc2flat and flat2ecc implement these conversions.) For % a sphere, set e = 0; for a prolate ellipsoid (b > a), specify e as a % pure imaginary number. % % All angles (latitude, longitude, azimuth) are measured in degrees with % latitudes increasing northwards, longitudes increasing eastwards, and % azimuths measured clockwise from north. For a point at a pole, the % azimuth is defined by keeping the longitude fixed, writing lat = % +/-(90-eps), and taking the limit eps -> 0+. % % Restrictions on the inputs: % * All latitudes must lie in [-90, 90]. % * The distance s12 is unrestricted. This allows great ellipses to % wrap around the ellipsoid. % * The equatorial radius, a, must be positive. % * The eccentricity, e, should be satisfy abs(e) < 0.2 in order to % retain full accuracy (this corresponds to flattenings satisfying % abs(f) <= 1/50, approximately). This condition holds for most % applications in geodesy. % % Larger values of e can be used with a corresponding drop in accuracy. % The following table gives the approximate maximum error in gedistance % and gereckon (expressed as a distance) for an ellipsoid with the same % major radius as the WGS84 ellipsoid and different values of the % flattening (nm means nanometer and um means micrometer). % % |f| error % 0.01 25 nm % 0.02 30 nm % 0.05 10 um % 0.1 1.5 mm % 0.2 300 mm % % In order to compute intermediate points on a great ellipse, proceed as % in the following example which plots the track from Sydney to % Valparaiso and computes the deviation from the corresponding geodesic. % % % 1 = Sydney, 2 = Valparaiso % lat1 = -33.83; lon1 = 151.29; % lat2 = -33.02; lon2 = -71.64; % [s12g, azi1g] = geoddistance(lat1, lon1, lat2, lon2); % [s12e, azi1e] = gedistance(lat1, lon1, lat2, lon2); % fprintf('Difference in lengths = %.1f m\n', s12e - s12g); % [latg, long] = geodreckon(lat1, lon1, s12g * [0:100]/100, azi1g); % [late, lone] = gereckon(lat1, lon1, s12e * [0:100]/100, azi1e); % plot(long+360*(long<0), latg, lone+360*(lone<0), late); % legend('geodesic', 'great ellipse', 'Location', 'SouthEast'); % title('Sydney to Valparaiso'); % xlabel('longitude'); ylabel('latitude'); % fprintf('Maximum separation = %.1f km\n', ... % max(geoddistance(latg, long, late, lone))/1000); % % The restriction on e above arises because the meridian distance is % given as a series expansion in the third flattening. The exact % distance (valid for any e) can be expressed in terms of the elliptic % integral of the second kind. % % See also GEDISTANCE, GERECKON, DEFAULTELLIPSOID, ECC2FLAT, FLAT2ECC, % GEODDISTANCE, GEODRECKON. % Copyright (c) Charles Karney (2014-2015) . help gedoc end GeographicLib-1.45/matlab/geographiclib/gereckon.m0000644000771000077100000001221512602735126022037 0ustar ckarneyckarneyfunction [lat2, lon2, azi2, S12] = gereckon(lat1, lon1, s12, azi1, ellipsoid) %GERECKON Point along great ellipse at given azimuth and range % % [lat2, lon2, azi2] = GERECKON(lat1, lon1, s12, azi1) % [lat2, lon2, azi2, S12] = GERECKON(lat1, lon1, s12, azi1, ellipsoid) % % solves the direct great ellipse problem of finding the final point and % azimuth given lat1, lon1, s12, and azi1. The input arguments lat1, % lon1, s12, azi1, can be scalars or arrays of equal size. lat1, lon1, % azi1 are given in degrees and s12 in meters. The ellipsoid vector is % of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. lat2, % lon2, and azi2 give the position and forward azimuths at the end point % in degrees. The optional output S12 is the area between the great % ellipse and the equator (in meters^2). gedoc gives an example and % provides additional background information. gedoc also gives the % restrictions on the allowed ranges of the arguments. % % When given a combination of scalar and array inputs, GERECKON behaves % as though the inputs were expanded to match the size of the arrays. % However, in the particular case where lat1 and azi1 are the same for % all the input points, they should be specified as scalars since this % will considerably speed up the calculations. (In particular a series % of points along a single geodesic is efficiently computed by specifying % an array for s12 only.) % % geodreckon solves the equivalent geodesic problem and usually this is % preferable to using GERECKON. % % See also GEDOC, GEDISTANCE, DEFAULTELLIPSOID, GEODDISTANCE, GEODRECKON. % Copyright (c) Charles Karney (2014-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat1 + lon1 + s12 + azi1); catch error('lat1, lon1, s12, azi1 have incompatible sizes') end if length(ellipsoid) ~= 2 error('ellipsoid must be a vector of size 2') end tiny = sqrt(realmin); Z = zeros(prod(S),1); a = ellipsoid(1); e2 = ellipsoid(2)^2; f = e2 / (1 + sqrt(1 - e2)); f1 = 1 - f; areap = nargout >= 4; lat1 = AngRound(LatFix(lat1(:))); lon1 = lon1(:); azi1 = AngRound(azi1(:)); s12 = s12(:); [sgam1, cgam1] = sincosdx(azi1); [sbet1, cbet1] = sincosdx(lat1); sbet1 = f1 * sbet1; cbet1 = max(tiny, cbet1); [sbet1, cbet1] = norm2(sbet1, cbet1); [sgam1, cgam1] = norm2(sgam1 .* sqrt(1 - e2 * cbet1.^2), cgam1); sgam0 = sgam1 .* cbet1; cgam0 = hypot(cgam1, sgam1 .* sbet1); ssig1 = sbet1; slam1 = sgam0 .* sbet1; csig1 = cbet1 .* cgam1; csig1(sbet1 == 0 & cgam1 == 0) = 1; clam1 = csig1; [ssig1, csig1] = norm2(ssig1, csig1); k2 = e2 * cgam0.^2; epsi = k2 ./ (2 * (1 + sqrt(1 - k2)) - k2); A1 = a * (1 + A1m1f(epsi)) .* (1 - epsi)./(1 + epsi); C1a = C1f(epsi); B11 = SinCosSeries(true, ssig1, csig1, C1a); s = sin(B11); c = cos(B11); stau1 = ssig1 .* c + csig1 .* s; ctau1 = csig1 .* c - ssig1 .* s; C1pa = C1pf(epsi); tau12 = s12 ./ A1; s = sin(tau12); c = cos(tau12); B12 = - SinCosSeries(true, stau1 .* c + ctau1 .* s, ... ctau1 .* c - stau1 .* s, C1pa); sig12 = tau12 - (B12 - B11); ssig12 = sin(sig12); csig12 = cos(sig12); if abs(f) > 0.01 ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; B12 = SinCosSeries(true, ssig2, csig2, C1a); serr = A1 .* (sig12 + (B12 - B11)) - s12; sig12 = sig12 - serr ./ (a * sqrt(1 - k2 + k2 .* ssig2.^2)); ssig12 = sin(sig12); csig12 = cos(sig12); end ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; sbet2 = cgam0 .* ssig2; cbet2 = hypot(sgam0, cgam0 .* csig2); cbet2(cbet2 == 0) = tiny; slam2 = sgam0 .* ssig2; clam2 = csig2; sgam2 = sgam0; cgam2 = cgam0 .* csig2; lon12 = atan2dx(slam2 .* clam1 - clam2 .* slam1, ... clam2 .* clam1 + slam2 .* slam1); lon2 = AngNormalize(AngNormalize(lon1) + lon12); lat2 = atan2dx(sbet2, f1 * cbet2); azi2 = atan2dx(sgam2, cgam2 .* sqrt(1 - e2 * cbet2.^2)); lat2 = reshape(lat2 + Z, S); lon2 = reshape(lon2, S); azi2 = reshape(azi2 + Z, S); if areap n = f / (2 - f); G4x = G4coeff(n); G4a = C4f(epsi, G4x); A4 = (a^2 * e2) * cgam0 .* sgam0; B41 = SinCosSeries(false, ssig1, csig1, G4a); B42 = SinCosSeries(false, ssig2, csig2, G4a); sgam12 = cgam0 .* sgam0 .* ... cvmgt(csig1 .* (1 - csig12) + ssig12 .* ssig1, ... ssig12 .* (csig1 .* ssig12 ./ (1 + csig12) + ssig1), ... csig12 <= 0); cgam12 = sgam0.^2 + cgam0.^2 .* csig1 .* csig2; s = cgam0 == 0 | sgam0 == 0; sgam12(s) = sgam2(s) .* cgam1(s) - cgam2(s) .* sgam1(s); cgam12(s) = cgam2(s) .* cgam1(s) + sgam2(s) .* sgam1(s); s = s & sgam12 == 0 & cgam12 < 0; sgam12(s) = tiny * cgam1(s); cgam12(s) = -1; if e2 ~= 0 c2 = a^2 * (1 + (1 - e2) * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end S12 = c2 * atan2(sgam12, cgam12) + A4 .* (B42 - B41); S12 = reshape(S12 + Z, S); end end GeographicLib-1.45/matlab/geographiclib/tranmerc_inv.m0000644000771000077100000001266212602735126022737 0ustar ckarneyckarneyfunction [lat, lon, gam, k] = tranmerc_inv(lat0, lon0, x, y, ellipsoid) %TRANMERC_INV Inverse transverse Mercator projection % % [lat, lon] = TRANMERC_INV(lat0, lon0, x, y) % [lat, lon, gam, k] = TRANMERC_INV(lat0, lon0, x, y, ellipsoid) % % performs the inverse transverse Mercator projection of points (x,y) to % (lat,lon) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. The common % case of lat0 = 0 is treated efficiently provided that lat0 is specified % as a scalar. projdoc defines the projection and gives the restrictions % on the allowed ranges of the arguments. The forward projection is % given by tranmerc_fwd. The scale on the central meridian is 1. % % gam and K give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat0, lon0, lat, lon, gam are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). k is dimensionless. % % This implementation of the projection is based on the series method % described in % % C. F. F. Karney, Transverse Mercator with an accuracy of a few % nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); % Addenda: http://geographiclib.sf.net/tm-addenda.html % % This extends the series given by Krueger (1912) to sixth order in the % flattening. This is a substantially better series than that used by % the MATLAB mapping toolbox. In particular the errors in the projection % are less than 5 nanometers withing 3900 km of the central meridian (and % less than 1 mm within 7600 km of the central meridian). The mapping % can be continued accurately over the poles to the opposite meridian. % % See also PROJDOC, TRANMERC_FWD, UTMUPS_FWD, UTMUPS_INV, % DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat0 + lon0 + x + y); catch error('lat0, lon0, x, y have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end Z = zeros(prod(S),1); maxpow = 6; a = ellipsoid(1); f = ecc2flat(ellipsoid(2)); e2 = f * (2 - f); e2m = 1 - e2; cc = sqrt(e2m) * exp(eatanhe(1, e2)); n = f / (2 -f); bet = betf(n); b1 = (1 - f) * (A1m1f(n) + 1); a1 = b1 * a; if isscalar(lat0) && lat0 == 0 y0 = 0; else [sbet0, cbet0] = sincosdx(LatFix(lat0(:))); [sbet0, cbet0] = norm2((1-f) * sbet0, cbet0); y0 = a1 * (atan2(sbet0, cbet0) + ... SinCosSeries(true, sbet0, cbet0, C1f(n))); end y = y(:) + y0 + Z; xi = y / a1; eta = x(:) / a1 + Z; xisign = 1 - 2 * (xi < 0 ); etasign = 1 - 2 * (eta < 0 ); xi = xi .* xisign; eta = eta .* etasign; backside = xi > pi/2; xi(backside) = pi - xi(backside); c0 = cos(2 * xi); ch0 = cosh(2 * eta); s0 = sin(2 * xi); sh0 = sinh(2 * eta); ar = 2 * c0 .* ch0; ai = -2 * s0 .* sh0; j = maxpow; xip0 = Z; yr0 = Z; if mod(j, 2) xip0 = xip0 + bet(j); yr0 = yr0 - 2 * maxpow * bet(j); j = j - 1; end xip1 = Z; etap0 = Z; etap1 = Z; yi0 = Z; yr1 = Z; yi1 = Z; for j = j : -2 : 1 xip1 = ar .* xip0 - ai .* etap0 - xip1 - bet(j); etap1 = ai .* xip0 + ar .* etap0 - etap1; yr1 = ar .* yr0 - ai .* yi0 - yr1 - 2 * j * bet(j); yi1 = ai .* yr0 + ar .* yi0 - yi1; xip0 = ar .* xip1 - ai .* etap1 - xip0 - bet(j-1); etap0 = ai .* xip1 + ar .* etap1 - etap0; yr0 = ar .* yr1 - ai .* yi1 - yr0 - 2 * (j-1) * bet(j-1); yi0 = ai .* yr1 + ar .* yi1 - yi0; end ar = ar/2; ai = ai/2; yr1 = 1 - yr1 + ar .* yr0 - ai .* yi0; yi1 = - yi1 + ai .* yr0 + ar .* yi0; ar = s0 .* ch0; ai = c0 .* sh0; xip = xi + ar .* xip0 - ai .* etap0; etap = eta + ai .* xip0 + ar .* etap0; gam = atan2dx(yi1, yr1); k = b1 ./ hypot(yr1, yi1); s = sinh(etap); c = max(0, cos(xip)); r = hypot(s, c); lon = atan2dx(s, c); sxip = sin(xip); tau = tauf(sxip./r, e2); lat = atan2dx(tau, 1 + Z); gam = gam + atan2dx(sxip .* tanh(etap), c); c = r ~= 0; k(c) = k(c) .* sqrt(e2m + e2 ./ (1 + tau.^2)) .* ... hypot(1, tau(c)) .* r(c); c = ~c; if any(c) lat(c) = 90; lon(c) = 0; k(c) = k(c) * cc; end lat = lat .* xisign; lon(backside) = 180 - lon(backside); lon = lon .* etasign; lon = AngNormalize(lon + AngNormalize(lon0(:))); gam(backside) = 180 - gam(backside); gam = AngNormalize(gam .* xisign .* etasign); lat = reshape(lat, S); lon = reshape(lon, S); gam = reshape(gam, S); k = reshape(k, S); end function bet = betf(n) persistent betcoeff if isempty(betcoeff) betcoeff = [ 384796, -382725, -6720, 932400, -1612800, 1209600, 2419200, ... -1118711, 1695744, -1174656, 258048, 80640, 3870720, ... 22276, -16929, -15984, 12852, 362880, ... -830251, -158400, 197865, 7257600, ... -435388, 453717, 15966720, ... 20648693, 638668800, ... ]; end maxpow = 6; bet = zeros(1, maxpow); o = 1; d = n; for l = 1 : maxpow m = maxpow - l; bet(l) = d * polyval(betcoeff(o : o + m), n) / betcoeff(o + m + 1); o = o + m + 2; d = d * n; end end GeographicLib-1.45/matlab/geographiclib/geocent_inv.m0000644000771000077100000001240512602735126022543 0ustar ckarneyckarneyfunction [lat, lon, h, M] = geocent_inv(X, Y, Z, ellipsoid) %GEOCENT_INV Conversion from geocentric to geographic coordinates % % [lat, lon, h] = GEOCENT_INV(X, Y, Z) % [lat, lon, h, M] = GEOCENT_INV(X, Y, Z, ellipsoid) % % converts from geocentric coordinates X, Y, Z to geographic coordinates, % lat, lon, h. X, Y, Z can be scalars or arrays of equal size. X, Y, Z, % and h are in meters. lat and lon are in degrees. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. The % forward operation is given by geocent_fwd. % % M is the 3 x 3 rotation matrix for the conversion. Pre-multiplying a % unit vector in geocentric coordinates by the transpose of M transforms % the vector to local cartesian coordinates (east, north, up). % % See also GEOCENT_FWD, DEFAULTELLIPSOID. % Copyright (c) Charles Karney (2015) . narginchk(3, 4) if nargin < 4, ellipsoid = defaultellipsoid; end try z = zeros(size(X + Y + Z)); catch error('X, Y, Z have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end X = X + z; Y = Y + z; Z = Z + z; a = ellipsoid(1); e2 = ellipsoid(2)^2; e2m = 1 - e2; e2a = abs(e2); e4a = e2^2; maxrad = 2 * a / eps; R = hypot(X, Y); slam = Y ./ R; slam(R == 0) = 0; clam = X ./ R; clam(R == 0) = 1; h = hypot(R, Z); if e4a == 0 % Treat the spherical case. Dealing with underflow in the general case % with e2 = 0 is difficult. Origin maps to N pole same as with % ellipsoid. Z1 = Z; Z1(h == 0) = 1; [sphi, cphi] = norm2(Z1, R); h = h - a; else % Treat prolate spheroids by swapping R and Z here and by switching % the arguments to phi = atan2(...) at the end. p = (R / a).^2; q = e2m * (Z / a).^2; r = (p + q - e4a) / 6; if e2 < 0 [p, q] = swap(p, q); end % Avoid possible division by zero when r = 0 by multiplying % equations for s and t by r^3 and r, resp. S = e4a * p .* q / 4; % S = r^3 * s r2 = r.^2; r3 = r .* r2; disc = S .* (2 * r3 + S); u = r; fl2 = disc >= 0; T3 = S(fl2) + r3(fl2); % 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 = (r * t)^3 T3 = T3 + (1 - 2 * (T3 < 0)) .* sqrt(disc(fl2)); % N.B. cbrtx always returns the real root. cbrtx(-8) = -2. T = cbrtx(T3); u(fl2) = u(fl2) + T + cvmgt(r2(fl2) ./ T, 0, T ~= 0); % T is complex, but the way u is defined the result is real. ang = atan2(sqrt(-disc(~fl2)), -(S(~fl2) + r3(~fl2))); % There are three possible cube roots. We choose the root which % avoids cancellation (disc < 0 implies that r < 0). u(~fl2) = u(~fl2) + 2 * r(~fl2) .* cos(ang / 3); % guaranteed positive v = sqrt(u.^2 + e4a * q); % Avoid loss of accuracy when u < 0. Underflow doesn't occur in % e4 * q / (v - u) because u ~ e^4 when q is small and u < 0. % u+v, guaranteed positive uv = u + v; fl2 = u < 0; uv(fl2) = e4a * q(fl2) ./ (v(fl2) - u(fl2)); % Need to guard against w going negative due to roundoff in uv - q. w = max(0, e2a * (uv - q) ./ (2 * v)); k = uv ./ (sqrt(uv + w.^2) + w); if e2 >= 0 k1 = k; k2 = k + e2; else k1 = k - e2; k2 = k; end [sphi, cphi] = norm2(Z ./ k1, R ./ k2); h = (1 - e2m ./ k1) .* hypot(k1 .* R ./ k2, Z); % Deal with exceptional inputs c = e4a * q == 0 & r <= 0; if any(c) % This leads to k = 0 (oblate, equatorial plane) and k + e^2 = 0 % (prolate, rotation axis) and the generation of 0/0 in the general % formulas for phi and h. using the general formula and division by 0 % in formula for h. So handle this case by taking the limits: % f > 0: z -> 0, k -> e2 * sqrt(q)/sqrt(e4 - p) % f < 0: R -> 0, k + e2 -> - e2 * sqrt(q)/sqrt(e4 - p) zz = e4a - p(c); xx = p(c); if e2 < 0 [zz, xx] = swap(zz, xx); end zz = sqrt(zz / e2m); xx = sqrt(xx); H = hypot(zz, xx); sphi(c) = zz ./ H; cphi(c) = xx ./ H; sphi(c & Z < 0) = - sphi(c & Z < 0); h(c) = - a * H / e2a; if e2 >= 0 h(c) = e2m * h(c); end end end far = h > maxrad; if any(far) % We really far away (> 12 million light years); treat the earth as a % point and h, above, is an acceptable approximation to the height. % This avoids overflow, e.g., in the computation of disc below. It's % possible that h has overflowed to inf; but that's OK. % % Treat the case X, Y finite, but R overflows to +inf by scaling by 2. R(far) = hypot(X(far)/2, Y(far)/2); slam(far) = Y(far) ./ R(far); slam(far & R == 0) = 0; clam(far) = X(far) ./ R(far); clam(far & R == 0) = 1; H = hypot(Z(far)/2, R(far)); sphi(far) = Z(far)/2 ./ H; cphi(far) = R(far) ./ H; end lat = atan2dx(sphi, cphi); % Negative signs return lon in [-180, 180). 0- converts -0 to +0. lon = atan2dx(slam, clam); if nargout > 3 M = GeoRotation(sphi, cphi, slam, clam); end end GeographicLib-1.45/matlab/geographiclib/flat2ecc.m0000644000771000077100000000033312602735126021723 0ustar ckarneyckarneyfunction e = flat2ecc(f) %FLAT2ECC Convert flattening to eccentricity % % e = FLAT2ECC(f) % % returns the eccentricity of an ellipsoid given the flattening. % % See also ECC2FLAT. e = sqrt(f .* (2 - f)); end GeographicLib-1.45/matlab/Makefile.am0000644000771000077100000001122512602735126017321 0ustar ckarneyckarney# # Makefile.am # # Copyright (C) 2011, Charles Karney MATLAB_FILES = \ $(srcdir)/geographiclib/Contents.m \ $(srcdir)/geographiclib/geographiclib_test.m \ $(srcdir)/geographiclib/cassini_fwd.m \ $(srcdir)/geographiclib/cassini_inv.m \ $(srcdir)/geographiclib/defaultellipsoid.m \ $(srcdir)/geographiclib/ecc2flat.m \ $(srcdir)/geographiclib/eqdazim_fwd.m \ $(srcdir)/geographiclib/eqdazim_inv.m \ $(srcdir)/geographiclib/flat2ecc.m \ $(srcdir)/geographiclib/gedistance.m \ $(srcdir)/geographiclib/gedoc.m \ $(srcdir)/geographiclib/geocent_fwd.m \ $(srcdir)/geographiclib/geocent_inv.m \ $(srcdir)/geographiclib/geodarea.m \ $(srcdir)/geographiclib/geoddistance.m \ $(srcdir)/geographiclib/geoddoc.m \ $(srcdir)/geographiclib/geodreckon.m \ $(srcdir)/geographiclib/geoid_height.m \ $(srcdir)/geographiclib/geoid_load.m \ $(srcdir)/geographiclib/gereckon.m \ $(srcdir)/geographiclib/gnomonic_fwd.m \ $(srcdir)/geographiclib/gnomonic_inv.m \ $(srcdir)/geographiclib/loccart_fwd.m \ $(srcdir)/geographiclib/loccart_inv.m \ $(srcdir)/geographiclib/mgrs_fwd.m \ $(srcdir)/geographiclib/mgrs_inv.m \ $(srcdir)/geographiclib/polarst_fwd.m \ $(srcdir)/geographiclib/polarst_inv.m \ $(srcdir)/geographiclib/projdoc.m \ $(srcdir)/geographiclib/tranmerc_fwd.m \ $(srcdir)/geographiclib/tranmerc_inv.m \ $(srcdir)/geographiclib/utmups_fwd.m \ $(srcdir)/geographiclib/utmups_inv.m MATLAB_PRIVATE = \ $(srcdir)/geographiclib/private/A1m1f.m \ $(srcdir)/geographiclib/private/A2m1f.m \ $(srcdir)/geographiclib/private/A3coeff.m \ $(srcdir)/geographiclib/private/A3f.m \ $(srcdir)/geographiclib/private/AngDiff.m \ $(srcdir)/geographiclib/private/AngNormalize.m \ $(srcdir)/geographiclib/private/AngRound.m \ $(srcdir)/geographiclib/private/C1f.m \ $(srcdir)/geographiclib/private/C1pf.m \ $(srcdir)/geographiclib/private/C2f.m \ $(srcdir)/geographiclib/private/C3coeff.m \ $(srcdir)/geographiclib/private/C3f.m \ $(srcdir)/geographiclib/private/C4coeff.m \ $(srcdir)/geographiclib/private/C4f.m \ $(srcdir)/geographiclib/private/G4coeff.m \ $(srcdir)/geographiclib/private/GeoRotation.m \ $(srcdir)/geographiclib/private/LatFix.m \ $(srcdir)/geographiclib/private/SinCosSeries.m \ $(srcdir)/geographiclib/private/atan2dx.m \ $(srcdir)/geographiclib/private/cbrtx.m \ $(srcdir)/geographiclib/private/cvmgt.m \ $(srcdir)/geographiclib/private/eatanhe.m \ $(srcdir)/geographiclib/private/geoid_file.m \ $(srcdir)/geographiclib/private/geoid_load_file.m \ $(srcdir)/geographiclib/private/norm2.m \ $(srcdir)/geographiclib/private/sincosdx.m \ $(srcdir)/geographiclib/private/sumx.m \ $(srcdir)/geographiclib/private/swap.m \ $(srcdir)/geographiclib/private/tauf.m \ $(srcdir)/geographiclib/private/taupf.m MATLAB_LEGACY = \ $(srcdir)/geographiclib-legacy/Contents.m \ $(srcdir)/geographiclib-legacy/geocentricforward.m \ $(srcdir)/geographiclib-legacy/geocentricreverse.m \ $(srcdir)/geographiclib-legacy/geodesicdirect.m \ $(srcdir)/geographiclib-legacy/geodesicinverse.m \ $(srcdir)/geographiclib-legacy/geodesicline.m \ $(srcdir)/geographiclib-legacy/geoidheight.m \ $(srcdir)/geographiclib-legacy/localcartesianforward.m \ $(srcdir)/geographiclib-legacy/localcartesianreverse.m \ $(srcdir)/geographiclib-legacy/mgrsforward.m \ $(srcdir)/geographiclib-legacy/mgrsreverse.m \ $(srcdir)/geographiclib-legacy/polygonarea.m \ $(srcdir)/geographiclib-legacy/utmupsforward.m \ $(srcdir)/geographiclib-legacy/utmupsreverse.m MATLAB_INTERFACE = \ $(srcdir)/geographiclib-legacy/geographiclibinterface.m \ $(srcdir)/geographiclib-legacy/geocentricforward.cpp \ $(srcdir)/geographiclib-legacy/geocentricreverse.cpp \ $(srcdir)/geographiclib-legacy/geodesicdirect.cpp \ $(srcdir)/geographiclib-legacy/geodesicinverse.cpp \ $(srcdir)/geographiclib-legacy/geodesicline.cpp \ $(srcdir)/geographiclib-legacy/geoidheight.cpp \ $(srcdir)/geographiclib-legacy/localcartesianforward.cpp \ $(srcdir)/geographiclib-legacy/localcartesianreverse.cpp \ $(srcdir)/geographiclib-legacy/mgrsforward.cpp \ $(srcdir)/geographiclib-legacy/mgrsreverse.cpp \ $(srcdir)/geographiclib-legacy/polygonarea.cpp \ $(srcdir)/geographiclib-legacy/utmupsforward.cpp \ $(srcdir)/geographiclib-legacy/utmupsreverse.cpp MATLAB_ALL = $(MATLAB_FILES) $(MATLAB_PRIVATE) MATLAB_LEGACY_ALL = $(MATLAB_LEGACY) $(MATLAB_INTERFACE) matlabdir=$(DESTDIR)$(datadir)/matlab install: $(INSTALL) -d $(matlabdir)/geographiclib/private $(INSTALL) -d $(matlabdir)/geographiclib-legacy $(INSTALL) -m 644 $(MATLAB_FILES) $(matlabdir)/geographiclib $(INSTALL) -m 644 $(MATLAB_PRIVATE) $(matlabdir)/geographiclib/private $(INSTALL) -m 644 $(MATLAB_LEGACY_ALL) $(matlabdir)/geographiclib-legacy clean-local: rm -rf *.mex* *.oct EXTRA_DIST = Makefile.mk CMakeLists.txt $(MATLAB_ALL) $(MATLAB_LEGACY_ALL) GeographicLib-1.45/matlab/Makefile.mk0000644000771000077100000000125012602735126017330 0ustar ckarneyckarneyMATLAB_FILES = $(wildcard geographiclib/*.m) MATLAB_PRIVATE = $(wildcard geographiclib/private/*.m) MATLAB_LEGACY = $(wildcard geographiclib-legacy/*.m) \ $(wildcard geographiclib-legacy/*.cpp) DEST = $(PREFIX)/share/matlab INSTALL = install -b all: @: install: test -d $(DEST)/geographiclib/private || \ mkdir -p $(DEST)/geographiclib/private test -d $(DEST)/geographiclib-legacy || \ mkdir -p $(DEST)/geographiclib-legacy $(INSTALL) -m 644 $(MATLAB_FILES) $(DEST)/geographiclib $(INSTALL) -m 644 $(MATLAB_PRIVATE) $(DEST)/geographiclib/private/ $(INSTALL) -m 644 $(MATLAB_LEGACY) $(DEST)/geographiclib-legacy clean: rm -f *.mex* *.oct .PHONY: all install clean GeographicLib-1.45/matlab/CMakeLists.txt0000644000771000077100000000134412602735126020026 0ustar ckarneyckarney# Install matlab files. if (COMMON_INSTALL_PATH) # More Octave friendly would be "share/octave/site/m" set (INSTALL_MATLAB_DIR "share/matlab") else () set (INSTALL_MATLAB_DIR "matlab") endif () file (GLOB MATLAB_FILES geographiclib/[A-Za-z]*.m) install (FILES ${MATLAB_FILES} DESTINATION ${INSTALL_MATLAB_DIR}/geographiclib) # Install "private" functions file (GLOB PRIVATE_MATLAB_FILES geographiclib/private/[A-Za-z]*.m) install (FILES ${PRIVATE_MATLAB_FILES} DESTINATION ${INSTALL_MATLAB_DIR}/geographiclib/private) # Install "legacy" functions file (GLOB LEGACY_FILES geographiclib-legacy/[A-Za-z]*.m geographiclib-legacy/[A-Za-z]*.cpp) install (FILES ${LEGACY_FILES} DESTINATION ${INSTALL_MATLAB_DIR}/geographiclib-legacy) GeographicLib-1.45/matlab/Makefile.in0000644000771000077100000004125312602735152017335 0ustar ckarneyckarney# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ # # Makefile.am # # Copyright (C) 2011, Charles Karney VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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@ target_triplet = @target@ subdir = matlab DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(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)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = 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 = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) 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@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ 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@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MATLAB_FILES = \ $(srcdir)/geographiclib/Contents.m \ $(srcdir)/geographiclib/geographiclib_test.m \ $(srcdir)/geographiclib/cassini_fwd.m \ $(srcdir)/geographiclib/cassini_inv.m \ $(srcdir)/geographiclib/defaultellipsoid.m \ $(srcdir)/geographiclib/ecc2flat.m \ $(srcdir)/geographiclib/eqdazim_fwd.m \ $(srcdir)/geographiclib/eqdazim_inv.m \ $(srcdir)/geographiclib/flat2ecc.m \ $(srcdir)/geographiclib/gedistance.m \ $(srcdir)/geographiclib/gedoc.m \ $(srcdir)/geographiclib/geocent_fwd.m \ $(srcdir)/geographiclib/geocent_inv.m \ $(srcdir)/geographiclib/geodarea.m \ $(srcdir)/geographiclib/geoddistance.m \ $(srcdir)/geographiclib/geoddoc.m \ $(srcdir)/geographiclib/geodreckon.m \ $(srcdir)/geographiclib/geoid_height.m \ $(srcdir)/geographiclib/geoid_load.m \ $(srcdir)/geographiclib/gereckon.m \ $(srcdir)/geographiclib/gnomonic_fwd.m \ $(srcdir)/geographiclib/gnomonic_inv.m \ $(srcdir)/geographiclib/loccart_fwd.m \ $(srcdir)/geographiclib/loccart_inv.m \ $(srcdir)/geographiclib/mgrs_fwd.m \ $(srcdir)/geographiclib/mgrs_inv.m \ $(srcdir)/geographiclib/polarst_fwd.m \ $(srcdir)/geographiclib/polarst_inv.m \ $(srcdir)/geographiclib/projdoc.m \ $(srcdir)/geographiclib/tranmerc_fwd.m \ $(srcdir)/geographiclib/tranmerc_inv.m \ $(srcdir)/geographiclib/utmups_fwd.m \ $(srcdir)/geographiclib/utmups_inv.m MATLAB_PRIVATE = \ $(srcdir)/geographiclib/private/A1m1f.m \ $(srcdir)/geographiclib/private/A2m1f.m \ $(srcdir)/geographiclib/private/A3coeff.m \ $(srcdir)/geographiclib/private/A3f.m \ $(srcdir)/geographiclib/private/AngDiff.m \ $(srcdir)/geographiclib/private/AngNormalize.m \ $(srcdir)/geographiclib/private/AngRound.m \ $(srcdir)/geographiclib/private/C1f.m \ $(srcdir)/geographiclib/private/C1pf.m \ $(srcdir)/geographiclib/private/C2f.m \ $(srcdir)/geographiclib/private/C3coeff.m \ $(srcdir)/geographiclib/private/C3f.m \ $(srcdir)/geographiclib/private/C4coeff.m \ $(srcdir)/geographiclib/private/C4f.m \ $(srcdir)/geographiclib/private/G4coeff.m \ $(srcdir)/geographiclib/private/GeoRotation.m \ $(srcdir)/geographiclib/private/LatFix.m \ $(srcdir)/geographiclib/private/SinCosSeries.m \ $(srcdir)/geographiclib/private/atan2dx.m \ $(srcdir)/geographiclib/private/cbrtx.m \ $(srcdir)/geographiclib/private/cvmgt.m \ $(srcdir)/geographiclib/private/eatanhe.m \ $(srcdir)/geographiclib/private/geoid_file.m \ $(srcdir)/geographiclib/private/geoid_load_file.m \ $(srcdir)/geographiclib/private/norm2.m \ $(srcdir)/geographiclib/private/sincosdx.m \ $(srcdir)/geographiclib/private/sumx.m \ $(srcdir)/geographiclib/private/swap.m \ $(srcdir)/geographiclib/private/tauf.m \ $(srcdir)/geographiclib/private/taupf.m MATLAB_LEGACY = \ $(srcdir)/geographiclib-legacy/Contents.m \ $(srcdir)/geographiclib-legacy/geocentricforward.m \ $(srcdir)/geographiclib-legacy/geocentricreverse.m \ $(srcdir)/geographiclib-legacy/geodesicdirect.m \ $(srcdir)/geographiclib-legacy/geodesicinverse.m \ $(srcdir)/geographiclib-legacy/geodesicline.m \ $(srcdir)/geographiclib-legacy/geoidheight.m \ $(srcdir)/geographiclib-legacy/localcartesianforward.m \ $(srcdir)/geographiclib-legacy/localcartesianreverse.m \ $(srcdir)/geographiclib-legacy/mgrsforward.m \ $(srcdir)/geographiclib-legacy/mgrsreverse.m \ $(srcdir)/geographiclib-legacy/polygonarea.m \ $(srcdir)/geographiclib-legacy/utmupsforward.m \ $(srcdir)/geographiclib-legacy/utmupsreverse.m MATLAB_INTERFACE = \ $(srcdir)/geographiclib-legacy/geographiclibinterface.m \ $(srcdir)/geographiclib-legacy/geocentricforward.cpp \ $(srcdir)/geographiclib-legacy/geocentricreverse.cpp \ $(srcdir)/geographiclib-legacy/geodesicdirect.cpp \ $(srcdir)/geographiclib-legacy/geodesicinverse.cpp \ $(srcdir)/geographiclib-legacy/geodesicline.cpp \ $(srcdir)/geographiclib-legacy/geoidheight.cpp \ $(srcdir)/geographiclib-legacy/localcartesianforward.cpp \ $(srcdir)/geographiclib-legacy/localcartesianreverse.cpp \ $(srcdir)/geographiclib-legacy/mgrsforward.cpp \ $(srcdir)/geographiclib-legacy/mgrsreverse.cpp \ $(srcdir)/geographiclib-legacy/polygonarea.cpp \ $(srcdir)/geographiclib-legacy/utmupsforward.cpp \ $(srcdir)/geographiclib-legacy/utmupsreverse.cpp MATLAB_ALL = $(MATLAB_FILES) $(MATLAB_PRIVATE) MATLAB_LEGACY_ALL = $(MATLAB_LEGACY) $(MATLAB_INTERFACE) matlabdir = $(DESTDIR)$(datadir)/matlab EXTRA_DIST = Makefile.mk CMakeLists.txt $(MATLAB_ALL) $(MATLAB_LEGACY_ALL) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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 matlab/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu matlab/Makefile .PRECIOUS: 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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(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 check: check-am all-am: Makefile installdirs: 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: 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-am clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ clean-local cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am 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-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am install: $(INSTALL) -d $(matlabdir)/geographiclib/private $(INSTALL) -d $(matlabdir)/geographiclib-legacy $(INSTALL) -m 644 $(MATLAB_FILES) $(matlabdir)/geographiclib $(INSTALL) -m 644 $(MATLAB_PRIVATE) $(matlabdir)/geographiclib/private $(INSTALL) -m 644 $(MATLAB_LEGACY_ALL) $(matlabdir)/geographiclib-legacy clean-local: rm -rf *.mex* *.oct # 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: GeographicLib-1.45/00README.txt0000644000771000077100000001341212602735126015663 0ustar ckarneyckarneyA library for geographic projections. Written by Charles Karney and licensed under the MIT/X11 License. For more information, see http://geographiclib.sourceforge.net/ Files 00README.txt -- this file AUTHORS -- the authors of the library LICENSE.txt -- the MIT/X11 License INSTALL -- brief installation instructions NEWS -- a history of changes include/GeographicLib/ and src/ Config.h.in, Config.h -- system dependent configuration Constants.hpp -- WGS84 constants Math.[ch]pp -- math routines Utility.[ch]pp -- I/O and date routines Accumulator.[ch]pp -- quad precision adder PolarStereographic.[ch]pp -- polar stereographic projection TransverseMercator.[ch]pp -- transverse Mercator projection UTMUPS.[ch]pp -- UTM and UPS MGRS.[ch]pp -- MGRS TransverseMercatorExact.[ch]pp -- exact TM projection EllipticFunction.[ch]pp -- elliptic functions GeoCoords.[ch]pp -- hold geographic location DMS.[ch]pp -- handle degrees minutes seconds Geocentric.[ch]pp -- geocentric coordinates LocalCartesian.[ch]pp -- local cartesian coordinates Geodesic.[ch]pp -- geodesic calculations GeodesicLine.[ch]pp -- calculations on a single geodesic PolygonArea.[ch]pp -- polygon area AzimuthalEquidistant.[ch]pp -- azimuthal equidistant projection Gnomonic.[ch]pp -- gnomonic projection CassiniSoldner.[ch]pp -- Cassini-Soldner equidistant projection Geoid.[ch]pp -- geoid heights above the ellipsoid Gravity{Model,Circle}.[ch]pp -- gravity models Magnetic{Model,Circle}.[ch]pp -- geomagentic models {Spherical,Circular}Engine.[ch]pp -- spherical harmonic sums SphericalHarmonic{,1,2}.hpp -- frontend for spherical harmonics LambertConformalConic.[ch]pp -- Lambert conformal conic projection AlbersEqualArea.[ch]pp -- Albers equal area projection Gnomonic.[ch]pp -- Ellipsoidal gnomonic projection OSGB.[ch]pp -- Ordnance Survey grid system Geohash.[ch]pp -- conversions for geohashes GARS.[ch]pp -- conversions for GARS Georef.[ch]pp -- conversions for georefs Ellipsoid.[ch]pp -- ellipsoid properties Rhumb.[ch]pp -- rhumb line calculations examples/ example-*.cpp -- simple usage examples for all the classes GeoidToGTX.cpp -- a parallelization example JacobiConformal.[ch]pp -- mapping a triaxial ellipsoid tools/ GeoConvert.cpp -- geographic conversion utility TransverseMercatorTest.cpp -- TM tester GeodSolve.cpp -- geodesic utility CartConvert.cpp -- convert to geocentric and local cartesian EquidistantTest.cpp -- exercise AzimuthalEquidistant and CassiniSoldner GeoidEval.cpp -- evaluate geoid heights Gravity.cpp -- evaluate gravity MagneticField.cpp -- evaluate magnetic field Planimeter.cpp -- computer polygon areas RhumbSolve.cpp -- calculate rhumb lines geographiclib-get-geoids -- download geoid datasets geographiclib-get-gravity -- download gravity models geographiclib-get-magnetic -- download geomagnetic models windows/ GeographicLib-vc9.sln -- MS Studio 2008 solution Geographic-vc9.vcproj -- project for library GeoConvert-vc9.vcproj -- project for GeoConvert TransverseMercatorTest-vc9.vcproj -- project for TransverseMercatorTest Geod-vc9.vcproj -- project for Geod Planimeter-vc9.vcproj -- project for Planimeter CartConvert-vc9.vcproj -- project for CartConvert EquidistantTest-vc9.vcproj -- project for EquidistantTest GeoidEval-vc9.vcproj -- project for GeoidEval Gravity-vc9.vcproj -- project for Gravity MagneticField-vc9.vcproj -- project for MagneticField also files for MS Studio 2010 (with vc10) NETGeographic-vc10.vcxproj -- project for .NET wrapper maxima/ tm.mac -- Maxima code for high precision TM ellint.mac -- Maxima code for elliptic functions needed by tm.mac tmseries.mac -- Maxima code for series approximations for TM geod.mac -- Maxima code for series approximations for Geodesic geodesic.mac -- Maxima code for geodesic problems matlab/geographiclib *.m, private/*.m -- Matlab implementation of some classes matlab/geographiclib-legacy *.{m,cpp} -- legacy Matlab routines doc/ doxyfile.in -- Doxygen config file GeographicLib.dox -- main page of Doxygen documentation geodseries30.html -- geodesic series to 30th order tmseries30.html -- transverse Mercator series to 30th order html/* -- directory with built documentation scripts/*.html -- demonstrations of the JavaScript interface scripts/GeographicLib/*.js -- JavaScript implementation of geodesics man/ *.pod -- plain old documentation *.1 -- man pages in nroff format *.1.html -- man pages in html format *.usage -- documentation for incorporation into executables python/GeographicLib/*.py -- Python implementation of geodesic routines java/.../*.java -- Java implementation of geodesic routines dotnet/NETGeographicLib/*.{cpp,h} -- .NET wrapper for GeographicLib dotnet/examples/CS/*.cs -- simple C# examples for each class dotnet/examples/ManagedCPP/*.cpp -- Managed C++ examples for each class dotnet/examples/VB/*.vb -- simple Visual Basic examples for each class dotnet/Projection/* -- a more complex C# application legacy/C/* -- C implementation of geodesic routines legacy/Fortran/* -- Fortran implementation of geodesic routines Makefile.mk -- Unix/Linux makefiles configure -- autoconf configuration script CMakeLists.txt -- cmake configuration files cmake/ FindGeographicLib.cmake -- cmake find script *.cmake.in -- cmake config templates GeographicLib-1.45/Makefile0000644000771000077100000000002412602735167015465 0ustar ckarneyckarneyinclude Makefile.mk GeographicLib-1.45/aclocal.m40000644000771000077100000013372712602735150015676 0ustar ckarneyckarney# generated automatically by aclocal 1.14.1 -*- Autoconf -*- # Copyright (C) 1996-2013 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'.])]) # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # 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, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 4 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS # Copyright (C) 2002-2013 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.14' 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.14.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.14.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-2013 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], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 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-2013 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-2013 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. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _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. FIXME. This creates each '.P' file that we will # 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" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 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. 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 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-2013 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}" != 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-2013 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])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2013 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_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 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 to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 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 ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 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-2013 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-2013 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-2013 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-2013 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-2013 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-2013 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-2013 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/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) GeographicLib-1.45/INSTALL0000644000771000077100000000013612602735126015055 0ustar ckarneyckarneyFor installation instructions, open http://geographiclib.sourceforge.net/html/install.html GeographicLib-1.45/m4/ltversion.m40000644000771000077100000000126212602735140016630 0ustar ckarneyckarney# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # 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. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) GeographicLib-1.45/m4/ltoptions.m40000644000771000077100000003007312602735140016640 0ustar ckarneyckarney# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # 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. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [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], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [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], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [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], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [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], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) GeographicLib-1.45/m4/ltsugar.m40000644000771000077100000001042412602735140016264 0ustar ckarneyckarney# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # 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. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) GeographicLib-1.45/m4/lt~obsolete.m40000644000771000077100000001375612602735140017170 0ustar ckarneyckarney# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # 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. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) GeographicLib-1.45/m4/libtool.m40000644000771000077100000105756412602735140016270 0ustar ckarneyckarney# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # 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. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl 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 "X${COLLECT_NAMES+set}" != Xset; 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 _LT_CC_BASENAME([$compiler]) # 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 _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# 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' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # 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' _LT_CONFIG_STATUS_DECLARATIONS 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 lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which 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 # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $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. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _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 "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # 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) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # 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 ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl 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* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl 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* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [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" >&AS_MESSAGE_LOG_FD $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 >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [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" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $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 >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) 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 "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; 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 "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="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}" _LT_TAGVAR(module_expsym_cmds, $1)="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}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$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}" _LT_TAGVAR(archive_expsym_cmds, $1)="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 _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`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_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # 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*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ 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" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && 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 which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); 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 which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; 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* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); 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*) LD="${LD-ld} -m elf_i386" ;; 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" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-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" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # 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 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 _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # 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\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD 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 $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" 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>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl 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; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # 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"; 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 $i != 17 # 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 ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] 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 -fvisbility=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 AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; 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 AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && 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" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) 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 _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=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\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD 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_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $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* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) 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 AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [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]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # 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 "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) 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" AC_MSG_RESULT([yes]) 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" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; 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` 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" else 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 "$host_cpu" = ia64; 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 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # 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}' else # 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' fi 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%'\''`; test $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}' m4_if([$1], [],[ 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`' m4_if([$1], [],[ 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} $libname${shared_ext}' 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 ;; 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' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; 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=yes 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 "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; 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 "$lt_cv_prog_gnu_ld" = yes; 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 ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-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 AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) 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 # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents 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="$sys_lib_dlsearch_path_spec $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*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac 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 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; 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 "$with_gnu_ld" = yes; 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=freebsd-elf 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 "$with_gnu_ld" = yes; 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 AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[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]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [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 dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" 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]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) 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 "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [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 &1 /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 ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; 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) 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*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; 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 ;; esac ]) 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 _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [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 case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) 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]) if test "$lt_cv_path_NM" != "no"; 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 AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [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 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 ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # 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 "$host_cpu" = ia64; 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 # 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 -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$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 -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/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 # and D for any global 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};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print 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 AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && 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 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_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@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$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_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && 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" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) 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 AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) 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 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='-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 m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; 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_TAGVAR(lt_prog_compiler_pic, $1)=-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_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--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). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+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_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='-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 m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; 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_TAGVAR(lt_prog_compiler_pic, $1)='-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_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; 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). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_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 AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # 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'. _LT_TAGVAR(exclude_expsyms, $1)=['_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. dnl Note also adjust exclude_expsyms for C++ above. 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 "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=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 "$with_gnu_ld" = yes; 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 "$lt_use_gnu_ld_interface" = yes; 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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 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 "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=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 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$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)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+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 _LT_TAGVAR(archive_cmds, $1)='$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 (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; 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 _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='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 "$host_os" = linux-dietlibc; 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 "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${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 _LT_TAGVAR(whole_archive_flag_spec, $1)='${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 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--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 _LT_TAGVAR(whole_archive_flag_spec, $1)='${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' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${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' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='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 xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='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 _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$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 _LT_TAGVAR(ld_shlibs, $1)=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 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** 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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$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. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; 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 AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | 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 # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; 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. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; 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 _LT_TAGVAR(hardcode_direct, $1)=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 _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; 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 "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$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. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${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. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$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)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # 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. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $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, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=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. _LT_TAGVAR(archive_cmds, $1)='$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. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=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*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$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*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # 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) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$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. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$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 _LT_TAGVAR(archive_cmds, $1)='$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' _LT_TAGVAR(archive_expsym_cmds, $1)='$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 _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$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 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$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 _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$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' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$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' _LT_TAGVAR(archive_expsym_cmds, $1)='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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='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='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='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}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=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 "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT 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. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) 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. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [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]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$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);}' _LT_TAG_COMPILER # 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 _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## 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_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && 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 "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$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 "$_lt_caught_CXX_error" != yes; 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. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # 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 _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_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 "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$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' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= 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. _LT_TAGVAR(archive_cmds, $1)='$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 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; 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 # need to do runtime linking. 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 ;; 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. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; 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 _LT_TAGVAR(hardcode_direct, $1)=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 _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; 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 "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$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. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${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. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=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. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # 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. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $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, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='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, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$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 (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; 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 _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=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 _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $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 "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$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 $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=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 _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$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 "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$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 _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='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++ _LT_TAGVAR(archive_cmds, $1)='$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. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$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 _LT_TAGVAR(archive_cmds, $1)='$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 _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-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. _LT_TAGVAR(archive_cmds, $1)='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' _LT_TAGVAR(archive_expsym_cmds, $1)='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"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$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."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$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 _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='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`"' _LT_TAGVAR(old_archive_cmds, $1)='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' _LT_TAGVAR(archive_cmds, $1)='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' _LT_TAGVAR(archive_expsym_cmds, $1)='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 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${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++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # 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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='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 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${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' _LT_TAGVAR(compiler_needs_object, $1)=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. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=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*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=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. _LT_TAGVAR(archive_cmds, $1)='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' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$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' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$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' _LT_TAGVAR(archive_expsym_cmds, $1)='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' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # 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 "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$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' ;; *) _LT_TAGVAR(archive_cmds, $1)='$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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # 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 _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='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' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=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?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=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. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$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. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='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 -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. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='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 -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 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT 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. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$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 _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$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... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) 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 "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # 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). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) 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 ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _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 dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); 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 $p = "-L" || test $p = "-R"; 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 "$pre_test_object_deps_done" = no; 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 "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${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 "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${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 "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [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. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 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 "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && 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 "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$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... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC 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 "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && 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 "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$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... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## 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_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## 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_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # 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 _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [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 ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#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 ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS GeographicLib-1.45/man/GeoConvert.1.html0000644000771000077100000004150312602735167017707 0ustar ckarneyckarney GeoConvert(1)

NAME

GeoConvert -- convert geographic coordinates

SYNOPSIS

GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -z zone | -s | -t ] [ -n ] [ -w ] [ -p prec ] [ -l | -a ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]

DESCRIPTION

GeoConvert reads from standard input interpreting each line as a geographic coordinate and prints the coordinate in the format specified by the options on standard output. The input is interpreted in one of three different ways depending on how many space or comma delimited tokens there are on the line. The options -g, -d, -u, and -m govern the format of output. In all cases, the WGS84 model of the earth is used (a = 6378137 m, f = 1/298.257223563).

geographic

2 tokens (output options -g, -d, or -:) given as latitude longitude using decimal degrees or degrees, minutes, and seconds. Latitude is given first (unless the -w option is given). See "GEOGRAPHIC COORDINATES" for a description of the format. For example, the following are all equivalent

    33.3 44.4
    E44.4 N33.3
    33d18'N 44d24'E
    44d24 33d18N
    33:18 +44:24
UTM/UPS

3 tokens (output option -u) given as zone+hemisphere easting northing or easting northing zone+hemisphere, where hemisphere is either n (or north) or s (or south). The zone is absent for a UPS specification. For example,

    38n 444140.54 3684706.36
    444140.54 3684706.36 38n
    s 2173854.98 2985980.58
    2173854.98 2985980.58 s
MRGS

1 token (output option -m) is used to specify the center of an MGRS grid square. For example,

    38SMB4484
    38SMB44140847064

OPTIONS

-g

output latitude and longitude using decimal degrees. Default output mode.

-d

output latitude and longitude using degrees, minutes, and seconds (DMS).

-:

like -d, except use : as a separator instead of the d, ', and " delimiters.

-u

output UTM or UPS.

-m

output MGRS.

-c

output meridian convergence and scale for the corresponding UTM or UPS projection. Convergence is the bearing of grid north given as degrees clockwise from true north.

-z

set the zone to zone for output. Use either 0 < zone <= 60 for a UTM zone or zone = 0 for UPS. Alternatively use a zone+hemisphere designation, e.g., 38n. See "ZONE".

-s

use the standard UPS and UTM zones.

-t

similar to -s but forces UPS regions to the closest UTM zone.

-n

on input, MGRS coordinates refer to the south-west corner of the MGRS square instead of the center; see "MGRS".

-w

on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-p

set the output precision to prec (default 0); prec is the precision relative to 1 m. See "PRECISION".

-l

on output, UTM/UPS uses the long forms north and south to designate the hemisphere instead of n or s.

-a

on output, UTM/UPS uses the abbreviations n and s to designate the hemisphere instead of north or south; this is the default representation.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.

PRECISION

prec gives precision of the output with prec = 0 giving 1 m precision, prec = 3 giving 1 mm precision, etc. prec is the number of digits after the decimal point for UTM/UPS. The number of digits per coordinate for MGRS is 5 + prec. For decimal degrees, the number of digits after the decimal point is 5 + prec. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds components is 1 + prec; if this is negative then use minutes (prec = -2 or -3) or degrees (prec <= -4) as the least significant component. Print convergence, resp. scale, with 5 + prec, resp. 7 + prec, digits after the decimal point. The minimum value of prec is -5 and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS, 6 for MGRS, and 8 for convergence and scale.

GEOGRAPHIC COORDINATES

The utility accepts geographic coordinates, latitude and longitude, in a number of common formats. Latitude precedes longitude, unless the -w option is given which switches this convention. On input, either coordinate may be given first by appending or prepending N or S to the latitude and E or W to the longitude. These hemisphere designators carry an implied sign, positive for N and E and negative for S and W. This sign multiplies any +/- sign prefixing the coordinate. The coordinates may be given as decimal degree or as degrees, minutes, and seconds. d, ', and " are used to denote degrees, minutes, and seconds, with the least significant designator optional. (See "QUOTING" for how to quote the characters ' and " when entering coordinates on the command line.) Alternatively, : (colon) may be used to separate the various components. Only the final component of coordinate can include a decimal point, and the minutes and seconds components must be less than 60.

It is also possible to carry out addition or subtraction operations in geographic coordinates. If the coordinate includes interior signs (i.e., not at the beginning or immediately after an initial hemisphere designator), then the coordinate is split before such signs; the pieces are parsed separately and the results summed. For example the point 15" east of 39N 70W is

    39N 70W+0:0:15E

WARNING: "Exponential" notation is not recognized for geographic coordinates; instead 7.0E+1 is parsed as (7.0E) + (+1), yielding the same result as 8.0E.

Various unicode characters (encoded with UTF-8) may also be used to denote degrees, minutes, and seconds, e.g., the degree, prime, and double prime symbols; in addition two single quotes can be used to represent ".

The other GeographicLib utilities use the same rules for interpreting geographic coordinates; in addition, azimuths and arc lengths are interpreted the same way.

QUOTING

Unfortunately the characters ' and " have special meanings in many shells and have to be entered with care. However note (1) that the trailing designator is optional and that (2) you can use colons as a separator character. Thus 10d20' can be entered as 10d20 or 10:20 and 10d20'30" can be entered as 10:20:30.

Unix shells (sh, bash, tsch)

The characters ' and " can be quoted by preceding them with a \ (backslash); or you can quote a string containing ' with a pair of "s. The two alternatives are illustrated by

   echo 10d20\'30\" "20d30'40" | GeoConvert -d -p -1
   => 10d20'30"N 020d30'40"E

Quoting of command line arguments is similar

   GeoConvert -d -p -1 --input-string "10d20'30\" 20d30'40"
   => 10d20'30"N 020d30'40"E
Windows command shell (cmd)

The ' character needs no quoting; the " character can either be quoted by a ^ or can be represented by typing ' twice. (This quoting is usually unnecessary because the trailing designator can be omitted.) Thus

   echo 10d20'30'' 20d30'40 | GeoConvert -d -p -1
   => 10d20'30"N 020d30'40"E

Use \ to quote the " character in a command line argument

   GeoConvert -d -p -1 --input-string "10d20'30\" 20d30'40"
   => 10d20'30"N 020d30'40"E
Input from a file

No quoting need be done if the input from a file. Thus each line of the file input.txt should just contain the plain coordinates.

  GeoConvert -d -p -1 < input.txt

MGRS

MGRS coordinates represent a square patch of the earth, thus 38SMB4488 is in zone 38n with 444km <= easting < 445km and 3688km <= northing < 3689km. Consistent with this representation, coordinates are truncated (instead of rounded) to the requested precision. Similarly, on input an MGRS coordinate represents the center of the square (38n 444500 3688500 in the example above). However, if the -n option is given then the south-west corner of the square is returned instead (38n 444000 3688000 in the example above).

ZONE

If the input is geographic, GeoConvert uses the standard rules of selecting UTM vs UPS and for assigning the UTM zone (with the Norway and Svalbard exceptions). If the input is UTM/UPS or MGRS, then the choice between UTM and UPS and the UTM zone mirrors the input. The -z zone, -s, and -t options allow these rules to be overridden with zone = 0 being used to indicate UPS. For example, the point

   79.9S 6.1E

corresponds to possible MGRS coordinates

   32CMS4324728161 (standard UTM zone = 32)
   31CEM6066227959 (neighboring UTM zone = 31)
     BBZ1945517770 (neighboring UPS zone)

then

   echo 79.9S 6.1E      | GeoConvert -p -3 -m       => 32CMS4328
   echo 31CEM6066227959 | GeoConvert -p -3 -m       => 31CEM6027
   echo 31CEM6066227959 | GeoConvert -p -3 -m -s    => 32CMS4328
   echo 31CEM6066227959 | GeoConvert -p -3 -m -z 0  =>   BBZ1917

Is zone is specified with a hemisphere, then this is honored when printing UTM coordinates:

   echo -1 3 | GeoConvert -u         => 31s 500000 9889470
   echo -1 3 | GeoConvert -u -z 31   => 31s 500000 9889470
   echo -1 3 | GeoConvert -u -z 31s  => 31s 500000 9889470
   echo -1 3 | GeoConvert -u -z 31n  => 31n 500000 -110530

NOTE: the letter in the zone specification for UTM is a hemisphere designator n or s and not an MGRS latitude band letter. Convert the MGRS latitude band letter to a hemisphere as follows: replace C thru M by s (or south); replace N thru X by n (or north).

EXAMPLES

   echo 38SMB4488 | GeoConvert         => 33.33424 44.40363
   echo 38SMB4488 | GeoConvert -: -p 1 => 33:20:03.25N 044:2413.06E
   echo 38SMB4488 | GeoConvert -u      => 38n 444500 3688500
   echo E44d24 N33d20 | GeoConvert -m -p -3 => 38SMB4488

GeoConvert can be used to do simple arithmetic using degree, minutes, and seconds. For example, sometimes data is tiled in 15 second squares tagged by the DMS representation of the SW corner. The tags of the tile at 38:59:45N 077:02:00W and its 8 neighbors are then given by

    t=0:0:15
    for y in -$t +0 +$t; do
        for x in -$t +0 +$t; do
            echo 38:59:45N$y 077:02:00W$x
        done
    done | GeoConvert -: -p -1 | tr -d ': '
    =>
    385930N0770215W
    385930N0770200W
    385930N0770145W
    385945N0770215W
    385945N0770200W
    385945N0770145W
    390000N0770215W
    390000N0770200W
    390000N0770145W

ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes GeoConvert to return an exit code of 1. However, an error does not cause GeoConvert to terminate; following lines will be converted.

ABBREVIATIONS

UTM

Universal Transverse Mercator, https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system.

UPS

Universal Polar Stereographic, https://en.wikipedia.org/wiki/Universal_Polar_Stereographic.

MGRS

Military Grid Reference System, https://en.wikipedia.org/wiki/Military_grid_reference_system.

WGS84

World Geodetic System 1984, https://en.wikipedia.org/wiki/WGS84.

SEE ALSO

An online version of this utility is availbable at http://geographiclib.sourceforge.net/cgi-bin/GeoConvert.

The algorithms for the transverse Mercator projection are described in C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); DOI https://dx.doi.org/10.1007/s00190-011-0445-3; preprint http://arxiv.org/abs/1002.1417.

AUTHOR

GeoConvert was written by Charles Karney.

HISTORY

GeoConvert was added to GeographicLib, http://geographiclib.sf.net, in 2009-01.

GeographicLib-1.45/man/ConicProj.usage0000644000771000077100000001533412602735167017526 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " ConicProj ( -c | -a ) lat1 lat2 [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ]\n" " [ -w ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version |\n" " -h | --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator linesep ] [ --output-file outfile ]\n" "\n" "For full documentation type:\n" " ConicProj --help\n" "or visit:\n" " http://geographiclib.sf.net/1.45/ConicProj.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " ConicProj -- perform conic projections\n" "\n" "SYNOPSIS\n" " ConicProj ( -c | -a ) lat1 lat2 [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ]\n" " [ -w ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version |\n" " -h | --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator linesep ] [ --output-file outfile ]\n" "\n" "DESCRIPTION\n" " Perform one of two conic projections geodesics. Convert geodetic\n" " coordinates to either Lambert conformal conic or Albers equal area\n" " coordinates. The standard latitudes lat1 and lat2 are specified by\n" " that the -c option (for Lambert conformal conic) or the -a option (for\n" " Albers equal area). At least one of these options must be given (the\n" " last one given is used). Specify lat1 = lat2, to obtain the case with\n" " a single standard parallel. The central meridian is given by lon0.\n" " The longitude of origin is given by the latitude of minimum (azimuthal)\n" " scale for Lambert conformal conic (Albers equal area). The (azimuthal)\n" " scale on the standard parallels is k1.\n" "\n" " Geodetic coordinates are provided on standard input as a set of lines\n" " containing (blank separated) latitude and longitude (decimal degrees or\n" " degrees, minutes, seconds); for details on the allowed formats for\n" " latitude and longitude, see the \"GEOGRAPHIC COORDINATES\" section of\n" " GeoConvert(1). For each set of geodetic coordinates, the corresponding\n" " projected easting, x, and northing, y, (meters) are printed on standard\n" " output together with the meridian convergence gamma (degrees) and\n" " (azimuthal) scale k. For Albers equal area, the radial scale is 1/k.\n" " The meridian convergence is the bearing of the y axis measured\n" " clockwise from true north.\n" "\n" " Special cases of the Lambert conformal projection are the Mercator\n" " projection (the standard latitudes equal and opposite) and the polar\n" " stereographic projection (both standard latitudes correspond to the\n" " same pole). Special cases of the Albers equal area projection are the\n" " cylindrical equal area projection (the standard latitudes equal and\n" " opposite), the Lambert azimuthal equal area projection (both standard\n" " latitude corresponds to the same pole), and the Lambert equal area\n" " conic projection (one standard parallel is at a pole).\n" "\n" "OPTIONS\n" " -c use the Lambert conformal conic projection with standard parallels\n" " lat1 and lat2.\n" "\n" " -a use the Albers equal area projection with standard parallels lat1\n" " and lat2.\n" "\n" " -l specify the longitude of origin lon0 (degrees, default 0).\n" "\n" " -k specify the (azimuthal) scale k1 on the standard parallels (default\n" " 1).\n" "\n" " -r perform the reverse projection. x and y are given on standard\n" " input and each line of standard output gives latitude, longitude,\n" " gamma, and k.\n" "\n" " -e specify the ellipsoid via a f; the equatorial radius is a and the\n" " flattening is f. Setting f = 0 results in a sphere. Specify f < 0\n" " for a prolate ellipsoid. A simple fraction, e.g., 1/297, is\n" " allowed for f. By default, the WGS84 ellipsoid is used, a =\n" " 6378137 m, f = 1/298.257223563.\n" "\n" " -w on input and output, longitude precedes latitude (except that, on\n" " input, this can be overridden by a hemisphere designator, N, S, E,\n" " W).\n" "\n" " -p set the output precision to prec (default 6). prec is the number\n" " of digits after the decimal point for lengths (in meters). For\n" " latitudes and longitudes (in degrees), the number of digits after\n" " the decimal point is prec + 5. For the convergence (in degrees)\n" " and scale, the number of digits after the decimal point is prec +\n" " 6.\n" "\n" " --comment-delimiter\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "EXAMPLES\n" " echo 39.95N 75.17W | ConicProj -c 40d58 39d56 -l 77d45W\n" " => 220445 -52372 1.67 1.0\n" " echo 220445 -52372 | ConicProj -c 40d58 39d56 -l 77d45W -r\n" " => 39.95 -75.17 1.67 1.0\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes ConicProj to return an exit code of\n" " 1. However, an error does not cause ConicProj to terminate; following\n" " lines will be converted.\n" "\n" "AUTHOR\n" " ConicProj was written by Charles Karney.\n" "\n" "HISTORY\n" " ConicProj was added to GeographicLib, , in\n" " version 1.9.\n" ; return retval; } GeographicLib-1.45/man/ConicProj.1.html0000644000771000077100000001574112602735167017527 0ustar ckarneyckarney ConicProj(1)

NAME

ConicProj -- perform conic projections

SYNOPSIS

ConicProj ( -c | -a ) lat1 lat2 [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ] [ -w ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]

DESCRIPTION

Perform one of two conic projections geodesics. Convert geodetic coordinates to either Lambert conformal conic or Albers equal area coordinates. The standard latitudes lat1 and lat2 are specified by that the -c option (for Lambert conformal conic) or the -a option (for Albers equal area). At least one of these options must be given (the last one given is used). Specify lat1 = lat2, to obtain the case with a single standard parallel. The central meridian is given by lon0. The longitude of origin is given by the latitude of minimum (azimuthal) scale for Lambert conformal conic (Albers equal area). The (azimuthal) scale on the standard parallels is k1.

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude and longitude (decimal degrees or degrees, minutes, seconds); for details on the allowed formats for latitude and longitude, see the GEOGRAPHIC COORDINATES section of GeoConvert(1). For each set of geodetic coordinates, the corresponding projected easting, x, and northing, y, (meters) are printed on standard output together with the meridian convergence gamma (degrees) and (azimuthal) scale k. For Albers equal area, the radial scale is 1/k. The meridian convergence is the bearing of the y axis measured clockwise from true north.

Special cases of the Lambert conformal projection are the Mercator projection (the standard latitudes equal and opposite) and the polar stereographic projection (both standard latitudes correspond to the same pole). Special cases of the Albers equal area projection are the cylindrical equal area projection (the standard latitudes equal and opposite), the Lambert azimuthal equal area projection (both standard latitude corresponds to the same pole), and the Lambert equal area conic projection (one standard parallel is at a pole).

OPTIONS

-c

use the Lambert conformal conic projection with standard parallels lat1 and lat2.

-a

use the Albers equal area projection with standard parallels lat1 and lat2.

-l

specify the longitude of origin lon0 (degrees, default 0).

-k

specify the (azimuthal) scale k1 on the standard parallels (default 1).

-r

perform the reverse projection. x and y are given on standard input and each line of standard output gives latitude, longitude, gamma, and k.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

-w

on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-p

set the output precision to prec (default 6). prec is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is prec + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is prec + 6.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.

EXAMPLES

   echo 39.95N 75.17W | ConicProj -c 40d58 39d56 -l 77d45W
   => 220445 -52372 1.67 1.0
   echo 220445 -52372 | ConicProj -c 40d58 39d56 -l 77d45W -r
   => 39.95 -75.17 1.67 1.0

ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes ConicProj to return an exit code of 1. However, an error does not cause ConicProj to terminate; following lines will be converted.

AUTHOR

ConicProj was written by Charles Karney.

HISTORY

ConicProj was added to GeographicLib, http://geographiclib.sf.net, in version 1.9.

GeographicLib-1.45/man/script.8.in0000644000771000077100000000065412602735126016606 0ustar ckarneyckarney.TH @SCRIPT@ 8 "" GeographicLib GeographicLib .SH NAME @SCRIPT@ \-\- a GeographicLib administrative tool .SH DESCRIPTION .B @SCRIPT@ downloads and installs the @DATA@ datasets used by GeographicLib, . For documentation, supply the .B -h option: .PP @SCRIPT@ -h .PP By default, the datasets are installed in .I @GEOGRAPHICLIB_DATA@/@DATA@ and the script requires write access to this directory. GeographicLib-1.45/man/ConicProj.pod0000644000771000077100000001252012602735126017171 0ustar ckarneyckarney=head1 NAME ConicProj -- perform conic projections =head1 SYNOPSIS B ( B<-c> | B<-a> ) I I [ B<-l> I ] [ B<-k> I ] [ B<-r> ] [ B<-e> I I ] [ B<-w> ] [ B<-p> I ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION Perform one of two conic projections geodesics. Convert geodetic coordinates to either Lambert conformal conic or Albers equal area coordinates. The standard latitudes I and I are specified by that the B<-c> option (for Lambert conformal conic) or the B<-a> option (for Albers equal area). At least one of these options must be given (the last one given is used). Specify I = I, to obtain the case with a single standard parallel. The central meridian is given by I. The longitude of origin is given by the latitude of minimum (azimuthal) scale for Lambert conformal conic (Albers equal area). The (azimuthal) scale on the standard parallels is I. Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) I and I (decimal degrees or degrees, minutes, seconds); for details on the allowed formats for latitude and longitude, see the C section of GeoConvert(1). For each set of geodetic coordinates, the corresponding projected easting, I, and northing, I, (meters) are printed on standard output together with the meridian convergence I (degrees) and (azimuthal) scale I. For Albers equal area, the radial scale is 1/I. The meridian convergence is the bearing of the I axis measured clockwise from true north. Special cases of the Lambert conformal projection are the Mercator projection (the standard latitudes equal and opposite) and the polar stereographic projection (both standard latitudes correspond to the same pole). Special cases of the Albers equal area projection are the cylindrical equal area projection (the standard latitudes equal and opposite), the Lambert azimuthal equal area projection (both standard latitude corresponds to the same pole), and the Lambert equal area conic projection (one standard parallel is at a pole). =head1 OPTIONS =over =item B<-c> use the Lambert conformal conic projection with standard parallels I and I. =item B<-a> use the Albers equal area projection with standard parallels I and I. =item B<-l> specify the longitude of origin I (degrees, default 0). =item B<-k> specify the (azimuthal) scale I on the standard parallels (default 1). =item B<-r> perform the reverse projection. I and I are given on standard input and each line of standard output gives I, I, I, and I. =item B<-e> specify the ellipsoid via I I; the equatorial radius is I and the flattening is I. Setting I = 0 results in a sphere. Specify I E 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for I. By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<-w> on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, I, I, I, I). =item B<-p> set the output precision to I (default 6). I is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is I + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is I + 6. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 EXAMPLES echo 39.95N 75.17W | ConicProj -c 40d58 39d56 -l 77d45W => 220445 -52372 1.67 1.0 echo 220445 -52372 | ConicProj -c 40d58 39d56 -l 77d45W -r => 39.95 -75.17 1.67 1.0 =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in version 1.9. GeographicLib-1.45/man/GeoidEval.usage0000644000771000077100000003062312602735167017475 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " GeoidEval [ -n name ] [ -d dir ] [ -l ] [ -a | -c south west north east\n" " ] [ -w ] [ -z zone ] [ --msltohae ] [ --haetomsl ] [ -v ] [\n" " --comment-delimiter commentdelim ] [ --version | -h | --help ] [\n" " --input-file infile | --input-string instring ] [ --line-separator\n" " linesep ] [ --output-file outfile ]\n" "\n" "For full documentation type:\n" " GeoidEval --help\n" "or visit:\n" " http://geographiclib.sf.net/1.45/GeoidEval.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " GeoidEval -- look up geoid heights\n" "\n" "SYNOPSIS\n" " GeoidEval [ -n name ] [ -d dir ] [ -l ] [ -a | -c south west north east\n" " ] [ -w ] [ -z zone ] [ --msltohae ] [ --haetomsl ] [ -v ] [\n" " --comment-delimiter commentdelim ] [ --version | -h | --help ] [\n" " --input-file infile | --input-string instring ] [ --line-separator\n" " linesep ] [ --output-file outfile ]\n" "\n" "DESCRIPTION\n" " GeoidEval reads in positions on standard input and prints out the\n" " corresponding heights of the geoid above the WGS84 ellipsoid on\n" " standard output.\n" "\n" " Positions are given as latitude and longitude, UTM/UPS, or MGRS, in any\n" " of the formats accepted by GeoConvert(1). (MGRS coordinates signify\n" " the center of the corresponding MGRS square.) If the -z option is\n" " specified then the specified zone is prepended to each line of input\n" " (which must be in UTM/UPS coordinates). This allows a file with UTM\n" " eastings and northings in a single zone to be used as standard input.\n" "\n" " More accurate results for the geoid height are provided by Gravity(1).\n" " This utility can also compute the direction of gravity accurately.\n" "\n" " The height of the geoid above the ellipsoid, N, is sometimes called the\n" " geoid undulation. It can be used to convert a height above the\n" " ellipsoid, h, to the corresponding height above the geoid (the\n" " orthometric height, roughly the height above mean sea level), H, using\n" " the relations\n" "\n" " h = N + H, H = -N + h.\n" "\n" "OPTIONS\n" " -n use geoid name instead of the default \"egm96-5\". See \"GEOIDS\".\n" "\n" " -d read geoid data from dir instead of the default. See \"GEOIDS\".\n" "\n" " -l use bilinear interpolation instead of cubic. See \"INTERPOLATION\".\n" "\n" " -a cache the entire data set in memory. See \"CACHE\".\n" "\n" " -c cache the data bounded by south west north east in memory. The\n" " first two arguments specify the SW corner of the cache and the last\n" " two arguments specify the NE corner. The -w flag specifies that\n" " longitude precedes latitude for these corners, provided that it\n" " appears before -c. See \"CACHE\".\n" "\n" " -w when reading geographic coordinates, longitude precedes latitude\n" " (this can be overridden by a hemisphere designator, N, S, E, W).\n" "\n" " -z prefix each line of input by zone, e.g., \"38n\". This should be\n" " used when the input consists of UTM/UPS eastings and northings.\n" "\n" " --msltohae\n" " standard input should include a final token on each line which is\n" " treated as a height (in meters) above the geoid and the output\n" " echoes the input line with the height converted to height above\n" " ellipsoid (HAE). If -z zone is specified then the third token is\n" " treated as the height; this makes it possible to convert LIDAR data\n" " where each line consists of: easting northing height intensity.\n" "\n" " --haetomsl\n" " this is similar to --msltohae except that the height token is\n" " treated as a height (in meters) above the ellipsoid and the output\n" " echoes the input line with the height converted to height above the\n" " geoid (MSL).\n" "\n" " -v print information about the geoid on standard error before\n" " processing the input.\n" "\n" " --comment-delimiter\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage, the default geoid path and name, and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "GEOIDS\n" " GeoidEval computes geoid heights by interpolating on the data in a\n" " regularly spaced table (see \"INTERPOLATION\"). The following geoid\n" " tables are available (however, some may not be installed):\n" "\n" " bilinear error cubic error\n" " name geoid grid max rms max rms\n" " egm84-30 EGM84 30' 1.546 m 70 mm 0.274 m 14 mm\n" " egm84-15 EGM84 15' 0.413 m 18 mm 0.021 m 1.2 mm\n" " egm96-15 EGM96 15' 1.152 m 40 mm 0.169 m 7.0 mm\n" " egm96-5 EGM96 5' 0.140 m 4.6 mm .0032 m 0.7 mm\n" " egm2008-5 EGM2008 5' 0.478 m 12 mm 0.294 m 4.5 mm\n" " egm2008-2_5 EGM2008 2.5' 0.135 m 3.2 mm 0.031 m 0.8 mm\n" " egm2008-1 EGM2008 1' 0.025 m 0.8 mm .0022 m 0.7 mm\n" "\n" " By default, the \"egm96-5\" geoid is used. This may changed by setting\n" " the environment variable \"GEOGRAPHICLIB_GEOID_NAME\" or with the -n\n" " option. The errors listed here are estimates of the quantization and\n" " interpolation errors in the reported heights compared to the specified\n" " geoid.\n" "\n" " The geoid data will be loaded from a directory specified at compile\n" " time. This may changed by setting the environment variables\n" " \"GEOGRAPHICLIB_GEOID_PATH\" or \"GEOGRAPHICLIB_DATA\", or with the -d\n" " option. The -h option prints the default geoid path and name. Use the\n" " -v option to ascertain the full path name of the data file.\n" "\n" " Instructions for downloading and installing geoid data are available at\n" " .\n" "\n" " NOTE: all the geoids above apply to the WGS84 ellipsoid (a = 6378137 m,\n" " f = 1/298.257223563) only.\n" "\n" "INTERPOLATION\n" " Cubic interpolation is used to compute the geoid height unless -l is\n" " specified in which case bilinear interpolation is used. The cubic\n" " interpolation is based on a least-squares fit of a cubic polynomial to\n" " a 12-point stencil\n" "\n" " . 1 1 .\n" " 1 2 2 1\n" " 1 2 2 1\n" " . 1 1 .\n" "\n" " The cubic is constrained to be independent of longitude when evaluating\n" " the height at one of the poles. Cubic interpolation is considerably\n" " more accurate than bilinear; however it results in small\n" " discontinuities in the returned height on cell boundaries.\n" "\n" "CACHE\n" " By default, the data file is randomly read to compute the geoid heights\n" " at the input positions. Usually this is sufficient for interactive\n" " use. If many heights are to be computed, use -c south west north east\n" " to notify GeoidEval to read a rectangle of data into memory; heights\n" " within the this rectangle can then be computed without any disk access.\n" " If -a is specified all the geoid data is read; in the case of\n" " \"egm2008-1\", this requires about 0.5 GB of RAM. The evaluation of\n" " heights outside the cached area causes the necessary data to be read\n" " from disk. Use the -v option to verify the size of the cache.\n" "\n" " Regardless of whether any cache is requested (with the -a or -c\n" " options), the data for the last grid cell in cached. This allows the\n" " geoid height along a continuous path to be returned with little disk\n" " overhead.\n" "\n" "ENVIRONMENT\n" " GEOGRAPHICLIB_GEOID_NAME\n" " Override the compile-time default geoid name of \"egm96-5\". The -h\n" " option reports the value of GEOGRAPHICLIB_GEOID_NAME, if defined,\n" " otherwise it reports the compile-time value. If the -n name option\n" " is used, then name takes precedence.\n" "\n" " GEOGRAPHICLIB_GEOID_PATH\n" " Override the compile-time default geoid path. This is typically\n" " \"/usr/local/share/GeographicLib/geoids\" on Unix-like systems and\n" " \"C:/ProgramData/GeographicLib/geoids\" on Windows systems. The -h\n" " option reports the value of GEOGRAPHICLIB_GEOID_PATH, if defined,\n" " otherwise it reports the compile-time value. If the -d dir option\n" " is used, then dir takes precedence.\n" "\n" " GEOGRAPHICLIB_DATA\n" " Another way of overriding the compile-time default geoid path. If\n" " it is set (and if GEOGRAPHICLIB_GEOID_PATH is not set), then\n" " $GEOGRAPHICLIB_DATA/geoids is used.\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes GeoidEval to return an exit code of\n" " 1. However, an error does not cause GeoidEval to terminate; following\n" " lines will be converted.\n" "\n" "ABBREVIATIONS\n" " The geoid is usually approximated by an \"earth gravity model\". The\n" " models published by the NGA are:\n" "\n" " EGM84\n" " An earth gravity model published by the NGA in 1984,\n" " .\n" "\n" " EGM96\n" " An earth gravity model published by the NGA in 1996,\n" " .\n" "\n" " EGM2008\n" " An earth gravity model published by the NGA in 2008,\n" " .\n" "\n" " WGS84\n" " World Geodetic System 1984, .\n" "\n" " HAE Height above the WGS84 ellipsoid.\n" "\n" " MSL Mean sea level, used as a convenient short hand for the geoid.\n" " (However, typically, the geoid differs by a few meters from mean\n" " sea level.)\n" "\n" "EXAMPLES\n" " The height of the EGM96 geoid at Timbuktu\n" "\n" " echo 16:46:33N 3:00:34W | GeoidEval\n" " => 28.7068 -0.02e-6 -1.73e-6\n" "\n" " The first number returned is the height of the geoid and the 2nd and\n" " 3rd are its slopes in the northerly and easterly directions.\n" "\n" " Convert a point in UTM zone 18n from MSL to HAE\n" "\n" " echo 531595 4468135 23 | GeoidEval --msltohae -z 18n\n" " => 531595 4468135 -10.842\n" "\n" "SEE ALSO\n" " GeoConvert(1), Gravity(1), geographiclib-get-geoids(8).\n" "\n" " An online version of this utility is availbable at\n" " .\n" "\n" "AUTHOR\n" " GeoidEval was written by Charles Karney.\n" "\n" "HISTORY\n" " GeoidEval was added to GeographicLib, , in\n" " 2009-09.\n" ; return retval; } GeographicLib-1.45/man/CartConvert.1.html0000644000771000077100000001441112602735167020064 0ustar ckarneyckarney CartConvert(1)

NAME

CartConvert -- convert geodetic coordinates to geocentric or local cartesian

SYNOPSIS

CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ -w ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]

DESCRIPTION

Convert geodetic coordinates to either geocentric or local cartesian coordinates. Geocentric coordinates have the origin at the center of the earth, with the z axis going thru the north pole, and the x axis thru latitude = 0, longitude = 0. By default, the conversion is to geocentric coordinates. Specifying -l lat0 lon0 h0 causes a local coordinate system to be used with the origin at latitude = lat0, longitude = lon0, height = h0, z normal to the ellipsoid and y due north.

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude, longitude (decimal degrees or degrees, minutes and seconds), and height above the ellipsoid (meters); for details on the allowed formats for latitude and longitude, see the GEOGRAPHIC COORDINATES section of GeoConvert(1). For each set of geodetic coordinates, the corresponding cartesian coordinates x, y, z (meters) are printed on standard output.

OPTIONS

-r

perform the reverse projection. x, y, z are given on standard input and each line of standard output gives latitude, longitude, height.

-l

specifies conversions to and from a local cartesion coordinate systems with origin lat0 lon0 h0, instead of a geocentric coordinate system. The -w flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before -l.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

-w

on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-p

set the output precision to prec (default 6). prec is the number of digits after the decimal point for geocentric and local cartesion coordinates and for the height (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is prec + 5.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.

EXAMPLES

   echo 33.3 44.4 6000 | CartConvert
   => 3816209.60 3737108.55 3485109.57
   echo 33.3 44.4 6000 | CartConvert -l 33 44 20
   => 37288.97 33374.29 5783.64
   echo 30000 30000 0 | CartConvert -r
   => 6.483 45 -6335709.73

ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes CartConvert to return an exit code of 1. However, an error does not cause CartConvert to terminate; following lines will be converted.

SEE ALSO

AUTHOR

CartConvert was written by Charles Karney.

HISTORY

CartConvert was added to GeographicLib, http://geographiclib.sf.net, in 2009-02. Prior to 2009-03 it was called ECEFConvert.

GeographicLib-1.45/man/ConicProj.10000644000771000077100000002416112602735167016560 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "CONICPROJ 1" .TH CONICPROJ 1 "2015-09-30" "GeographicLib 1.45" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" ConicProj \-\- perform conic projections .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBConicProj\fR ( \fB\-c\fR | \fB\-a\fR ) \fIlat1\fR \fIlat2\fR [ \fB\-l\fR \fIlon0\fR ] [ \fB\-k\fR \fIk1\fR ] [ \fB\-r\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-w\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Perform one of two conic projections geodesics. Convert geodetic coordinates to either Lambert conformal conic or Albers equal area coordinates. The standard latitudes \fIlat1\fR and \fIlat2\fR are specified by that the \fB\-c\fR option (for Lambert conformal conic) or the \fB\-a\fR option (for Albers equal area). At least one of these options must be given (the last one given is used). Specify \fIlat1\fR = \fIlat2\fR, to obtain the case with a single standard parallel. The central meridian is given by \fIlon0\fR. The longitude of origin is given by the latitude of minimum (azimuthal) scale for Lambert conformal conic (Albers equal area). The (azimuthal) scale on the standard parallels is \fIk1\fR. .PP Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) \fIlatitude\fR and \fIlongitude\fR (decimal degrees or degrees, minutes, seconds); for details on the allowed formats for latitude and longitude, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fIGeoConvert\fR\|(1). For each set of geodetic coordinates, the corresponding projected easting, \fIx\fR, and northing, \fIy\fR, (meters) are printed on standard output together with the meridian convergence \&\fIgamma\fR (degrees) and (azimuthal) scale \fIk\fR. For Albers equal area, the radial scale is 1/\fIk\fR. The meridian convergence is the bearing of the \fIy\fR axis measured clockwise from true north. .PP Special cases of the Lambert conformal projection are the Mercator projection (the standard latitudes equal and opposite) and the polar stereographic projection (both standard latitudes correspond to the same pole). Special cases of the Albers equal area projection are the cylindrical equal area projection (the standard latitudes equal and opposite), the Lambert azimuthal equal area projection (both standard latitude corresponds to the same pole), and the Lambert equal area conic projection (one standard parallel is at a pole). .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-c\fR" 4 .IX Item "-c" use the Lambert conformal conic projection with standard parallels \&\fIlat1\fR and \fIlat2\fR. .IP "\fB\-a\fR" 4 .IX Item "-a" use the Albers equal area projection with standard parallels \fIlat1\fR and \&\fIlat2\fR. .IP "\fB\-l\fR" 4 .IX Item "-l" specify the longitude of origin \fIlon0\fR (degrees, default 0). .IP "\fB\-k\fR" 4 .IX Item "-k" specify the (azimuthal) scale \fIk1\fR on the standard parallels (default 1). .IP "\fB\-r\fR" 4 .IX Item "-r" perform the reverse projection. \fIx\fR and \fIy\fR are given on standard input and each line of standard output gives \fIlatitude\fR, \fIlongitude\fR, \&\fIgamma\fR, and \fIk\fR. .IP "\fB\-e\fR" 4 .IX Item "-e" specify the ellipsoid via \fIa\fR \fIf\fR; the equatorial radius is \fIa\fR and the flattening is \fIf\fR. Setting \fIf\fR = 0 results in a sphere. Specify \&\fIf\fR < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for \fIf\fR. By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563. .IP "\fB\-w\fR" 4 .IX Item "-w" on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, \fIN\fR, \fIS\fR, \fIE\fR, \&\fIW\fR). .IP "\fB\-p\fR" 4 .IX Item "-p" set the output precision to \fIprec\fR (default 6). \fIprec\fR is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is \fIprec\fR + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is \fIprec\fR + 6. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 4 \& echo 39.95N 75.17W | ConicProj \-c 40d58 39d56 \-l 77d45W \& => 220445 \-52372 1.67 1.0 \& echo 220445 \-52372 | ConicProj \-c 40d58 39d56 \-l 77d45W \-r \& => 39.95 \-75.17 1.67 1.0 .Ve .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBConicProj\fR to return an exit code of 1. However, an error does not cause \fBConicProj\fR to terminate; following lines will be converted. .SH "AUTHOR" .IX Header "AUTHOR" \&\fBConicProj\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBConicProj\fR was added to GeographicLib, , in version 1.9. GeographicLib-1.45/man/GeodesicProj.10000644000771000077100000002425212602735167017250 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "GEODESICPROJ 1" .TH GEODESICPROJ 1 "2015-09-30" "GeographicLib 1.45" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" GeodesicProj \-\- perform projections based on geodesics .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBGeodesicProj\fR ( \fB\-z\fR | \fB\-c\fR | \fB\-g\fR ) \fIlat0\fR \fIlon0\fR [ \fB\-r\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-w\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Perform projections based on geodesics. Convert geodetic coordinates to either azimuthal equidistant, Cassini-Soldner, or gnomonic coordinates. The center of the projection (\fIlat0\fR, \fIlon0\fR) is specified by either the \fB\-c\fR option (for Cassini-Soldner), the \fB\-z\fR option (for azimuthal equidistant), or the \fB\-g\fR option (for gnomonic). At least one of these options must be given (the last one given is used). .PP Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) \fIlatitude\fR and \fIlongitude\fR (decimal degrees or degrees, minutes, seconds); for details on the allowed formats for latitude and longitude, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fIGeoConvert\fR\|(1). For each set of geodetic coordinates, the corresponding projected coordinates \fIx\fR, \fIy\fR (meters) are printed on standard output together with the azimuth \fIazi\fR (degrees) and reciprocal scale \fIrk\fR. For Cassini-Soldner, \fIazi\fR is the bearing of the easting direction and the scale in the easting direction is 1 and the scale in the northing direction is 1/\fIrk\fR. For azimuthal equidistant and gnomonic, \fIazi\fR is the bearing of the radial direction and the scale in the azimuthal direction is 1/\fIrk\fR. For azimuthal equidistant and gnomonic, the scales in the radial direction are 1 and 1/\fIrk\fR^2, respectively. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-z\fR" 4 .IX Item "-z" use the azimuthal equidistant projection centered at latitude = \fIlat0\fR, longitude = \fIlon0\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 coordinates, provided that it appears before \fB\-z\fR. .IP "\fB\-c\fR" 4 .IX Item "-c" use the Cassini-Soldner projection centered at latitude = \fIlat0\fR, longitude = \fIlon0\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 coordinates, provided that it appears before \fB\-c\fR. .IP "\fB\-g\fR" 4 .IX Item "-g" use the ellipsoidal gnomonic projection centered at latitude = \fIlat0\fR, longitude = \fIlon0\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 coordinates, provided that it appears before \fB\-g\fR. .IP "\fB\-r\fR" 4 .IX Item "-r" perform the reverse projection. \fIx\fR and \fIy\fR are given on standard input and each line of standard output gives \fIlatitude\fR, \fIlongitude\fR, \&\fIazi\fR, and \fIrk\fR. .IP "\fB\-e\fR" 4 .IX Item "-e" specify the ellipsoid via \fIa\fR \fIf\fR; the equatorial radius is \fIa\fR and the flattening is \fIf\fR. Setting \fIf\fR = 0 results in a sphere. Specify \&\fIf\fR < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for \fIf\fR. By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563. .IP "\fB\-w\fR" 4 .IX Item "-w" on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, \fIN\fR, \fIS\fR, \fIE\fR, \&\fIW\fR). .IP "\fB\-p\fR" 4 .IX Item "-p" set the output precision to \fIprec\fR (default 6). \fIprec\fR is the number of digits after the decimal point for lengths (in meters). For latitudes, longitudes, and azimuths (in degrees), the number of digits after the decimal point is \fIprec\fR + 5. For the scale, the number of digits after the decimal point is \fIprec\fR + 6. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 4 \& echo 48.648 \-2.007 | GeodesicProj \-c 48.836 2.337 \& => \-319919 \-11791 86.7 0.999 \& echo \-319919 \-11791 | GeodesicProj \-c 48.836 2.337 \-r \& => 48.648 \-2.007 86.7 0.999 .Ve .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBGeodesicProj\fR to return an exit code of 1. However, an error does not cause \fBGeodesicProj\fR to terminate; following lines will be converted. .SH "SEE ALSO" .IX Header "SEE ALSO" The ellipsoidal gnomonic projection is derived in Section 8 of C. F. F. Karney, \fIAlgorithms for geodesics\fR, J. Geodesy 87, 43\-55 (2013); \s-1DOI \&\s0; addenda: . .SH "AUTHOR" .IX Header "AUTHOR" \&\fBGeodesicProj\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBGeodesicProj\fR was added to GeographicLib, , in 2009\-08. Prior to version 1.9 it was called EquidistantTest. GeographicLib-1.45/man/CartConvert.pod0000644000771000077100000001122212602735126017533 0ustar ckarneyckarney=head1 NAME CartConvert -- convert geodetic coordinates to geocentric or local cartesian =head1 SYNOPSIS B [ B<-r> ] [ B<-l> I I I ] [ B<-e> I I ] [ B<-w> ] [ B<-p> prec ] [ B<--comment-delimiter> I ] [ B<--version> | B<-h> | B<--help> ] [ B<--input-file> I | B<--input-string> I ] [ B<--line-separator> I ] [ B<--output-file> I ] =head1 DESCRIPTION Convert geodetic coordinates to either geocentric or local cartesian coordinates. Geocentric coordinates have the origin at the center of the earth, with the I axis going thru the north pole, and the I axis thru I = 0, I = 0. By default, the conversion is to geocentric coordinates. Specifying B<-l> I I I causes a local coordinate system to be used with the origin at I = I, I = I, I = I, I normal to the ellipsoid and I due north. Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) I, I (decimal degrees or degrees, minutes and seconds), and I above the ellipsoid (meters); for details on the allowed formats for latitude and longitude, see the C section of GeoConvert(1). For each set of geodetic coordinates, the corresponding cartesian coordinates I, I, I (meters) are printed on standard output. =head1 OPTIONS =over =item B<-r> perform the reverse projection. I, I, I are given on standard input and each line of standard output gives I, I, I. =item B<-l> specifies conversions to and from a local cartesion coordinate systems with origin I I I, instead of a geocentric coordinate system. The B<-w> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before B<-l>. =item B<-e> specify the ellipsoid via I I; the equatorial radius is I and the flattening is I. Setting I = 0 results in a sphere. Specify I E 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for I. By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<-w> on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, I, I, I, I). =item B<-p> set the output precision to I (default 6). I is the number of digits after the decimal point for geocentric and local cartesion coordinates and for the height (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is I + 5. =item B<--comment-delimiter> set the comment delimiter to I (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). =item B<--version> print version and exit. =item B<-h> print usage and exit. =item B<--help> print full documentation and exit. =item B<--input-file> read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> read input from the string I instead of from standard input. All occurrences of the line separator character (default is a semicolon) in I are converted to newlines before the reading begins. =item B<--line-separator> set the line separator character to I. By default this is a semicolon. =item B<--output-file> write output to the file I instead of to standard output; a file name of "-" stands for standard output. =back =head1 EXAMPLES echo 33.3 44.4 6000 | CartConvert => 3816209.60 3737108.55 3485109.57 echo 33.3 44.4 6000 | CartConvert -l 33 44 20 => 37288.97 33374.29 5783.64 echo 30000 30000 0 | CartConvert -r => 6.483 45 -6335709.73 =head1 ERRORS An illegal line of input will print an error message to standard output beginning with C and causes B to return an exit code of 1. However, an error does not cause B to terminate; following lines will be converted. =head1 SEE ALSO The algorithm for converting geocentric to geodetic coordinates is given in Appendix B of C. F. F. Karney, I, Feb. 2011; preprint L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in 2009-02. Prior to 2009-03 it was called ECEFConvert. GeographicLib-1.45/man/TransverseMercatorProj.10000644000771000077100000002466312602735167021365 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "TRANSVERSEMERCATORPROJ 1" .TH TRANSVERSEMERCATORPROJ 1 "2015-09-30" "GeographicLib 1.45" "GeographicLib Utilities" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" TransverseMercatorProj \-\- perform transverse Mercator projection .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBTransverseMercatorProj\fR [ \fB\-s\fR | \fB\-t\fR ] [ \fB\-l\fR \fIlon0\fR ] [ \fB\-k\fR \fIk0\fR ] [ \fB\-r\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-w\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-\-comment\-delimiter\fR \fIcommentdelim\fR ] [ \fB\-\-version\fR | \fB\-h\fR | \fB\-\-help\fR ] [ \fB\-\-input\-file\fR \fIinfile\fR | \fB\-\-input\-string\fR \fIinstring\fR ] [ \fB\-\-line\-separator\fR \fIlinesep\fR ] [ \fB\-\-output\-file\fR \fIoutfile\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Perform the transverse Mercator projections. Convert geodetic coordinates to transverse Mercator coordinates. The central meridian is given by \fIlon0\fR. The longitude of origin is the equator. The scale on the central meridian is \fIk0\fR. By default an implementation of the exact transverse Mercator projection is used. .PP Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) \fIlatitude\fR and \fIlongitude\fR (decimal degrees or degrees, minutes, seconds); for detils on the allowed formats for latitude and longitude, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fIGeoConvert\fR\|(1). For each set of geodetic coordinates, the corresponding projected easting, \fIx\fR, and northing, \fIy\fR, (meters) are printed on standard output together with the meridian convergence \&\fIgamma\fR (degrees) and scale \fIk\fR. The meridian convergence is the bearing of the \fIy\fR axis measured clockwise from true north. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-s\fR" 4 .IX Item "-s" use the sixth-order Krueger series approximation to the transverse Mercator projection instead of the exact projection. .IP "\fB\-t\fR" 4 .IX Item "-t" use the exact algorithm with the \*(L"\s-1EXTENDED DOMAIN\*(R"\s0. .IP "\fB\-l\fR" 4 .IX Item "-l" specify the longitude of origin \fIlon0\fR (degrees, default 0). .IP "\fB\-k\fR" 4 .IX Item "-k" specify the scale \fIk0\fR on the central meridian (default 0.9996). .IP "\fB\-r\fR" 4 .IX Item "-r" perform the reverse projection. \fIx\fR and \fIy\fR are given on standard input and each line of standard output gives \fIlatitude\fR, \fIlongitude\fR, \&\fIgamma\fR, and \fIk\fR. .IP "\fB\-e\fR" 4 .IX Item "-e" specify the ellipsoid via \fIa\fR \fIf\fR; the equatorial radius is \fIa\fR and the flattening is \fIf\fR. Setting \fIf\fR = 0 results in a sphere. Specify \&\fIf\fR < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for \fIf\fR. By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563. If the exact algorithm is used, \fIf\fR must be positive. .IP "\fB\-w\fR" 4 .IX Item "-w" on input and output, longitude precedes latitude (except that on input this can be overridden by a hemisphere designator, \fIN\fR, \fIS\fR, \fIE\fR, \&\fIW\fR). .IP "\fB\-p\fR" 4 .IX Item "-p" set the output precision to \fIprec\fR (default 6). \fIprec\fR is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is \fIprec\fR + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is \fIprec\fR + 6. .IP "\fB\-\-comment\-delimiter\fR" 4 .IX Item "--comment-delimiter" set the comment delimiter to \fIcommentdelim\fR (e.g., \*(L"#\*(R" or \*(L"//\*(R"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space). .IP "\fB\-\-version\fR" 4 .IX Item "--version" print version and exit. .IP "\fB\-h\fR" 4 .IX Item "-h" print usage and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" print full documentation and exit. .IP "\fB\-\-input\-file\fR" 4 .IX Item "--input-file" read input from the file \fIinfile\fR instead of from standard input; a file name of \*(L"\-\*(R" stands for standard input. .IP "\fB\-\-input\-string\fR" 4 .IX Item "--input-string" read input from the string \fIinstring\fR instead of from standard input. All occurrences of the line separator character (default is a semicolon) in \fIinstring\fR are converted to newlines before the reading begins. .IP "\fB\-\-line\-separator\fR" 4 .IX Item "--line-separator" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR" 4 .IX Item "--output-file" write output to the file \fIoutfile\fR instead of to standard output; a file name of \*(L"\-\*(R" stands for standard output. .SH "EXTENDED DOMAIN" .IX Header "EXTENDED DOMAIN" The exact transverse Mercator projection has a \fIbranch point\fR on the equator at longitudes (relative to \fIlon0\fR) of +/\- (1 \- \fIe\fR) 90, where \&\fIe\fR is the eccentricity of the ellipsoid. The standard convention for handling this branch point is to map positive (negative) latitudes into positive (negative) northings \fIy\fR; i.e., a branch cut is placed on the equator. With the \fIextended\fR domain, the northern sheet of the projection is extended into the south hemisphere by pushing the branch cut south from the branch points. See the reference below for details. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 4 \& echo 0 90 | TransverseMercatorProj \& => 25953592.84 9997964.94 90 18.40 \& echo 260e5 100e5 | TransverseMercatorProj \-r \& => \-0.02 90.00 90.01 18.48 .Ve .SH "ERRORS" .IX Header "ERRORS" An illegal line of input will print an error message to standard output beginning with \f(CW\*(C`ERROR:\*(C'\fR and causes \fBTransverseMercatorProj\fR to return an exit code of 1. However, an error does not cause \fBTransverseMercatorProj\fR to terminate; following lines will be converted. .SH "AUTHOR" .IX Header "AUTHOR" \&\fBTransverseMercatorProj\fR was written by Charles Karney. .SH "SEE ALSO" .IX Header "SEE ALSO" The algorithms for the transverse Mercator projection are described in C. F. F. Karney, \fITransverse Mercator with an accuracy of a few nanometers\fR, J. Geodesy \fB85\fR(8), 475\-485 (Aug. 2011); \s-1DOI \&\s0; preprint . The explanation of the extended domain of the projection with the \fB\-t\fR option is given in Section 5 of this paper. .SH "HISTORY" .IX Header "HISTORY" \&\fBTransverseMercatorProj\fR was added to GeographicLib, , in 2009\-01. Prior to version 1.9 it was called TransverseMercatorTest (and its interface was slightly different). GeographicLib-1.45/man/dummy.usage.in0000644000771000077100000000044112602735126017364 0ustar ckarneyckarney// Dummy usage file to be used when the man page isn't available int usage(int retval, bool /* brief */) { ( retval ? std::cerr : std::cout ) << "For full documentation on @TOOL@, see\n" << " http://geographiclib.sf.net/@PROJECT_VERSION@/@TOOL@.1.html\n"; return retval; } GeographicLib-1.45/man/GeoConvert.usage0000644000771000077100000003761312602735167017717 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -z zone | -s | -t ] [ -n ]\n" " [ -w ] [ -p prec ] [ -l | -a ] [ --comment-delimiter commentdelim ] [\n" " --version | -h | --help ] [ --input-file infile | --input-string\n" " instring ] [ --line-separator linesep ] [ --output-file outfile ]\n" "\n" "For full documentation type:\n" " GeoConvert --help\n" "or visit:\n" " http://geographiclib.sf.net/1.45/GeoConvert.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " GeoConvert -- convert geographic coordinates\n" "\n" "SYNOPSIS\n" " GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -z zone | -s | -t ] [ -n ]\n" " [ -w ] [ -p prec ] [ -l | -a ] [ --comment-delimiter commentdelim ] [\n" " --version | -h | --help ] [ --input-file infile | --input-string\n" " instring ] [ --line-separator linesep ] [ --output-file outfile ]\n" "\n" "DESCRIPTION\n" " GeoConvert reads from standard input interpreting each line as a\n" " geographic coordinate and prints the coordinate in the format specified\n" " by the options on standard output. The input is interpreted in one of\n" " three different ways depending on how many space or comma delimited\n" " tokens there are on the line. The options -g, -d, -u, and -m govern\n" " the format of output. In all cases, the WGS84 model of the earth is\n" " used (a = 6378137 m, f = 1/298.257223563).\n" "\n" " geographic\n" " 2 tokens (output options -g, -d, or -:) given as latitude longitude\n" " using decimal degrees or degrees, minutes, and seconds. Latitude\n" " is given first (unless the -w option is given). See \"GEOGRAPHIC\n" " COORDINATES\" for a description of the format. For example, the\n" " following are all equivalent\n" "\n" " 33.3 44.4\n" " E44.4 N33.3\n" " 33d18'N 44d24'E\n" " 44d24 33d18N\n" " 33:18 +44:24\n" "\n" " UTM/UPS\n" " 3 tokens (output option -u) given as zone+hemisphere easting\n" " northing or easting northing zone+hemisphere, where hemisphere is\n" " either n (or north) or s (or south). The zone is absent for a UPS\n" " specification. For example,\n" "\n" " 38n 444140.54 3684706.36\n" " 444140.54 3684706.36 38n\n" " s 2173854.98 2985980.58\n" " 2173854.98 2985980.58 s\n" "\n" " MRGS\n" " 1 token (output option -m) is used to specify the center of an MGRS\n" " grid square. For example,\n" "\n" " 38SMB4484\n" " 38SMB44140847064\n" "\n" "OPTIONS\n" " -g output latitude and longitude using decimal degrees. Default\n" " output mode.\n" "\n" " -d output latitude and longitude using degrees, minutes, and seconds\n" " (DMS).\n" "\n" " -: like -d, except use : as a separator instead of the d, ', and \"\n" " delimiters.\n" "\n" " -u output UTM or UPS.\n" "\n" " -m output MGRS.\n" "\n" " -c output meridian convergence and scale for the corresponding UTM or\n" " UPS projection. Convergence is the bearing of grid north given as\n" " degrees clockwise from true north.\n" "\n" " -z set the zone to zone for output. Use either 0 < zone <= 60 for a\n" " UTM zone or zone = 0 for UPS. Alternatively use a zone+hemisphere\n" " designation, e.g., 38n. See \"ZONE\".\n" "\n" " -s use the standard UPS and UTM zones.\n" "\n" " -t similar to -s but forces UPS regions to the closest UTM zone.\n" "\n" " -n on input, MGRS coordinates refer to the south-west corner of the\n" " MGRS square instead of the center; see \"MGRS\".\n" "\n" " -w on input and output, longitude precedes latitude (except that, on\n" " input, this can be overridden by a hemisphere designator, N, S, E,\n" " W).\n" "\n" " -p set the output precision to prec (default 0); prec is the precision\n" " relative to 1 m. See \"PRECISION\".\n" "\n" " -l on output, UTM/UPS uses the long forms north and south to designate\n" " the hemisphere instead of n or s.\n" "\n" " -a on output, UTM/UPS uses the abbreviations n and s to designate the\n" " hemisphere instead of north or south; this is the default\n" " representation.\n" "\n" " --comment-delimiter\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "PRECISION\n" " prec gives precision of the output with prec = 0 giving 1 m precision,\n" " prec = 3 giving 1 mm precision, etc. prec is the number of digits\n" " after the decimal point for UTM/UPS. The number of digits per\n" " coordinate for MGRS is 5 + prec. For decimal degrees, the number of\n" " digits after the decimal point is 5 + prec. For DMS (degree, minute,\n" " seconds) output, the number of digits after the decimal point in the\n" " seconds components is 1 + prec; if this is negative then use minutes\n" " (prec = -2 or -3) or degrees (prec <= -4) as the least significant\n" " component. Print convergence, resp. scale, with 5 + prec, resp. 7 +\n" " prec, digits after the decimal point. The minimum value of prec is -5\n" " and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS, 6\n" " for MGRS, and 8 for convergence and scale.\n" "\n" "GEOGRAPHIC COORDINATES\n" " The utility accepts geographic coordinates, latitude and longitude, in\n" " a number of common formats. Latitude precedes longitude, unless the -w\n" " option is given which switches this convention. On input, either\n" " coordinate may be given first by appending or prepending N or S to the\n" " latitude and E or W to the longitude. These hemisphere designators\n" " carry an implied sign, positive for N and E and negative for S and W.\n" " This sign multiplies any +/- sign prefixing the coordinate. The\n" " coordinates may be given as decimal degree or as degrees, minutes, and\n" " seconds. d, ', and \" are used to denote degrees, minutes, and seconds,\n" " with the least significant designator optional. (See \"QUOTING\" for how\n" " to quote the characters ' and \" when entering coordinates on the\n" " command line.) Alternatively, : (colon) may be used to separate the\n" " various components. Only the final component of coordinate can include\n" " a decimal point, and the minutes and seconds components must be less\n" " than 60.\n" "\n" " It is also possible to carry out addition or subtraction operations in\n" " geographic coordinates. If the coordinate includes interior signs\n" " (i.e., not at the beginning or immediately after an initial hemisphere\n" " designator), then the coordinate is split before such signs; the pieces\n" " are parsed separately and the results summed. For example the point\n" " 15\" east of 39N 70W is\n" "\n" " 39N 70W+0:0:15E\n" "\n" " WARNING: \"Exponential\" notation is not recognized for geographic\n" " coordinates; instead 7.0E+1 is parsed as (7.0E) + (+1), yielding the\n" " same result as 8.0E.\n" "\n" " Various unicode characters (encoded with UTF-8) may also be used to\n" " denote degrees, minutes, and seconds, e.g., the degree, prime, and\n" " double prime symbols; in addition two single quotes can be used to\n" " represent \".\n" "\n" " The other GeographicLib utilities use the same rules for interpreting\n" " geographic coordinates; in addition, azimuths and arc lengths are\n" " interpreted the same way.\n" "\n" "QUOTING\n" " Unfortunately the characters ' and \" have special meanings in many\n" " shells and have to be entered with care. However note (1) that the\n" " trailing designator is optional and that (2) you can use colons as a\n" " separator character. Thus 10d20' can be entered as 10d20 or 10:20 and\n" " 10d20'30\" can be entered as 10:20:30.\n" "\n" " Unix shells (sh, bash, tsch)\n" " The characters ' and \" can be quoted by preceding them with a \\\n" " (backslash); or you can quote a string containing ' with a pair of\n" " \"s. The two alternatives are illustrated by\n" "\n" " echo 10d20\\'30\\\" \"20d30'40\" | GeoConvert -d -p -1\n" " => 10d20'30\"N 020d30'40\"E\n" "\n" " Quoting of command line arguments is similar\n" "\n" " GeoConvert -d -p -1 --input-string \"10d20'30\\\" 20d30'40\"\n" " => 10d20'30\"N 020d30'40\"E\n" "\n" " Windows command shell (cmd)\n" " The ' character needs no quoting; the \" character can either be\n" " quoted by a ^ or can be represented by typing ' twice. (This\n" " quoting is usually unnecessary because the trailing designator can\n" " be omitted.) Thus\n" "\n" " echo 10d20'30'' 20d30'40 | GeoConvert -d -p -1\n" " => 10d20'30\"N 020d30'40\"E\n" "\n" " Use \\ to quote the \" character in a command line argument\n" "\n" " GeoConvert -d -p -1 --input-string \"10d20'30\\\" 20d30'40\"\n" " => 10d20'30\"N 020d30'40\"E\n" "\n" " Input from a file\n" " No quoting need be done if the input from a file. Thus each line\n" " of the file \"input.txt\" should just contain the plain coordinates.\n" "\n" " GeoConvert -d -p -1 < input.txt\n" "\n" "MGRS\n" " MGRS coordinates represent a square patch of the earth, thus\n" " \"38SMB4488\" is in zone \"38n\" with 444km <= easting < 445km and 3688km\n" " <= northing < 3689km. Consistent with this representation, coordinates\n" " are truncated (instead of rounded) to the requested precision.\n" " Similarly, on input an MGRS coordinate represents the center of the\n" " square (\"38n 444500 3688500\" in the example above). However, if the -n\n" " option is given then the south-west corner of the square is returned\n" " instead (\"38n 444000 3688000\" in the example above).\n" "\n" "ZONE\n" " If the input is geographic, GeoConvert uses the standard rules of\n" " selecting UTM vs UPS and for assigning the UTM zone (with the Norway\n" " and Svalbard exceptions). If the input is UTM/UPS or MGRS, then the\n" " choice between UTM and UPS and the UTM zone mirrors the input. The -z\n" " zone, -s, and -t options allow these rules to be overridden with zone =\n" " 0 being used to indicate UPS. For example, the point\n" "\n" " 79.9S 6.1E\n" "\n" " corresponds to possible MGRS coordinates\n" "\n" " 32CMS4324728161 (standard UTM zone = 32)\n" " 31CEM6066227959 (neighboring UTM zone = 31)\n" " BBZ1945517770 (neighboring UPS zone)\n" "\n" " then\n" "\n" " echo 79.9S 6.1E | GeoConvert -p -3 -m => 32CMS4328\n" " echo 31CEM6066227959 | GeoConvert -p -3 -m => 31CEM6027\n" " echo 31CEM6066227959 | GeoConvert -p -3 -m -s => 32CMS4328\n" " echo 31CEM6066227959 | GeoConvert -p -3 -m -z 0 => BBZ1917\n" "\n" " Is zone is specified with a hemisphere, then this is honored when\n" " printing UTM coordinates:\n" "\n" " echo -1 3 | GeoConvert -u => 31s 500000 9889470\n" " echo -1 3 | GeoConvert -u -z 31 => 31s 500000 9889470\n" " echo -1 3 | GeoConvert -u -z 31s => 31s 500000 9889470\n" " echo -1 3 | GeoConvert -u -z 31n => 31n 500000 -110530\n" "\n" " NOTE: the letter in the zone specification for UTM is a hemisphere\n" " designator n or s and not an MGRS latitude band letter. Convert the\n" " MGRS latitude band letter to a hemisphere as follows: replace C thru M\n" " by s (or south); replace N thru X by n (or north).\n" "\n" "EXAMPLES\n" " echo 38SMB4488 | GeoConvert => 33.33424 44.40363\n" " echo 38SMB4488 | GeoConvert -: -p 1 => 33:20:03.25N 044:2413.06E\n" " echo 38SMB4488 | GeoConvert -u => 38n 444500 3688500\n" " echo E44d24 N33d20 | GeoConvert -m -p -3 => 38SMB4488\n" "\n" " GeoConvert can be used to do simple arithmetic using degree, minutes,\n" " and seconds. For example, sometimes data is tiled in 15 second squares\n" " tagged by the DMS representation of the SW corner. The tags of the\n" " tile at 38:59:45N 077:02:00W and its 8 neighbors are then given by\n" "\n" " t=0:0:15\n" " for y in -$t +0 +$t; do\n" " for x in -$t +0 +$t; do\n" " echo 38:59:45N$y 077:02:00W$x\n" " done\n" " done | GeoConvert -: -p -1 | tr -d ': '\n" " =>\n" " 385930N0770215W\n" " 385930N0770200W\n" " 385930N0770145W\n" " 385945N0770215W\n" " 385945N0770200W\n" " 385945N0770145W\n" " 390000N0770215W\n" " 390000N0770200W\n" " 390000N0770145W\n" "\n" "ERRORS\n" " An illegal line of input will print an error message to standard output\n" " beginning with \"ERROR:\" and causes GeoConvert to return an exit code of\n" " 1. However, an error does not cause GeoConvert to terminate; following\n" " lines will be converted.\n" "\n" "ABBREVIATIONS\n" " UTM Universal Transverse Mercator,\n" " .\n" "\n" " UPS Universal Polar Stereographic,\n" " .\n" "\n" " MGRS\n" " Military Grid Reference System,\n" " .\n" "\n" " WGS84\n" " World Geodetic System 1984, .\n" "\n" "SEE ALSO\n" " An online version of this utility is availbable at\n" " .\n" "\n" " The algorithms for the transverse Mercator projection are described in\n" " C. F. F. Karney, Transverse Mercator with an accuracy of a few\n" " nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); DOI\n" " ; preprint\n" " .\n" "\n" "AUTHOR\n" " GeoConvert was written by Charles Karney.\n" "\n" "HISTORY\n" " GeoConvert was added to GeographicLib, ,\n" " in 2009-01.\n" ; return retval; } GeographicLib-1.45/man/dummy.1.html.in0000644000771000077100000000123012602735126017360 0ustar ckarneyckarney @TOOL@ -- a GeographicLib utility GeographicLib-1.45/man/TransverseMercatorProj.1.html0000644000771000077100000001661512602735167022326 0ustar ckarneyckarney TransverseMercatorProj(1)

NAME

TransverseMercatorProj -- perform transverse Mercator projection

SYNOPSIS

TransverseMercatorProj [ -s | -t ] [ -l lon0 ] [ -k k0 ] [ -r ] [ -e a f ] [ -w ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]

DESCRIPTION

Perform the transverse Mercator projections. Convert geodetic coordinates to transverse Mercator coordinates. The central meridian is given by lon0. The longitude of origin is the equator. The scale on the central meridian is k0. By default an implementation of the exact transverse Mercator projection is used.

Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) latitude and longitude (decimal degrees or degrees, minutes, seconds); for detils on the allowed formats for latitude and longitude, see the GEOGRAPHIC COORDINATES section of GeoConvert(1). For each set of geodetic coordinates, the corresponding projected easting, x, and northing, y, (meters) are printed on standard output together with the meridian convergence gamma (degrees) and scale k. The meridian convergence is the bearing of the y axis measured clockwise from true north.

OPTIONS

-s

use the sixth-order Krueger series approximation to the transverse Mercator projection instead of the exact projection.

-t

use the exact algorithm with the "EXTENDED DOMAIN".

-l

specify the longitude of origin lon0 (degrees, default 0).

-k

specify the scale k0 on the central meridian (default 0.9996).

-r

perform the reverse projection. x and y are given on standard input and each line of standard output gives latitude, longitude, gamma, and k.

-e

specify the ellipsoid via a f; the equatorial radius is a and the flattening is f. Setting f = 0 results in a sphere. Specify f < 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for f. By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563. If the exact algorithm is used, f must be positive.

-w

on input and output, longitude precedes latitude (except that on input this can be overridden by a hemisphere designator, N, S, E, W).

-p

set the output precision to prec (default 6). prec is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is prec + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is prec + 6.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.

EXTENDED DOMAIN

The exact transverse Mercator projection has a branch point on the equator at longitudes (relative to lon0) of +/- (1 - e) 90, where e is the eccentricity of the ellipsoid. The standard convention for handling this branch point is to map positive (negative) latitudes into positive (negative) northings y; i.e., a branch cut is placed on the equator. With the extended domain, the northern sheet of the projection is extended into the south hemisphere by pushing the branch cut south from the branch points. See the reference below for details.

EXAMPLES

   echo 0 90 | TransverseMercatorProj
   => 25953592.84 9997964.94 90 18.40
   echo 260e5 100e5 | TransverseMercatorProj -r
   => -0.02 90.00 90.01 18.48

ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes TransverseMercatorProj to return an exit code of 1. However, an error does not cause TransverseMercatorProj to terminate; following lines will be converted.

AUTHOR

TransverseMercatorProj was written by Charles Karney.

SEE ALSO

The algorithms for the transverse Mercator projection are described in C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); DOI https://dx.doi.org/10.1007/s00190-011-0445-3; preprint http://arxiv.org/abs/1002.1417. The explanation of the extended domain of the projection with the -t option is given in Section 5 of this paper.

HISTORY

TransverseMercatorProj was added to GeographicLib, http://geographiclib.sf.net, in 2009-01. Prior to version 1.9 it was called TransverseMercatorTest (and its interface was slightly different).

GeographicLib-1.45/man/Makefile.am0000644000771000077100000000720712602735126016641 0ustar ckarneyckarney# # Makefile.am # # Copyright (C) 2011, Charles Karney USAGE = \ CartConvert.usage \ ConicProj.usage \ GeodesicProj.usage \ GeoConvert.usage \ GeodSolve.usage \ GeoidEval.usage \ Gravity.usage \ MagneticField.usage \ Planimeter.usage \ RhumbSolve.usage \ TransverseMercatorProj.usage MANPAGES = \ CartConvert.1 \ ConicProj.1 \ GeodesicProj.1 \ GeoConvert.1 \ GeodSolve.1 \ GeoidEval.1 \ Gravity.1 \ MagneticField.1 \ Planimeter.1 \ RhumbSolve.1 \ TransverseMercatorProj.1 HTMLMAN = \ CartConvert.1.html \ ConicProj.1.html \ GeodesicProj.1.html \ GeoConvert.1.html \ GeodSolve.1.html \ GeoidEval.1.html \ Gravity.1.html \ MagneticField.1.html \ Planimeter.1.html \ RhumbSolve.1.html \ TransverseMercatorProj.1.html SYSMANPAGES = geographiclib-get-geoids.8 \ geographiclib-get-gravity.8 \ geographiclib-get-magnetic.8 POD2MAN = pod2man --center="GeographicLib Utilities" \ --release="$(PACKAGE_STRING)" PODFIX = sed -e 's%%%' -e 's%\([^<>]*\)(\(.\))%&%'g man1_MANS = $(MANPAGES) man8_MANS = $(SYSMANPAGES) SUFFIXES = .pod .1 .usage .1.html .8 all: man man: manpages usage htmlman sysmanpages manpages: $(MANPAGES) usage: $(USAGE) htmlman: $(HTMLMAN) sysmanpages: $(SYSMANPAGES) if HAVE_PODPROGS .pod.usage: sh $(srcdir)/makeusage.sh $< $(VERSION) > $@ .pod.1: $(POD2MAN) $^ > $@ .pod.1.html: pod2html --noindex --title "$*(1)" $^ | $(PODFIX) > $@ else USAGECMD = cat $(srcdir)/$@ 2> /dev/null || \ sed -e "s/@TOOL@/$*/g" -e "s/@PROJECT_VERSION@/$(VERSION)/g" \ $(srcdir)/dummy.usage.in > $@ MANCMD = cat $(srcdir)/$@ 2> /dev/null || \ sed -e "s/@TOOL@/$*/g" -e "s/@PROJECT_VERSION@/$(VERSION)/g" \ $(srcdir)/dummy.1.in > $@ HTMLCMD = cat $(srcdir)/$@ 2> /dev/null || \ sed -e "s/@TOOL@/$*/g" -e "s/@PROJECT_VERSION@/$(VERSION)/g" \ $(srcdir)/dummy.1.html.in > $@ CartConvert.usage: $(USAGECMD) ConicProj.usage: $(USAGECMD) GeodesicProj.usage: $(USAGECMD) GeoConvert.usage: $(USAGECMD) GeodSolve.usage: $(USAGECMD) GeoidEval.usage: $(USAGECMD) Gravity.usage: $(USAGECMD) MagneticField.usage: $(USAGECMD) Planimeter.usage: $(USAGECMD) RhumbSolve.usage: $(USAGECMD) TransverseMercatorProj.usage: $(USAGECMD) CartConvert.1: $(MANCMD) ConicProj.1: $(MANCMD) GeodesicProj.1: $(MANCMD) GeoConvert.1: $(MANCMD) GeodSolve.1: $(MANCMD) GeoidEval.1: $(MANCMD) Gravity.1: $(MANCMD) MagneticField.1: $(MANCMD) Planimeter.1: $(MANCMD) RhumbSolve.1: $(MANCMD) TransverseMercatorProj.1: $(MANCMD) CartConvert.1.html: $(HTMLCMD) ConicProj.1.html: $(HTMLCMD) GeodesicProj.1.html: $(HTMLCMD) GeoConvert.1.html: $(HTMLCMD) GeodSolve.1.html: $(HTMLCMD) GeoidEval.1.html: $(HTMLCMD) Gravity.1.html: $(HTMLCMD) MagneticField.1.html: $(HTMLCMD) Planimeter.1.html: $(HTMLCMD) RhumbSolve.1.html: $(HTMLCMD) TransverseMercatorProj.1.html: $(HTMLCMD) endif geographiclib_data = $(datadir)/GeographicLib SCRIPTMANCMD = sed -e "s/@SCRIPT@/$*/g" \ -e "s/@DATA@/`echo $* | cut -f3 -d-`/g" \ -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%g" \ $(srcdir)/script.8.in > $@ geographiclib-get-geoids.8: $(SCRIPTMANCMD) geographiclib-get-gravity.8: $(SCRIPTMANCMD) geographiclib-get-magnetic.8: $(SCRIPTMANCMD) EXTRA_DIST = Makefile.mk CMakeLists.txt makeusage.sh \ GeoConvert.pod TransverseMercatorProj.pod \ CartConvert.pod ConicProj.pod GeodSolve.pod GeodesicProj.pod \ GeoidEval.pod Gravity.pod MagneticField.pod Planimeter.pod \ RhumbSolve.pod $(MANPAGES) $(USAGE) $(HTMLMAN) \ dummy.usage.in dummy.1.in dummy.1.html.in script.8.in maintainer-clean-local: rm -rf *.usage *.1.html *.1 *.8 GeographicLib-1.45/man/Makefile.mk0000644000771000077100000000101512602735126016642 0ustar ckarneyckarneyPROGRAMS = CartConvert \ ConicProj \ GeoConvert \ GeodSolve \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ RhumbSolve \ TransverseMercatorProj MANPAGES = $(addsuffix .1,$(PROGRAMS)) USAGE = $(addsuffix .usage,$(PROGRAMS)) HTMLMAN = $(addsuffix .1.html,$(PROGRAMS)) PREFIX = /usr/local DEST = $(PREFIX)/share/man/man1 all: $(MANPAGES) $(USAGE) $(HTMLMAN) INSTALL = install -b install: test -d $(DEST) || mkdir -p $(DEST) $(INSTALL) -m 644 $(MANPAGES) $(DEST)/ .PHONY: all install clean GeographicLib-1.45/man/GeoidEval.1.html0000644000771000077100000003231312602735167017472 0ustar ckarneyckarney GeoidEval(1)

NAME

GeoidEval -- look up geoid heights

SYNOPSIS

GeoidEval [ -n name ] [ -d dir ] [ -l ] [ -a | -c south west north east ] [ -w ] [ -z zone ] [ --msltohae ] [ --haetomsl ] [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]

DESCRIPTION

GeoidEval reads in positions on standard input and prints out the corresponding heights of the geoid above the WGS84 ellipsoid on standard output.

Positions are given as latitude and longitude, UTM/UPS, or MGRS, in any of the formats accepted by GeoConvert(1). (MGRS coordinates signify the center of the corresponding MGRS square.) If the -z option is specified then the specified zone is prepended to each line of input (which must be in UTM/UPS coordinates). This allows a file with UTM eastings and northings in a single zone to be used as standard input.

More accurate results for the geoid height are provided by Gravity(1). This utility can also compute the direction of gravity accurately.

The height of the geoid above the ellipsoid, N, is sometimes called the geoid undulation. It can be used to convert a height above the ellipsoid, h, to the corresponding height above the geoid (the orthometric height, roughly the height above mean sea level), H, using the relations

    h = N + H,   H = -N + h.

OPTIONS

-n

use geoid name instead of the default egm96-5. See "GEOIDS".

-d

read geoid data from dir instead of the default. See "GEOIDS".

-l

use bilinear interpolation instead of cubic. See "INTERPOLATION".

-a

cache the entire data set in memory. See "CACHE".

-c

cache the data bounded by south west north east in memory. The first two arguments specify the SW corner of the cache and the last two arguments specify the NE corner. The -w flag specifies that longitude precedes latitude for these corners, provided that it appears before -c. See "CACHE".

-w

when reading geographic coordinates, longitude precedes latitude (this can be overridden by a hemisphere designator, N, S, E, W).

-z

prefix each line of input by zone, e.g., 38n. This should be used when the input consists of UTM/UPS eastings and northings.

--msltohae

standard input should include a final token on each line which is treated as a height (in meters) above the geoid and the output echoes the input line with the height converted to height above ellipsoid (HAE). If -z zone is specified then the third token is treated as the height; this makes it possible to convert LIDAR data where each line consists of: easting northing height intensity.

--haetomsl

this is similar to --msltohae except that the height token is treated as a height (in meters) above the ellipsoid and the output echoes the input line with the height converted to height above the geoid (MSL).

-v

print information about the geoid on standard error before processing the input.

--comment-delimiter

set the comment delimiter to commentdelim (e.g., "#" or "//"). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).

--version

print version and exit.

-h

print usage, the default geoid path and name, and exit.

--help

print full documentation and exit.

--input-file

read input from the file infile instead of from standard input; a file name of "-" stands for standard input.

--input-string

read input from the string instring instead of from standard input. All occurrences of the line separator character (default is a semicolon) in instring are converted to newlines before the reading begins.

--line-separator

set the line separator character to linesep. By default this is a semicolon.

--output-file

write output to the file outfile instead of to standard output; a file name of "-" stands for standard output.

GEOIDS

GeoidEval computes geoid heights by interpolating on the data in a regularly spaced table (see "INTERPOLATION"). The following geoid tables are available (however, some may not be installed):

                                  bilinear error    cubic error
   name         geoid    grid     max      rms      max      rms
   egm84-30     EGM84    30'      1.546 m  70 mm    0.274 m  14 mm
   egm84-15     EGM84    15'      0.413 m  18 mm    0.021 m  1.2 mm
   egm96-15     EGM96    15'      1.152 m  40 mm    0.169 m  7.0 mm
   egm96-5      EGM96     5'      0.140 m  4.6 mm   .0032 m  0.7 mm
   egm2008-5    EGM2008   5'      0.478 m  12 mm    0.294 m  4.5 mm
   egm2008-2_5  EGM2008   2.5'    0.135 m  3.2 mm   0.031 m  0.8 mm
   egm2008-1    EGM2008   1'      0.025 m  0.8 mm   .0022 m  0.7 mm

By default, the egm96-5 geoid is used. This may changed by setting the environment variable GEOGRAPHICLIB_GEOID_NAME or with the -n option. The errors listed here are estimates of the quantization and interpolation errors in the reported heights compared to the specified geoid.

The geoid data will be loaded from a directory specified at compile time. This may changed by setting the environment variables GEOGRAPHICLIB_GEOID_PATH or GEOGRAPHICLIB_DATA, or with the -d option. The -h option prints the default geoid path and name. Use the -v option to ascertain the full path name of the data file.

Instructions for downloading and installing geoid data are available at http://geographiclib.sf.net/html/geoid.html#geoidinst.

NOTE: all the geoids above apply to the WGS84 ellipsoid (a = 6378137 m, f = 1/298.257223563) only.

INTERPOLATION

Cubic interpolation is used to compute the geoid height unless -l is specified in which case bilinear interpolation is used. The cubic interpolation is based on a least-squares fit of a cubic polynomial to a 12-point stencil

   . 1 1 .
   1 2 2 1
   1 2 2 1
   . 1 1 .

The cubic is constrained to be independent of longitude when evaluating the height at one of the poles. Cubic interpolation is considerably more accurate than bilinear; however it results in small discontinuities in the returned height on cell boundaries.

CACHE

By default, the data file is randomly read to compute the geoid heights at the input positions. Usually this is sufficient for interactive use. If many heights are to be computed, use -c south west north east to notify GeoidEval to read a rectangle of data into memory; heights within the this rectangle can then be computed without any disk access. If -a is specified all the geoid data is read; in the case of egm2008-1, this requires about 0.5 GB of RAM. The evaluation of heights outside the cached area causes the necessary data to be read from disk. Use the -v option to verify the size of the cache.

Regardless of whether any cache is requested (with the -a or -c options), the data for the last grid cell in cached. This allows the geoid height along a continuous path to be returned with little disk overhead.

ENVIRONMENT

GEOGRAPHICLIB_GEOID_NAME

Override the compile-time default geoid name of egm96-5. The -h option reports the value of GEOGRAPHICLIB_GEOID_NAME, if defined, otherwise it reports the compile-time value. If the -n name option is used, then name takes precedence.

GEOGRAPHICLIB_GEOID_PATH

Override the compile-time default geoid path. This is typically /usr/local/share/GeographicLib/geoids on Unix-like systems and C:/ProgramData/GeographicLib/geoids on Windows systems. The -h option reports the value of GEOGRAPHICLIB_GEOID_PATH, if defined, otherwise it reports the compile-time value. If the -d dir option is used, then dir takes precedence.

GEOGRAPHICLIB_DATA

Another way of overriding the compile-time default geoid path. If it is set (and if GEOGRAPHICLIB_GEOID_PATH is not set), then $GEOGRAPHICLIB_DATA/geoids is used.

ERRORS

An illegal line of input will print an error message to standard output beginning with ERROR: and causes GeoidEval to return an exit code of 1. However, an error does not cause GeoidEval to terminate; following lines will be converted.

ABBREVIATIONS

The geoid is usually approximated by an "earth gravity model". The models published by the NGA are:

EGM84

An earth gravity model published by the NGA in 1984, http://earth-info.nga.mil/GandG/wgs84/gravitymod/wgs84_180/wgs84_180.html.

EGM96

An earth gravity model published by the NGA in 1996, http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html.

EGM2008

An earth gravity model published by the NGA in 2008, http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008.

WGS84

World Geodetic System 1984, https://en.wikipedia.org/wiki/WGS84.

HAE

Height above the WGS84 ellipsoid.

MSL

Mean sea level, used as a convenient short hand for the geoid. (However, typically, the geoid differs by a few meters from mean sea level.)

EXAMPLES

The height of the EGM96 geoid at Timbuktu

    echo 16:46:33N 3:00:34W | GeoidEval
    => 28.7068 -0.02e-6 -1.73e-6

The first number returned is the height of the geoid and the 2nd and 3rd are its slopes in the northerly and easterly directions.

Convert a point in UTM zone 18n from MSL to HAE

   echo 531595 4468135 23 | GeoidEval --msltohae -z 18n
   => 531595 4468135 -10.842

SEE ALSO

GeoConvert(1), Gravity(1), geographiclib-get-geoids(8).

An online version of this utility is availbable at http://geographiclib.sourceforge.net/cgi-bin/GeoidEval.

AUTHOR

GeoidEval was written by Charles Karney.

HISTORY

GeoidEval was added to GeographicLib, http://geographiclib.sf.net, in 2009-09.

GeographicLib-1.45/man/dummy.1.in0000644000771000077100000000044012602735126016417 0ustar ckarneyckarney.TH @TOOL@ 1 "" "GeographicLib Utilities" "GeographicLib Utilities" .SH NAME @TOOL@ \-\- a GeographicLib utility .SH DESCRIPTION .B @TOOL@ is part of GeographicLib, . For documentation, see .PP http://geographiclib.sf.net/@PROJECT_VERSION@/@TOOL@.1.html GeographicLib-1.45/man/MagneticField.pod0000644000771000077100000002113212602735126017775 0ustar ckarneyckarney=head1 NAME MagneticField -- compute the earth's magnetic field =head1 SYNOPSIS B [ B<-n> I ] [ B<-d> I ] [ B<-t> I

Online documentation for the @TOOL@ utility is available at
http://geographiclib.sourceforge.net/@PROJECT_VERSION@/@TOOL@.1.html.

You will be redirected there. Click on the link to go there directly.

The algorithm for converting geocentric to geodetic coordinates is given in Appendix B of C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint http://arxiv.org/abs/1102.1215.