123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- name="@PACKAGE_TARNAME@"
- version="@PACKAGE_VERSION@"
- show_usage()
- {
- echo "Usage: gmock-config [OPTIONS...]"
- }
- show_help()
- {
- show_usage
- cat <<\EOF
- The `gmock-config' script provides access to the necessary compile and linking
- flags to connect with Google C++ Mocking Framework, both in a build prior to
- installation, and on the system proper after installation. The installation
- overrides may be issued in combination with any other queries, but will only
- affect installation queries if called on a built but not installed gmock. The
- installation queries may not be issued with any other types of queries, and
- only one installation query may be made at a time. The version queries and
- compiler flag queries may be combined as desired but not mixed. Different
- version queries are always combined with logical "and" semantics, and only the
- last of any particular query is used while all previous ones ignored. All
- versions must be specified as a sequence of numbers separated by periods.
- Compiler flag queries output the union of the sets of flags when combined.
- Examples:
- gmock-config --min-version=1.0 || echo "Insufficient Google Mock version."
- g++ $(gmock-config --cppflags --cxxflags) -o foo.o -c foo.cpp
- g++ $(gmock-config --ldflags --libs) -o foo foo.o
-
- g++ $(../../my_gmock_build/scripts/gmock-config ...) ...
-
- export GMOCK_PREFIX="/opt"
- g++ $(gmock-config --libdir="/opt/lib64" ...) ...
- Help:
- --usage brief usage information
- --help display this help message
- Installation Overrides:
- --prefix=<dir> overrides the installation prefix
- --exec-prefix=<dir> overrides the executable installation prefix
- --libdir=<dir> overrides the library installation prefix
- --includedir=<dir> overrides the header file installation prefix
- Installation Queries:
- --prefix installation prefix
- --exec-prefix executable installation prefix
- --libdir library installation directory
- --includedir header file installation directory
- --version the version of the Google Mock installation
- Version Queries:
- --min-version=VERSION return 0 if the version is at least VERSION
- --exact-version=VERSION return 0 if the version is exactly VERSION
- --max-version=VERSION return 0 if the version is at most VERSION
- Compilation Flag Queries:
- --cppflags compile flags specific to the C-like preprocessors
- --cxxflags compile flags appropriate for C++ programs
- --ldflags linker flags
- --libs libraries for linking
- EOF
- }
- check_versions()
- {
- major_version=${version%%.*}
- minor_version="0"
- point_version="0"
- if test "${version#*.}" != "${version}"; then
- minor_version=${version
- minor_version=${minor_version%%.*}
- fi
- if test "${version#*.*.}" != "${version}"; then
- point_version=${version
- point_version=${point_version%%.*}
- fi
- min_version="$1"
- min_major_version=${min_version%%.*}
- min_minor_version="0"
- min_point_version="0"
- if test "${min_version#*.}" != "${min_version}"; then
- min_minor_version=${min_version
- min_minor_version=${min_minor_version%%.*}
- fi
- if test "${min_version#*.*.}" != "${min_version}"; then
- min_point_version=${min_version
- min_point_version=${min_point_version%%.*}
- fi
- max_version="$2"
- max_major_version=${max_version%%.*}
- max_minor_version="0"
- max_point_version="0"
- if test "${max_version#*.}" != "${max_version}"; then
- max_minor_version=${max_version
- max_minor_version=${max_minor_version%%.*}
- fi
- if test "${max_version#*.*.}" != "${max_version}"; then
- max_point_version=${max_version
- max_point_version=${max_point_version%%.*}
- fi
- test $(($major_version)) -lt $(($min_major_version)) && exit 1
- if test $(($major_version)) -eq $(($min_major_version)); then
- test $(($minor_version)) -lt $(($min_minor_version)) && exit 1
- if test $(($minor_version)) -eq $(($min_minor_version)); then
- test $(($point_version)) -lt $(($min_point_version)) && exit 1
- fi
- fi
- test $(($major_version)) -gt $(($max_major_version)) && exit 1
- if test $(($major_version)) -eq $(($max_major_version)); then
- test $(($minor_version)) -gt $(($max_minor_version)) && exit 1
- if test $(($minor_version)) -eq $(($max_minor_version)); then
- test $(($point_version)) -gt $(($max_point_version)) && exit 1
- fi
- fi
- exit 0
- }
- if test $
- show_usage
- exit 1
- fi
- while test $
- case $1 in
- --usage) show_usage; exit 0;;
- --help) show_help; exit 0;;
-
- --prefix=*) GMOCK_PREFIX=${1
- --exec-prefix=*) GMOCK_EXEC_PREFIX=${1
- --libdir=*) GMOCK_LIBDIR=${1
- --includedir=*) GMOCK_INCLUDEDIR=${1
-
- --prefix|--exec-prefix|--libdir|--includedir|--version)
- if test -n "${do_query}"; then
- show_usage
- exit 1
- fi
- do_query=${1
- ;;
-
- --min-version=*)
- do_check_versions=yes
- min_version=${1
- ;;
- --max-version=*)
- do_check_versions=yes
- max_version=${1
- ;;
- --exact-version=*)
- do_check_versions=yes
- exact_version=${1
- ;;
-
- --cppflags) echo_cppflags=yes;;
- --cxxflags) echo_cxxflags=yes;;
- --ldflags) echo_ldflags=yes;;
- --libs) echo_libs=yes;;
-
- *) show_usage; exit 1;;
- esac
- shift
- done
- prefix="${GMOCK_PREFIX:-@prefix@}"
- exec_prefix="${GMOCK_EXEC_PREFIX:-@exec_prefix@}"
- libdir="${GMOCK_LIBDIR:-@libdir@}"
- includedir="${GMOCK_INCLUDEDIR:-@includedir@}"
- bindir="@bindir@"
- this_relative_bindir=`dirname $0`
- this_bindir=`cd ${this_relative_bindir}; pwd -P`
- if test "${this_bindir}" = "${this_bindir%${bindir}}"; then
-
-
- build_dir=`dirname ${this_bindir}`
- src_dir=`cd ${this_bindir}/@top_srcdir@; pwd -P`
-
-
-
- gmock_libs="${build_dir}/lib/libgmock.la"
- gmock_ldflags=""
-
-
-
-
- gmock_cppflags="-I${build_dir}/include -I${src_dir}/include"
- gmock_cxxflags=""
-
- gtest_config="@GTEST_CONFIG@"
- else
-
-
-
- gmock_ldflags="-L${libdir}"
- gmock_libs="-l${name}"
- gmock_cppflags="-I${includedir}"
- gmock_cxxflags=""
-
-
- gtest_config="${bindir}/gtest-config"
- if test ! -x "${gtest_config}"; then
- gtest_config=`which gtest-config`
- fi
- fi
- if ! test -x "${gtest_config}"; then
- echo "Unable to locate Google Test, check your Google Mock configuration" \
- "and installation" >&2
- exit 1
- elif ! "${gtest_config}" "--exact-version=@GTEST_VERSION@"; then
- echo "The Google Test found is not the same version as Google Mock was " \
- "built against" >&2
- exit 1
- fi
- gmock_cppflags="${gmock_cppflags} `${gtest_config} --cppflags`"
- gmock_cxxflags="${gmock_cxxflags} `${gtest_config} --cxxflags`"
- gmock_ldflags="${gmock_ldflags} `${gtest_config} --ldflags`"
- gmock_libs="${gmock_libs} `${gtest_config} --libs`"
- if test -n "$do_query"; then
- case $do_query in
- prefix) echo $prefix; exit 0;;
- exec-prefix) echo $exec_prefix; exit 0;;
- libdir) echo $libdir; exit 0;;
- includedir) echo $includedir; exit 0;;
- version) echo $version; exit 0;;
- *) show_usage; exit 1;;
- esac
- fi
- if test "$do_check_versions" = "yes"; then
-
- test "$echo_cppflags" = "yes" && show_usage && exit 1
- test "$echo_cxxflags" = "yes" && show_usage && exit 1
- test "$echo_ldflags" = "yes" && show_usage && exit 1
- test "$echo_libs" = "yes" && show_usage && exit 1
- if test "$exact_version" != ""; then
- check_versions $exact_version $exact_version
-
- else
- check_versions ${min_version:-0.0.0} ${max_version:-9999.9999.9999}
-
- fi
- fi
- output=""
- test "$echo_cppflags" = "yes" && output="$output $gmock_cppflags"
- test "$echo_cxxflags" = "yes" && output="$output $gmock_cxxflags"
- test "$echo_ldflags" = "yes" && output="$output $gmock_ldflags"
- test "$echo_libs" = "yes" && output="$output $gmock_libs"
- echo $output
- exit 0
|