Codebase list libheif / 05171c3
Imported Upstream version 1.5.0 Joachim Bauch 4 years ago
86 changed file(s) with 27029 addition(s) and 9343 deletion(s). Raw diff Collapse all Expand all
66 os:
77 - osx
88 - linux
9 dist: trusty
910 cache: ccache
1011 sudo: required
1112 addons:
5252 set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
5353 endif()
5454
55 include(CheckCXXCompilerFlag)
56 CHECK_CXX_COMPILER_FLAG(-Wno-error=potentially-evaluated-expression has_potentially_evaluated_expression)
57 if (has_potentially_evaluated_expression)
58 # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=potentially-evaluated-expression")
59 add_definitions(-Wno-error=potentially-evaluated-expression)
60 endif()
61
5562 include_directories ("${PROJECT_SOURCE_DIR}")
5663
5764 if(UNIX)
77 gdk-pixbuf \
88 gnome \
99 go \
10 scripts
10 scripts \
11 tests
1112
1213 pkgconfigdir = $(libdir)/pkgconfig
1314 pkgconfig_DATA = libheif.pc
0 # Makefile.in generated by automake 1.15.1 from Makefile.am.
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1414 @SET_MAKE@
1515
1616 VPATH = @srcdir@
17 am__is_gnu_make = { \
18 if test -z '$(MAKELEVEL)'; then \
19 false; \
20 elif test -n '$(MAKE_HOST)'; then \
21 true; \
22 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
23 true; \
24 else \
25 false; \
26 fi; \
27 }
17 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
2818 am__make_running_with_option = \
2919 case $${target_option-} in \
3020 ?) ;; \
8979 host_triplet = @host@
9080 target_triplet = @target@
9181 subdir = .
82 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
83 $(top_srcdir)/configure $(am__configure_deps) \
84 $(srcdir)/config.h.in $(srcdir)/libheif.pc.in COPYING compile \
85 config.guess config.sub depcomp install-sh missing ltmain.sh
9286 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
93 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
87 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
88 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
9489 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
9590 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
9691 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
9792 $(top_srcdir)/configure.ac
9893 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
9994 $(ACLOCAL_M4)
100 DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
101 $(am__configure_deps) $(am__DIST_COMMON)
10295 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
10396 configure.lineno config.status.lineno
10497 mkinstalldirs = $(install_sh) -d
192185 CTAGS = ctags
193186 CSCOPE = cscope
194187 DIST_SUBDIRS = $(SUBDIRS)
195 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
196 $(srcdir)/libheif.pc.in COPYING compile config.guess \
197 config.sub depcomp install-sh ltmain.sh missing
198188 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
199189 distdir = $(PACKAGE)-$(VERSION)
200190 top_distdir = $(distdir)
272262 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
273263 EXEEXT = @EXEEXT@
274264 FGREP = @FGREP@
265 FUZZING_ENGINE = @FUZZING_ENGINE@
275266 GO = @GO@
276267 GREP = @GREP@
277268 HAVE_CXX11 = @HAVE_CXX11@
293284 LIPO = @LIPO@
294285 LN_S = @LN_S@
295286 LTLIBOBJS = @LTLIBOBJS@
296 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
297287 MAKEINFO = @MAKEINFO@
298288 MANIFEST_TOOL = @MANIFEST_TOOL@
299289 MKDIR_P = @MKDIR_P@
321311 SHELL = @SHELL@
322312 STRIP = @STRIP@
323313 VERSION = @VERSION@
314 WITH_EXAMPLES = @WITH_EXAMPLES@
324315 abs_builddir = @abs_builddir@
325316 abs_srcdir = @abs_srcdir@
326317 abs_top_builddir = @abs_top_builddir@
380371 prefix = @prefix@
381372 program_transform_name = @program_transform_name@
382373 psdir = @psdir@
383 runstatedir = @runstatedir@
384374 sbindir = @sbindir@
385375 sharedstatedir = @sharedstatedir@
386376 srcdir = @srcdir@
404394 gdk-pixbuf \
405395 gnome \
406396 go \
407 scripts
397 scripts \
398 tests
408399
409400 pkgconfigdir = $(libdir)/pkgconfig
410401 pkgconfig_DATA = libheif.pc
438429 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
439430 $(am__cd) $(top_srcdir) && \
440431 $(AUTOMAKE) --foreign Makefile
432 .PRECIOUS: Makefile
441433 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
442434 @case '$?' in \
443435 *config.status*) \
677669 ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
678670 || chmod -R a+r "$(distdir)"
679671 dist-gzip: distdir
680 tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
672 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
681673 $(am__post_remove_distdir)
682674
683675 dist-bzip2: distdir
693685 $(am__post_remove_distdir)
694686
695687 dist-tarZ: distdir
688 @echo WARNING: "Support for shar distribution archives is" \
689 "deprecated." >&2
690 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
691 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
692 $(am__post_remove_distdir)
693
694 dist-shar: distdir
696695 @echo WARNING: "Support for distribution archives compressed with" \
697696 "legacy program 'compress' is deprecated." >&2
698697 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
699 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
700 $(am__post_remove_distdir)
701
702 dist-shar: distdir
703 @echo WARNING: "Support for shar distribution archives is" \
704 "deprecated." >&2
705 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
706 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
698 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
707699 $(am__post_remove_distdir)
708700
709701 dist-zip: distdir
721713 distcheck: dist
722714 case '$(DIST_ARCHIVES)' in \
723715 *.tar.gz*) \
724 eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
716 GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
725717 *.tar.bz2*) \
726718 bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
727719 *.tar.lz*) \
731723 *.tar.Z*) \
732724 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
733725 *.shar.gz*) \
734 eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
726 GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
735727 *.zip*) \
736728 unzip $(distdir).zip ;;\
737729 esac
738730 chmod -R a-w $(distdir)
739731 chmod u+w $(distdir)
740 mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
732 mkdir $(distdir)/_build $(distdir)/_inst
741733 chmod a-w $(distdir)
742734 test -d $(distdir)/_build || exit 0; \
743735 dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
744736 && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
745737 && am__cwd=`pwd` \
746 && $(am__cd) $(distdir)/_build/sub \
747 && ../../configure \
738 && $(am__cd) $(distdir)/_build \
739 && ../configure \
748740 $(AM_DISTCHECK_CONFIGURE_FLAGS) \
749741 $(DISTCHECK_CONFIGURE_FLAGS) \
750 --srcdir=../.. --prefix="$$dc_install_base" \
742 --srcdir=.. --prefix="$$dc_install_base" \
751743 && $(MAKE) $(AM_MAKEFLAGS) \
752744 && $(MAKE) $(AM_MAKEFLAGS) dvi \
753745 && $(MAKE) $(AM_MAKEFLAGS) check \
936928 tags tags-am test-am test-local uninstall uninstall-am \
937929 uninstall-pkgconfigDATA
938930
939 .PRECIOUS: Makefile
940
941931
942932 # Tell versions [3.59,3.63) of GNU make to not export all variables.
943933 # Otherwise a system limit (for SysV at least) may be exceeded.
0 # generated automatically by aclocal 1.15.1 -*- Autoconf -*-
1
2 # Copyright (C) 1996-2017 Free Software Foundation, Inc.
0 # generated automatically by aclocal 1.14.1 -*- Autoconf -*-
1
2 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
33
44 # This file is free software; the Free Software Foundation
55 # gives unlimited permission to copy and/or distribute it,
1919 If you have problems, you may need to regenerate the build system entirely.
2020 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
2121
22 dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
23 dnl serial 11 (pkg-config-0.29.1)
24 dnl
25 dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
26 dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
27 dnl
28 dnl This program is free software; you can redistribute it and/or modify
29 dnl it under the terms of the GNU General Public License as published by
30 dnl the Free Software Foundation; either version 2 of the License, or
31 dnl (at your option) any later version.
32 dnl
33 dnl This program is distributed in the hope that it will be useful, but
34 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
35 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36 dnl General Public License for more details.
37 dnl
38 dnl You should have received a copy of the GNU General Public License
39 dnl along with this program; if not, write to the Free Software
40 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
41 dnl 02111-1307, USA.
42 dnl
43 dnl As a special exception to the GNU General Public License, if you
44 dnl distribute this file as part of a program that contains a
45 dnl configuration script generated by Autoconf, you may include it under
46 dnl the same distribution terms that you use for the rest of that
47 dnl program.
48
49 dnl PKG_PREREQ(MIN-VERSION)
50 dnl -----------------------
51 dnl Since: 0.29
52 dnl
53 dnl Verify that the version of the pkg-config macros are at least
54 dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
55 dnl installed version of pkg-config, this checks the developer's version
56 dnl of pkg.m4 when generating configure.
57 dnl
58 dnl To ensure that this macro is defined, also add:
59 dnl m4_ifndef([PKG_PREREQ],
60 dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
61 dnl
62 dnl See the "Since" comment for each macro you use to see what version
63 dnl of the macros you require.
64 m4_defun([PKG_PREREQ],
65 [m4_define([PKG_MACROS_VERSION], [0.29.1])
66 m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
67 [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
68 ])dnl PKG_PREREQ
69
70 dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
71 dnl ----------------------------------
72 dnl Since: 0.16
73 dnl
74 dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
75 dnl first found in the path. Checks that the version of pkg-config found
76 dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
77 dnl used since that's the first version where most current features of
78 dnl pkg-config existed.
22 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
23 # serial 1 (pkg-config-0.24)
24 #
25 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
26 #
27 # This program is free software; you can redistribute it and/or modify
28 # it under the terms of the GNU General Public License as published by
29 # the Free Software Foundation; either version 2 of the License, or
30 # (at your option) any later version.
31 #
32 # This program is distributed in the hope that it will be useful, but
33 # WITHOUT ANY WARRANTY; without even the implied warranty of
34 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 # General Public License for more details.
36 #
37 # You should have received a copy of the GNU General Public License
38 # along with this program; if not, write to the Free Software
39 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40 #
41 # As a special exception to the GNU General Public License, if you
42 # distribute this file as part of a program that contains a
43 # configuration script generated by Autoconf, you may include it under
44 # the same distribution terms that you use for the rest of that program.
45
46 # PKG_PROG_PKG_CONFIG([MIN-VERSION])
47 # ----------------------------------
7948 AC_DEFUN([PKG_PROG_PKG_CONFIG],
8049 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
8150 m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
9766 PKG_CONFIG=""
9867 fi
9968 fi[]dnl
100 ])dnl PKG_PROG_PKG_CONFIG
101
102 dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
103 dnl -------------------------------------------------------------------
104 dnl Since: 0.18
105 dnl
106 dnl Check to see whether a particular set of modules exists. Similar to
107 dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
108 dnl
109 dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110 dnl only at the first occurence in configure.ac, so if the first place
111 dnl it's called might be skipped (such as if it is within an "if", you
112 dnl have to call PKG_CHECK_EXISTS manually
69 ])# PKG_PROG_PKG_CONFIG
70
71 # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
72 #
73 # Check to see whether a particular set of modules exists. Similar
74 # to PKG_CHECK_MODULES(), but does not set variables or print errors.
75 #
76 # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
77 # only at the first occurence in configure.ac, so if the first place
78 # it's called might be skipped (such as if it is within an "if", you
79 # have to call PKG_CHECK_EXISTS manually
80 # --------------------------------------------------------------
11381 AC_DEFUN([PKG_CHECK_EXISTS],
11482 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
11583 if test -n "$PKG_CONFIG" && \
11987 $3])dnl
12088 fi])
12189
122 dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
123 dnl ---------------------------------------------
124 dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125 dnl pkg_failed based on the result.
90 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
91 # ---------------------------------------------
12692 m4_define([_PKG_CONFIG],
12793 [if test -n "$$1"; then
12894 pkg_cv_[]$1="$$1"
134100 else
135101 pkg_failed=untried
136102 fi[]dnl
137 ])dnl _PKG_CONFIG
138
139 dnl _PKG_SHORT_ERRORS_SUPPORTED
140 dnl ---------------------------
141 dnl Internal check to see if pkg-config supports short errors.
103 ])# _PKG_CONFIG
104
105 # _PKG_SHORT_ERRORS_SUPPORTED
106 # -----------------------------
142107 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
143108 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
144109 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
146111 else
147112 _pkg_short_errors_supported=no
148113 fi[]dnl
149 ])dnl _PKG_SHORT_ERRORS_SUPPORTED
150
151
152 dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
153 dnl [ACTION-IF-NOT-FOUND])
154 dnl --------------------------------------------------------------
155 dnl Since: 0.4.0
156 dnl
157 dnl Note that if there is a possibility the first call to
158 dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
159 dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
114 ])# _PKG_SHORT_ERRORS_SUPPORTED
115
116
117 # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
118 # [ACTION-IF-NOT-FOUND])
119 #
120 #
121 # Note that if there is a possibility the first call to
122 # PKG_CHECK_MODULES might not happen, you should be sure to include an
123 # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
124 #
125 #
126 # --------------------------------------------------------------
160127 AC_DEFUN([PKG_CHECK_MODULES],
161128 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
162129 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
210177 AC_MSG_RESULT([yes])
211178 $3
212179 fi[]dnl
213 ])dnl PKG_CHECK_MODULES
214
215
216 dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
217 dnl [ACTION-IF-NOT-FOUND])
218 dnl ---------------------------------------------------------------------
219 dnl Since: 0.29
220 dnl
221 dnl Checks for existence of MODULES and gathers its build flags with
222 dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
223 dnl and VARIABLE-PREFIX_LIBS from --libs.
224 dnl
225 dnl Note that if there is a possibility the first call to
226 dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
227 dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
228 dnl configure.ac.
229 AC_DEFUN([PKG_CHECK_MODULES_STATIC],
230 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
231 _save_PKG_CONFIG=$PKG_CONFIG
232 PKG_CONFIG="$PKG_CONFIG --static"
233 PKG_CHECK_MODULES($@)
234 PKG_CONFIG=$_save_PKG_CONFIG[]dnl
235 ])dnl PKG_CHECK_MODULES_STATIC
236
237
238 dnl PKG_INSTALLDIR([DIRECTORY])
239 dnl -------------------------
240 dnl Since: 0.27
241 dnl
242 dnl Substitutes the variable pkgconfigdir as the location where a module
243 dnl should install pkg-config .pc files. By default the directory is
244 dnl $libdir/pkgconfig, but the default can be changed by passing
245 dnl DIRECTORY. The user can override through the --with-pkgconfigdir
246 dnl parameter.
247 AC_DEFUN([PKG_INSTALLDIR],
248 [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
249 m4_pushdef([pkg_description],
250 [pkg-config installation directory @<:@]pkg_default[@:>@])
251 AC_ARG_WITH([pkgconfigdir],
252 [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
253 [with_pkgconfigdir=]pkg_default)
254 AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
255 m4_popdef([pkg_default])
256 m4_popdef([pkg_description])
257 ])dnl PKG_INSTALLDIR
258
259
260 dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
261 dnl --------------------------------
262 dnl Since: 0.27
263 dnl
264 dnl Substitutes the variable noarch_pkgconfigdir as the location where a
265 dnl module should install arch-independent pkg-config .pc files. By
266 dnl default the directory is $datadir/pkgconfig, but the default can be
267 dnl changed by passing DIRECTORY. The user can override through the
268 dnl --with-noarch-pkgconfigdir parameter.
269 AC_DEFUN([PKG_NOARCH_INSTALLDIR],
270 [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
271 m4_pushdef([pkg_description],
272 [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
273 AC_ARG_WITH([noarch-pkgconfigdir],
274 [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
275 [with_noarch_pkgconfigdir=]pkg_default)
276 AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
277 m4_popdef([pkg_default])
278 m4_popdef([pkg_description])
279 ])dnl PKG_NOARCH_INSTALLDIR
280
281
282 dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
283 dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
284 dnl -------------------------------------------
285 dnl Since: 0.28
286 dnl
287 dnl Retrieves the value of the pkg-config variable for the given module.
288 AC_DEFUN([PKG_CHECK_VAR],
289 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
290 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
291
292 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
293 AS_VAR_COPY([$1], [pkg_cv_][$1])
294
295 AS_VAR_IF([$1], [""], [$5], [$4])dnl
296 ])dnl PKG_CHECK_VAR
297
298 # Copyright (C) 2002-2017 Free Software Foundation, Inc.
180 ])# PKG_CHECK_MODULES
181
182 # Copyright (C) 2002-2013 Free Software Foundation, Inc.
299183 #
300184 # This file is free software; the Free Software Foundation
301185 # gives unlimited permission to copy and/or distribute it,
307191 # generated from the m4 files accompanying Automake X.Y.
308192 # (This private macro should not be called outside this file.)
309193 AC_DEFUN([AM_AUTOMAKE_VERSION],
310 [am__api_version='1.15'
194 [am__api_version='1.14'
311195 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
312196 dnl require some minimum version. Point them to the right macro.
313 m4_if([$1], [1.15.1], [],
197 m4_if([$1], [1.14.1], [],
314198 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
315199 ])
316200
326210 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
327211 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
328212 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
329 [AM_AUTOMAKE_VERSION([1.15.1])dnl
213 [AM_AUTOMAKE_VERSION([1.14.1])dnl
330214 m4_ifndef([AC_AUTOCONF_VERSION],
331215 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
332216 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
333217
334218 # Figure out how to run the assembler. -*- Autoconf -*-
335219
336 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
220 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
337221 #
338222 # This file is free software; the Free Software Foundation
339223 # gives unlimited permission to copy and/or distribute it,
353237
354238 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
355239
356 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
240 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
357241 #
358242 # This file is free software; the Free Software Foundation
359243 # gives unlimited permission to copy and/or distribute it,
398282 # configured tree to be moved without reconfiguration.
399283
400284 AC_DEFUN([AM_AUX_DIR_EXPAND],
401 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
402 # Expand $ac_aux_dir to an absolute path.
403 am_aux_dir=`cd "$ac_aux_dir" && pwd`
285 [dnl Rely on autoconf to set up CDPATH properly.
286 AC_PREREQ([2.50])dnl
287 # expand $ac_aux_dir to an absolute path
288 am_aux_dir=`cd $ac_aux_dir && pwd`
404289 ])
405290
406291 # AM_CONDITIONAL -*- Autoconf -*-
407292
408 # Copyright (C) 1997-2017 Free Software Foundation, Inc.
293 # Copyright (C) 1997-2013 Free Software Foundation, Inc.
409294 #
410295 # This file is free software; the Free Software Foundation
411296 # gives unlimited permission to copy and/or distribute it,
436321 Usually this means the macro was only invoked conditionally.]])
437322 fi])])
438323
439 # Copyright (C) 1999-2017 Free Software Foundation, Inc.
324 # Copyright (C) 1999-2013 Free Software Foundation, Inc.
440325 #
441326 # This file is free software; the Free Software Foundation
442327 # gives unlimited permission to copy and/or distribute it,
627512
628513 # Generate code to set up dependency tracking. -*- Autoconf -*-
629514
630 # Copyright (C) 1999-2017 Free Software Foundation, Inc.
515 # Copyright (C) 1999-2013 Free Software Foundation, Inc.
631516 #
632517 # This file is free software; the Free Software Foundation
633518 # gives unlimited permission to copy and/or distribute it,
703588
704589 # AM_EXTRA_RECURSIVE_TARGETS -*- Autoconf -*-
705590
706 # Copyright (C) 2012-2017 Free Software Foundation, Inc.
591 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
707592 #
708593 # This file is free software; the Free Software Foundation
709594 # gives unlimited permission to copy and/or distribute it,
720605
721606 # Do all the work for Automake. -*- Autoconf -*-
722607
723 # Copyright (C) 1996-2017 Free Software Foundation, Inc.
608 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
724609 #
725610 # This file is free software; the Free Software Foundation
726611 # gives unlimited permission to copy and/or distribute it,
810695 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
811696 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
812697 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
813 # We need awk for the "check" target (and possibly the TAP driver). The
814 # system "awk" is bad on some platforms.
698 # We need awk for the "check" target. The system "awk" is bad on
699 # some platforms.
815700 AC_REQUIRE([AC_PROG_AWK])dnl
816701 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
817702 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
884769 END
885770 AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
886771 fi
887 fi
888 dnl The trailing newline in this macro's definition is deliberate, for
889 dnl backward compatibility and to allow trailing 'dnl'-style comments
890 dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
891 ])
772 fi])
892773
893774 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
894775 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
917798 done
918799 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
919800
920 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
801 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
921802 #
922803 # This file is free software; the Free Software Foundation
923804 # gives unlimited permission to copy and/or distribute it,
928809 # Define $install_sh.
929810 AC_DEFUN([AM_PROG_INSTALL_SH],
930811 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
931 if test x"${install_sh+set}" != xset; then
812 if test x"${install_sh}" != xset; then
932813 case $am_aux_dir in
933814 *\ * | *\ *)
934815 install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
938819 fi
939820 AC_SUBST([install_sh])])
940821
941 # Copyright (C) 2003-2017 Free Software Foundation, Inc.
822 # Copyright (C) 2003-2013 Free Software Foundation, Inc.
942823 #
943824 # This file is free software; the Free Software Foundation
944825 # gives unlimited permission to copy and/or distribute it,
959840
960841 # Check to see how 'make' treats includes. -*- Autoconf -*-
961842
962 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
843 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
963844 #
964845 # This file is free software; the Free Software Foundation
965846 # gives unlimited permission to copy and/or distribute it,
1009890
1010891 # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
1011892
1012 # Copyright (C) 1997-2017 Free Software Foundation, Inc.
893 # Copyright (C) 1997-2013 Free Software Foundation, Inc.
1013894 #
1014895 # This file is free software; the Free Software Foundation
1015896 # gives unlimited permission to copy and/or distribute it,
1048929
1049930 # Helper functions for option handling. -*- Autoconf -*-
1050931
1051 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
932 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
1052933 #
1053934 # This file is free software; the Free Software Foundation
1054935 # gives unlimited permission to copy and/or distribute it,
1077958 AC_DEFUN([_AM_IF_OPTION],
1078959 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
1079960
1080 # Copyright (C) 1999-2017 Free Software Foundation, Inc.
961 # Copyright (C) 1999-2013 Free Software Foundation, Inc.
1081962 #
1082963 # This file is free software; the Free Software Foundation
1083964 # gives unlimited permission to copy and/or distribute it,
11241005 # For backward compatibility.
11251006 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
11261007
1127 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
1008 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
11281009 #
11291010 # This file is free software; the Free Software Foundation
11301011 # gives unlimited permission to copy and/or distribute it,
11431024
11441025 # Check to make sure that the build environment is sane. -*- Autoconf -*-
11451026
1146 # Copyright (C) 1996-2017 Free Software Foundation, Inc.
1027 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
11471028 #
11481029 # This file is free software; the Free Software Foundation
11491030 # gives unlimited permission to copy and/or distribute it,
12241105 rm -f conftest.file
12251106 ])
12261107
1227 # Copyright (C) 2009-2017 Free Software Foundation, Inc.
1108 # Copyright (C) 2009-2013 Free Software Foundation, Inc.
12281109 #
12291110 # This file is free software; the Free Software Foundation
12301111 # gives unlimited permission to copy and/or distribute it,
12841165 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
12851166 ])
12861167
1287 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
1168 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
12881169 #
12891170 # This file is free software; the Free Software Foundation
12901171 # gives unlimited permission to copy and/or distribute it,
13121193 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
13131194 AC_SUBST([INSTALL_STRIP_PROGRAM])])
13141195
1315 # Copyright (C) 2006-2017 Free Software Foundation, Inc.
1196 # Copyright (C) 2006-2013 Free Software Foundation, Inc.
13161197 #
13171198 # This file is free software; the Free Software Foundation
13181199 # gives unlimited permission to copy and/or distribute it,
13311212
13321213 # Check how to create a tarball. -*- Autoconf -*-
13331214
1334 # Copyright (C) 2004-2017 Free Software Foundation, Inc.
1215 # Copyright (C) 2004-2013 Free Software Foundation, Inc.
13351216 #
13361217 # This file is free software; the Free Software Foundation
13371218 # gives unlimited permission to copy and/or distribute it,
14621343 AC_SUBST([am__untar])
14631344 ]) # _AM_PROG_TAR
14641345
1346 m4_include([m4/ac_c_cxx_compile_flags.m4])
14651347 m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
14661348 m4_include([m4/libtool.m4])
14671349 m4_include([m4/ltoptions.m4])
22
33 scriptversion=2012-10-14.11; # UTC
44
5 # Copyright (C) 1999-2014 Free Software Foundation, Inc.
5 # Copyright (C) 1999-2013 Free Software Foundation, Inc.
66 # Written by Tom Tromey <tromey@cygnus.com>.
77 #
88 # This program is free software; you can redistribute it and/or modify
00 #! /bin/sh
11 # Attempt to guess a canonical system name.
2 # Copyright 1992-2018 Free Software Foundation, Inc.
3
4 timestamp='2018-02-24'
2 # Copyright 1992-2013 Free Software Foundation, Inc.
3
4 timestamp='2013-06-10'
55
66 # This file is free software; you can redistribute it and/or modify it
77 # under the terms of the GNU General Public License as published by
1414 # General Public License for more details.
1515 #
1616 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, see <https://www.gnu.org/licenses/>.
17 # along with this program; if not, see <http://www.gnu.org/licenses/>.
1818 #
1919 # As a special exception to the GNU General Public License, if you
2020 # distribute this file as part of a program that contains a
2323 # program. This Exception is an additional permission under section 7
2424 # of the GNU General Public License, version 3 ("GPLv3").
2525 #
26 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
26 # Originally written by Per Bothner.
2727 #
2828 # You can get the latest version of this script from:
29 # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
29 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
3030 #
31 # Please send patches to <config-patches@gnu.org>.
31 # Please send patches with a ChangeLog entry to config-patches@gnu.org.
3232
3333
3434 me=`echo "$0" | sed -e 's,.*/,,'`
3838
3939 Output the configuration name of the system \`$me' is run on.
4040
41 Options:
41 Operation modes:
4242 -h, --help print this help, then exit
4343 -t, --time-stamp print date of last modification, then exit
4444 -v, --version print version number, then exit
4949 GNU config.guess ($timestamp)
5050
5151 Originally written by Per Bothner.
52 Copyright 1992-2018 Free Software Foundation, Inc.
52 Copyright 1992-2013 Free Software Foundation, Inc.
5353
5454 This is free software; see the source for copying conditions. There is NO
5555 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
106106 dummy=$tmp/dummy ;
107107 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
108108 case $CC_FOR_BUILD,$HOST_CC,$CC in
109 ,,) echo "int x;" > "$dummy.c" ;
109 ,,) echo "int x;" > $dummy.c ;
110110 for c in cc gcc c89 c99 ; do
111 if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
111 if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
112112 CC_FOR_BUILD="$c"; break ;
113113 fi ;
114114 done ;
131131 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
132132 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
133133
134 case "$UNAME_SYSTEM" in
134 case "${UNAME_SYSTEM}" in
135135 Linux|GNU|GNU/*)
136136 # If the system lacks a compiler, then just pick glibc.
137137 # We could probably try harder.
138138 LIBC=gnu
139139
140 eval "$set_cc_for_build"
141 cat <<-EOF > "$dummy.c"
140 eval $set_cc_for_build
141 cat <<-EOF > $dummy.c
142142 #include <features.h>
143143 #if defined(__UCLIBC__)
144144 LIBC=uclibc
148148 LIBC=gnu
149149 #endif
150150 EOF
151 eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
152
153 # If ldd exists, use it to detect musl libc.
154 if command -v ldd >/dev/null && \
155 ldd --version 2>&1 | grep -q ^musl
156 then
157 LIBC=musl
158 fi
151 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
159152 ;;
160153 esac
161154
162155 # Note: order is significant - the case branches are not exclusive.
163156
164 case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
157 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
165158 *:NetBSD:*:*)
166159 # NetBSD (nbsd) targets should (where applicable) match one or
167160 # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
174167 # Note: NetBSD doesn't particularly care about the vendor
175168 # portion of the name. We always set it to "unknown".
176169 sysctl="sysctl -n hw.machine_arch"
177 UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
178 "/sbin/$sysctl" 2>/dev/null || \
179 "/usr/sbin/$sysctl" 2>/dev/null || \
180 echo unknown)`
181 case "$UNAME_MACHINE_ARCH" in
170 UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
171 /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
172 case "${UNAME_MACHINE_ARCH}" in
182173 armeb) machine=armeb-unknown ;;
183174 arm*) machine=arm-unknown ;;
184175 sh3el) machine=shl-unknown ;;
185176 sh3eb) machine=sh-unknown ;;
186177 sh5el) machine=sh5le-unknown ;;
187 earmv*)
188 arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
189 endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
190 machine="${arch}${endian}"-unknown
191 ;;
192 *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
178 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
193179 esac
194180 # The Operating System including object format, if it has switched
195 # to ELF recently (or will in the future) and ABI.
196 case "$UNAME_MACHINE_ARCH" in
197 earm*)
198 os=netbsdelf
199 ;;
181 # to ELF recently, or will in the future.
182 case "${UNAME_MACHINE_ARCH}" in
200183 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
201 eval "$set_cc_for_build"
184 eval $set_cc_for_build
202185 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
203186 | grep -q __ELF__
204187 then
213196 os=netbsd
214197 ;;
215198 esac
216 # Determine ABI tags.
217 case "$UNAME_MACHINE_ARCH" in
218 earm*)
219 expr='s/^earmv[0-9]/-eabi/;s/eb$//'
220 abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
221 ;;
222 esac
223199 # The OS release
224200 # Debian GNU/NetBSD machines have a different userland, and
225201 # thus, need a distinct triplet. However, they do not need
226202 # kernel version information, so it can be replaced with a
227203 # suitable tag, in the style of linux-gnu.
228 case "$UNAME_VERSION" in
204 case "${UNAME_VERSION}" in
229205 Debian*)
230206 release='-gnu'
231207 ;;
232208 *)
233 release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
209 release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
234210 ;;
235211 esac
236212 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
237213 # contains redundant information, the shorter form:
238214 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
239 echo "$machine-${os}${release}${abi}"
215 echo "${machine}-${os}${release}"
240216 exit ;;
241217 *:Bitrig:*:*)
242218 UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
243 echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
219 echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
244220 exit ;;
245221 *:OpenBSD:*:*)
246222 UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
247 echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
248 exit ;;
249 *:LibertyBSD:*:*)
250 UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
251 echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
252 exit ;;
253 *:MidnightBSD:*:*)
254 echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
223 echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
255224 exit ;;
256225 *:ekkoBSD:*:*)
257 echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
226 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
258227 exit ;;
259228 *:SolidBSD:*:*)
260 echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
229 echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
261230 exit ;;
262231 macppc:MirBSD:*:*)
263 echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
232 echo powerpc-unknown-mirbsd${UNAME_RELEASE}
264233 exit ;;
265234 *:MirBSD:*:*)
266 echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
267 exit ;;
268 *:Sortix:*:*)
269 echo "$UNAME_MACHINE"-unknown-sortix
270 exit ;;
271 *:Redox:*:*)
272 echo "$UNAME_MACHINE"-unknown-redox
273 exit ;;
274 mips:OSF1:*.*)
275 echo mips-dec-osf1
276 exit ;;
235 echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
236 exit ;;
277237 alpha:OSF1:*:*)
278238 case $UNAME_RELEASE in
279239 *4.0)
290250 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
291251 case "$ALPHA_CPU_TYPE" in
292252 "EV4 (21064)")
293 UNAME_MACHINE=alpha ;;
253 UNAME_MACHINE="alpha" ;;
294254 "EV4.5 (21064)")
295 UNAME_MACHINE=alpha ;;
255 UNAME_MACHINE="alpha" ;;
296256 "LCA4 (21066/21068)")
297 UNAME_MACHINE=alpha ;;
257 UNAME_MACHINE="alpha" ;;
298258 "EV5 (21164)")
299 UNAME_MACHINE=alphaev5 ;;
259 UNAME_MACHINE="alphaev5" ;;
300260 "EV5.6 (21164A)")
301 UNAME_MACHINE=alphaev56 ;;
261 UNAME_MACHINE="alphaev56" ;;
302262 "EV5.6 (21164PC)")
303 UNAME_MACHINE=alphapca56 ;;
263 UNAME_MACHINE="alphapca56" ;;
304264 "EV5.7 (21164PC)")
305 UNAME_MACHINE=alphapca57 ;;
265 UNAME_MACHINE="alphapca57" ;;
306266 "EV6 (21264)")
307 UNAME_MACHINE=alphaev6 ;;
267 UNAME_MACHINE="alphaev6" ;;
308268 "EV6.7 (21264A)")
309 UNAME_MACHINE=alphaev67 ;;
269 UNAME_MACHINE="alphaev67" ;;
310270 "EV6.8CB (21264C)")
311 UNAME_MACHINE=alphaev68 ;;
271 UNAME_MACHINE="alphaev68" ;;
312272 "EV6.8AL (21264B)")
313 UNAME_MACHINE=alphaev68 ;;
273 UNAME_MACHINE="alphaev68" ;;
314274 "EV6.8CX (21264D)")
315 UNAME_MACHINE=alphaev68 ;;
275 UNAME_MACHINE="alphaev68" ;;
316276 "EV6.9A (21264/EV69A)")
317 UNAME_MACHINE=alphaev69 ;;
277 UNAME_MACHINE="alphaev69" ;;
318278 "EV7 (21364)")
319 UNAME_MACHINE=alphaev7 ;;
279 UNAME_MACHINE="alphaev7" ;;
320280 "EV7.9 (21364A)")
321 UNAME_MACHINE=alphaev79 ;;
281 UNAME_MACHINE="alphaev79" ;;
322282 esac
323283 # A Pn.n version is a patched version.
324284 # A Vn.n version is a released version.
325285 # A Tn.n version is a released field test version.
326286 # A Xn.n version is an unreleased experimental baselevel.
327287 # 1.2 uses "1.2" for uname -r.
328 echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
288 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
329289 # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
330290 exitcode=$?
331291 trap '' 0
332292 exit $exitcode ;;
293 Alpha\ *:Windows_NT*:*)
294 # How do we know it's Interix rather than the generic POSIX subsystem?
295 # Should we change UNAME_MACHINE based on the output of uname instead
296 # of the specific Alpha model?
297 echo alpha-pc-interix
298 exit ;;
299 21064:Windows_NT:50:3)
300 echo alpha-dec-winnt3.5
301 exit ;;
333302 Amiga*:UNIX_System_V:4.0:*)
334303 echo m68k-unknown-sysv4
335304 exit ;;
336305 *:[Aa]miga[Oo][Ss]:*:*)
337 echo "$UNAME_MACHINE"-unknown-amigaos
306 echo ${UNAME_MACHINE}-unknown-amigaos
338307 exit ;;
339308 *:[Mm]orph[Oo][Ss]:*:*)
340 echo "$UNAME_MACHINE"-unknown-morphos
309 echo ${UNAME_MACHINE}-unknown-morphos
341310 exit ;;
342311 *:OS/390:*:*)
343312 echo i370-ibm-openedition
349318 echo powerpc-ibm-os400
350319 exit ;;
351320 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
352 echo arm-acorn-riscix"$UNAME_RELEASE"
321 echo arm-acorn-riscix${UNAME_RELEASE}
353322 exit ;;
354323 arm*:riscos:*:*|arm*:RISCOS:*:*)
355324 echo arm-unknown-riscos
376345 sparc) echo sparc-icl-nx7; exit ;;
377346 esac ;;
378347 s390x:SunOS:*:*)
379 echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
348 echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
380349 exit ;;
381350 sun4H:SunOS:5.*:*)
382 echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
351 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
383352 exit ;;
384353 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
385 echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
354 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
386355 exit ;;
387356 i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
388 echo i386-pc-auroraux"$UNAME_RELEASE"
357 echo i386-pc-auroraux${UNAME_RELEASE}
389358 exit ;;
390359 i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
391 eval "$set_cc_for_build"
392 SUN_ARCH=i386
360 eval $set_cc_for_build
361 SUN_ARCH="i386"
393362 # If there is a compiler, see if it is configured for 64-bit objects.
394363 # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
395364 # This test works for both compilers.
396 if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
365 if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
397366 if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
398 (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
367 (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
399368 grep IS_64BIT_ARCH >/dev/null
400369 then
401 SUN_ARCH=x86_64
370 SUN_ARCH="x86_64"
402371 fi
403372 fi
404 echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
373 echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
405374 exit ;;
406375 sun4*:SunOS:6*:*)
407376 # According to config.sub, this is the proper way to canonicalize
408377 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
409378 # it's likely to be more like Solaris than SunOS4.
410 echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
379 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
411380 exit ;;
412381 sun4*:SunOS:*:*)
413382 case "`/usr/bin/arch -k`" in
416385 ;;
417386 esac
418387 # Japanese Language versions have a version number like `4.1.3-JL'.
419 echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
388 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
420389 exit ;;
421390 sun3*:SunOS:*:*)
422 echo m68k-sun-sunos"$UNAME_RELEASE"
391 echo m68k-sun-sunos${UNAME_RELEASE}
423392 exit ;;
424393 sun*:*:4.2BSD:*)
425394 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
426 test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
395 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
427396 case "`/bin/arch`" in
428397 sun3)
429 echo m68k-sun-sunos"$UNAME_RELEASE"
398 echo m68k-sun-sunos${UNAME_RELEASE}
430399 ;;
431400 sun4)
432 echo sparc-sun-sunos"$UNAME_RELEASE"
401 echo sparc-sun-sunos${UNAME_RELEASE}
433402 ;;
434403 esac
435404 exit ;;
436405 aushp:SunOS:*:*)
437 echo sparc-auspex-sunos"$UNAME_RELEASE"
406 echo sparc-auspex-sunos${UNAME_RELEASE}
438407 exit ;;
439408 # The situation for MiNT is a little confusing. The machine name
440409 # can be virtually everything (everything which is not
445414 # MiNT. But MiNT is downward compatible to TOS, so this should
446415 # be no problem.
447416 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
448 echo m68k-atari-mint"$UNAME_RELEASE"
417 echo m68k-atari-mint${UNAME_RELEASE}
449418 exit ;;
450419 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
451 echo m68k-atari-mint"$UNAME_RELEASE"
420 echo m68k-atari-mint${UNAME_RELEASE}
452421 exit ;;
453422 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
454 echo m68k-atari-mint"$UNAME_RELEASE"
423 echo m68k-atari-mint${UNAME_RELEASE}
455424 exit ;;
456425 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
457 echo m68k-milan-mint"$UNAME_RELEASE"
426 echo m68k-milan-mint${UNAME_RELEASE}
458427 exit ;;
459428 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
460 echo m68k-hades-mint"$UNAME_RELEASE"
429 echo m68k-hades-mint${UNAME_RELEASE}
461430 exit ;;
462431 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
463 echo m68k-unknown-mint"$UNAME_RELEASE"
432 echo m68k-unknown-mint${UNAME_RELEASE}
464433 exit ;;
465434 m68k:machten:*:*)
466 echo m68k-apple-machten"$UNAME_RELEASE"
435 echo m68k-apple-machten${UNAME_RELEASE}
467436 exit ;;
468437 powerpc:machten:*:*)
469 echo powerpc-apple-machten"$UNAME_RELEASE"
438 echo powerpc-apple-machten${UNAME_RELEASE}
470439 exit ;;
471440 RISC*:Mach:*:*)
472441 echo mips-dec-mach_bsd4.3
473442 exit ;;
474443 RISC*:ULTRIX:*:*)
475 echo mips-dec-ultrix"$UNAME_RELEASE"
444 echo mips-dec-ultrix${UNAME_RELEASE}
476445 exit ;;
477446 VAX*:ULTRIX*:*:*)
478 echo vax-dec-ultrix"$UNAME_RELEASE"
447 echo vax-dec-ultrix${UNAME_RELEASE}
479448 exit ;;
480449 2020:CLIX:*:* | 2430:CLIX:*:*)
481 echo clipper-intergraph-clix"$UNAME_RELEASE"
450 echo clipper-intergraph-clix${UNAME_RELEASE}
482451 exit ;;
483452 mips:*:*:UMIPS | mips:*:*:RISCos)
484 eval "$set_cc_for_build"
485 sed 's/^ //' << EOF > "$dummy.c"
453 eval $set_cc_for_build
454 sed 's/^ //' << EOF >$dummy.c
486455 #ifdef __cplusplus
487456 #include <stdio.h> /* for printf() prototype */
488457 int main (int argc, char *argv[]) {
491460 #endif
492461 #if defined (host_mips) && defined (MIPSEB)
493462 #if defined (SYSTYPE_SYSV)
494 printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
463 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
495464 #endif
496465 #if defined (SYSTYPE_SVR4)
497 printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
466 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
498467 #endif
499468 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
500 printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
469 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
501470 #endif
502471 #endif
503472 exit (-1);
504473 }
505474 EOF
506 $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
507 dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
508 SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
475 $CC_FOR_BUILD -o $dummy $dummy.c &&
476 dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
477 SYSTEM_NAME=`$dummy $dummyarg` &&
509478 { echo "$SYSTEM_NAME"; exit; }
510 echo mips-mips-riscos"$UNAME_RELEASE"
479 echo mips-mips-riscos${UNAME_RELEASE}
511480 exit ;;
512481 Motorola:PowerMAX_OS:*:*)
513482 echo powerpc-motorola-powermax
533502 AViiON:dgux:*:*)
534503 # DG/UX returns AViiON for all architectures
535504 UNAME_PROCESSOR=`/usr/bin/uname -p`
536 if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
505 if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
537506 then
538 if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
539 [ "$TARGET_BINARY_INTERFACE"x = x ]
507 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
508 [ ${TARGET_BINARY_INTERFACE}x = x ]
540509 then
541 echo m88k-dg-dgux"$UNAME_RELEASE"
510 echo m88k-dg-dgux${UNAME_RELEASE}
542511 else
543 echo m88k-dg-dguxbcs"$UNAME_RELEASE"
512 echo m88k-dg-dguxbcs${UNAME_RELEASE}
544513 fi
545514 else
546 echo i586-dg-dgux"$UNAME_RELEASE"
515 echo i586-dg-dgux${UNAME_RELEASE}
547516 fi
548517 exit ;;
549518 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
560529 echo m68k-tektronix-bsd
561530 exit ;;
562531 *:IRIX*:*:*)
563 echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
532 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
564533 exit ;;
565534 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
566535 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
572541 if [ -x /usr/bin/oslevel ] ; then
573542 IBM_REV=`/usr/bin/oslevel`
574543 else
575 IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
576 fi
577 echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
544 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
545 fi
546 echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
578547 exit ;;
579548 *:AIX:2:3)
580549 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
581 eval "$set_cc_for_build"
582 sed 's/^ //' << EOF > "$dummy.c"
550 eval $set_cc_for_build
551 sed 's/^ //' << EOF >$dummy.c
583552 #include <sys/systemcfg.h>
584553
585554 main()
590559 exit(0);
591560 }
592561 EOF
593 if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
562 if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
594563 then
595564 echo "$SYSTEM_NAME"
596565 else
604573 exit ;;
605574 *:AIX:*:[4567])
606575 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
607 if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
576 if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
608577 IBM_ARCH=rs6000
609578 else
610579 IBM_ARCH=powerpc
611580 fi
612 if [ -x /usr/bin/lslpp ] ; then
613 IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
614 awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
581 if [ -x /usr/bin/oslevel ] ; then
582 IBM_REV=`/usr/bin/oslevel`
615583 else
616 IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
617 fi
618 echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
584 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
585 fi
586 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
619587 exit ;;
620588 *:AIX:*:*)
621589 echo rs6000-ibm-aix
622590 exit ;;
623 ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
591 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
624592 echo romp-ibm-bsd4.4
625593 exit ;;
626594 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
627 echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to
595 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
628596 exit ;; # report: romp-ibm BSD 4.3
629597 *:BOSX:*:*)
630598 echo rs6000-bull-bosx
639607 echo m68k-hp-bsd4.4
640608 exit ;;
641609 9000/[34678]??:HP-UX:*:*)
642 HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
643 case "$UNAME_MACHINE" in
644 9000/31?) HP_ARCH=m68000 ;;
645 9000/[34]??) HP_ARCH=m68k ;;
610 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
611 case "${UNAME_MACHINE}" in
612 9000/31? ) HP_ARCH=m68000 ;;
613 9000/[34]?? ) HP_ARCH=m68k ;;
646614 9000/[678][0-9][0-9])
647615 if [ -x /usr/bin/getconf ]; then
648616 sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
649617 sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
650 case "$sc_cpu_version" in
651 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
652 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
618 case "${sc_cpu_version}" in
619 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
620 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
653621 532) # CPU_PA_RISC2_0
654 case "$sc_kernel_bits" in
655 32) HP_ARCH=hppa2.0n ;;
656 64) HP_ARCH=hppa2.0w ;;
657 '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
622 case "${sc_kernel_bits}" in
623 32) HP_ARCH="hppa2.0n" ;;
624 64) HP_ARCH="hppa2.0w" ;;
625 '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
658626 esac ;;
659627 esac
660628 fi
661 if [ "$HP_ARCH" = "" ]; then
662 eval "$set_cc_for_build"
663 sed 's/^ //' << EOF > "$dummy.c"
629 if [ "${HP_ARCH}" = "" ]; then
630 eval $set_cc_for_build
631 sed 's/^ //' << EOF >$dummy.c
664632
665633 #define _HPUX_SOURCE
666634 #include <stdlib.h>
693661 exit (0);
694662 }
695663 EOF
696 (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
664 (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
697665 test -z "$HP_ARCH" && HP_ARCH=hppa
698666 fi ;;
699667 esac
700 if [ "$HP_ARCH" = hppa2.0w ]
668 if [ ${HP_ARCH} = "hppa2.0w" ]
701669 then
702 eval "$set_cc_for_build"
670 eval $set_cc_for_build
703671
704672 # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
705673 # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
710678 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
711679 # => hppa64-hp-hpux11.23
712680
713 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
681 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
714682 grep -q __LP64__
715683 then
716 HP_ARCH=hppa2.0w
684 HP_ARCH="hppa2.0w"
717685 else
718 HP_ARCH=hppa64
686 HP_ARCH="hppa64"
719687 fi
720688 fi
721 echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
689 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
722690 exit ;;
723691 ia64:HP-UX:*:*)
724 HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
725 echo ia64-hp-hpux"$HPUX_REV"
692 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
693 echo ia64-hp-hpux${HPUX_REV}
726694 exit ;;
727695 3050*:HI-UX:*:*)
728 eval "$set_cc_for_build"
729 sed 's/^ //' << EOF > "$dummy.c"
696 eval $set_cc_for_build
697 sed 's/^ //' << EOF >$dummy.c
730698 #include <unistd.h>
731699 int
732700 main ()
751719 exit (0);
752720 }
753721 EOF
754 $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
722 $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
755723 { echo "$SYSTEM_NAME"; exit; }
756724 echo unknown-hitachi-hiuxwe2
757725 exit ;;
758 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
726 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
759727 echo hppa1.1-hp-bsd
760728 exit ;;
761729 9000/8??:4.3bsd:*:*)
764732 *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
765733 echo hppa1.0-hp-mpeix
766734 exit ;;
767 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
735 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
768736 echo hppa1.1-hp-osf
769737 exit ;;
770738 hp8??:OSF1:*:*)
772740 exit ;;
773741 i*86:OSF1:*:*)
774742 if [ -x /usr/sbin/sysversion ] ; then
775 echo "$UNAME_MACHINE"-unknown-osf1mk
743 echo ${UNAME_MACHINE}-unknown-osf1mk
776744 else
777 echo "$UNAME_MACHINE"-unknown-osf1
745 echo ${UNAME_MACHINE}-unknown-osf1
778746 fi
779747 exit ;;
780748 parisc*:Lites*:*:*)
799767 echo c4-convex-bsd
800768 exit ;;
801769 CRAY*Y-MP:*:*:*)
802 echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
770 echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
803771 exit ;;
804772 CRAY*[A-Z]90:*:*:*)
805 echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
773 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
806774 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
807775 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
808776 -e 's/\.[^.]*$/.X/'
809777 exit ;;
810778 CRAY*TS:*:*:*)
811 echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
779 echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
812780 exit ;;
813781 CRAY*T3E:*:*:*)
814 echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
782 echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
815783 exit ;;
816784 CRAY*SV1:*:*:*)
817 echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
785 echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
818786 exit ;;
819787 *:UNICOS/mp:*:*)
820 echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
788 echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
821789 exit ;;
822790 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
823 FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
824 FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
825 FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
791 FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
792 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
793 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
826794 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
827795 exit ;;
828796 5000:UNIX_System_V:4.*:*)
829 FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
830 FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
797 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
798 FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
831799 echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
832800 exit ;;
833801 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
834 echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
802 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
835803 exit ;;
836804 sparc*:BSD/OS:*:*)
837 echo sparc-unknown-bsdi"$UNAME_RELEASE"
805 echo sparc-unknown-bsdi${UNAME_RELEASE}
838806 exit ;;
839807 *:BSD/OS:*:*)
840 echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
808 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
841809 exit ;;
842810 *:FreeBSD:*:*)
843811 UNAME_PROCESSOR=`/usr/bin/uname -p`
844 case "$UNAME_PROCESSOR" in
812 case ${UNAME_PROCESSOR} in
845813 amd64)
846 UNAME_PROCESSOR=x86_64 ;;
847 i386)
848 UNAME_PROCESSOR=i586 ;;
814 echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
815 *)
816 echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
849817 esac
850 echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
851818 exit ;;
852819 i*:CYGWIN*:*)
853 echo "$UNAME_MACHINE"-pc-cygwin
820 echo ${UNAME_MACHINE}-pc-cygwin
854821 exit ;;
855822 *:MINGW64*:*)
856 echo "$UNAME_MACHINE"-pc-mingw64
823 echo ${UNAME_MACHINE}-pc-mingw64
857824 exit ;;
858825 *:MINGW*:*)
859 echo "$UNAME_MACHINE"-pc-mingw32
860 exit ;;
861 *:MSYS*:*)
862 echo "$UNAME_MACHINE"-pc-msys
826 echo ${UNAME_MACHINE}-pc-mingw32
827 exit ;;
828 i*:MSYS*:*)
829 echo ${UNAME_MACHINE}-pc-msys
830 exit ;;
831 i*:windows32*:*)
832 # uname -m includes "-pc" on this system.
833 echo ${UNAME_MACHINE}-mingw32
863834 exit ;;
864835 i*:PW*:*)
865 echo "$UNAME_MACHINE"-pc-pw32
836 echo ${UNAME_MACHINE}-pc-pw32
866837 exit ;;
867838 *:Interix*:*)
868 case "$UNAME_MACHINE" in
839 case ${UNAME_MACHINE} in
869840 x86)
870 echo i586-pc-interix"$UNAME_RELEASE"
841 echo i586-pc-interix${UNAME_RELEASE}
871842 exit ;;
872843 authenticamd | genuineintel | EM64T)
873 echo x86_64-unknown-interix"$UNAME_RELEASE"
844 echo x86_64-unknown-interix${UNAME_RELEASE}
874845 exit ;;
875846 IA64)
876 echo ia64-unknown-interix"$UNAME_RELEASE"
847 echo ia64-unknown-interix${UNAME_RELEASE}
877848 exit ;;
878849 esac ;;
850 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
851 echo i${UNAME_MACHINE}-pc-mks
852 exit ;;
853 8664:Windows_NT:*)
854 echo x86_64-pc-mks
855 exit ;;
856 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
857 # How do we know it's Interix rather than the generic POSIX subsystem?
858 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
859 # UNAME_MACHINE based on the output of uname instead of i386?
860 echo i586-pc-interix
861 exit ;;
879862 i*:UWIN*:*)
880 echo "$UNAME_MACHINE"-pc-uwin
863 echo ${UNAME_MACHINE}-pc-uwin
881864 exit ;;
882865 amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
883866 echo x86_64-unknown-cygwin
884867 exit ;;
868 p*:CYGWIN*:*)
869 echo powerpcle-unknown-cygwin
870 exit ;;
885871 prep*:SunOS:5.*:*)
886 echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
872 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
887873 exit ;;
888874 *:GNU:*:*)
889875 # the GNU system
890 echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
876 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
891877 exit ;;
892878 *:GNU/*:*:*)
893879 # other systems with GNU libc and userland
894 echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
880 echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
895881 exit ;;
896882 i*86:Minix:*:*)
897 echo "$UNAME_MACHINE"-pc-minix
883 echo ${UNAME_MACHINE}-pc-minix
898884 exit ;;
899885 aarch64:Linux:*:*)
900 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
886 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
901887 exit ;;
902888 aarch64_be:Linux:*:*)
903889 UNAME_MACHINE=aarch64_be
904 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
890 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
905891 exit ;;
906892 alpha:Linux:*:*)
907893 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
914900 EV68*) UNAME_MACHINE=alphaev68 ;;
915901 esac
916902 objdump --private-headers /bin/sh | grep -q ld.so.1
917 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
918 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
903 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
904 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
919905 exit ;;
920906 arc:Linux:*:* | arceb:Linux:*:*)
921 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
907 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
922908 exit ;;
923909 arm*:Linux:*:*)
924 eval "$set_cc_for_build"
910 eval $set_cc_for_build
925911 if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
926912 | grep -q __ARM_EABI__
927913 then
928 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
914 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
929915 else
930916 if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
931917 | grep -q __ARM_PCS_VFP
932918 then
933 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
919 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
934920 else
935 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
921 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
936922 fi
937923 fi
938924 exit ;;
939925 avr32*:Linux:*:*)
940 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
926 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
941927 exit ;;
942928 cris:Linux:*:*)
943 echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
929 echo ${UNAME_MACHINE}-axis-linux-${LIBC}
944930 exit ;;
945931 crisv32:Linux:*:*)
946 echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
947 exit ;;
948 e2k:Linux:*:*)
949 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
932 echo ${UNAME_MACHINE}-axis-linux-${LIBC}
950933 exit ;;
951934 frv:Linux:*:*)
952 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
935 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
953936 exit ;;
954937 hexagon:Linux:*:*)
955 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
938 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
956939 exit ;;
957940 i*86:Linux:*:*)
958 echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
941 echo ${UNAME_MACHINE}-pc-linux-${LIBC}
959942 exit ;;
960943 ia64:Linux:*:*)
961 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
962 exit ;;
963 k1om:Linux:*:*)
964 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
944 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
965945 exit ;;
966946 m32r*:Linux:*:*)
967 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
947 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
968948 exit ;;
969949 m68*:Linux:*:*)
970 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
950 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
971951 exit ;;
972952 mips:Linux:*:* | mips64:Linux:*:*)
973 eval "$set_cc_for_build"
974 sed 's/^ //' << EOF > "$dummy.c"
953 eval $set_cc_for_build
954 sed 's/^ //' << EOF >$dummy.c
975955 #undef CPU
976956 #undef ${UNAME_MACHINE}
977957 #undef ${UNAME_MACHINE}el
985965 #endif
986966 #endif
987967 EOF
988 eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
989 test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
968 eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
969 test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
990970 ;;
991 mips64el:Linux:*:*)
992 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
993 exit ;;
994 openrisc*:Linux:*:*)
995 echo or1k-unknown-linux-"$LIBC"
996 exit ;;
997 or32:Linux:*:* | or1k*:Linux:*:*)
998 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
971 or1k:Linux:*:*)
972 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
973 exit ;;
974 or32:Linux:*:*)
975 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
999976 exit ;;
1000977 padre:Linux:*:*)
1001 echo sparc-unknown-linux-"$LIBC"
978 echo sparc-unknown-linux-${LIBC}
1002979 exit ;;
1003980 parisc64:Linux:*:* | hppa64:Linux:*:*)
1004 echo hppa64-unknown-linux-"$LIBC"
981 echo hppa64-unknown-linux-${LIBC}
1005982 exit ;;
1006983 parisc:Linux:*:* | hppa:Linux:*:*)
1007984 # Look for CPU level
1008985 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1009 PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
1010 PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
1011 *) echo hppa-unknown-linux-"$LIBC" ;;
986 PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
987 PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
988 *) echo hppa-unknown-linux-${LIBC} ;;
1012989 esac
1013990 exit ;;
1014991 ppc64:Linux:*:*)
1015 echo powerpc64-unknown-linux-"$LIBC"
992 echo powerpc64-unknown-linux-${LIBC}
1016993 exit ;;
1017994 ppc:Linux:*:*)
1018 echo powerpc-unknown-linux-"$LIBC"
995 echo powerpc-unknown-linux-${LIBC}
1019996 exit ;;
1020997 ppc64le:Linux:*:*)
1021 echo powerpc64le-unknown-linux-"$LIBC"
998 echo powerpc64le-unknown-linux-${LIBC}
1022999 exit ;;
10231000 ppcle:Linux:*:*)
1024 echo powerpcle-unknown-linux-"$LIBC"
1025 exit ;;
1026 riscv32:Linux:*:* | riscv64:Linux:*:*)
1027 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1001 echo powerpcle-unknown-linux-${LIBC}
10281002 exit ;;
10291003 s390:Linux:*:* | s390x:Linux:*:*)
1030 echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
1004 echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
10311005 exit ;;
10321006 sh64*:Linux:*:*)
1033 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1007 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10341008 exit ;;
10351009 sh*:Linux:*:*)
1036 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1010 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10371011 exit ;;
10381012 sparc:Linux:*:* | sparc64:Linux:*:*)
1039 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1013 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10401014 exit ;;
10411015 tile*:Linux:*:*)
1042 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1016 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10431017 exit ;;
10441018 vax:Linux:*:*)
1045 echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
1019 echo ${UNAME_MACHINE}-dec-linux-${LIBC}
10461020 exit ;;
10471021 x86_64:Linux:*:*)
1048 if objdump -f /bin/sh | grep -q elf32-x86-64; then
1049 echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32
1050 else
1051 echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
1052 fi
1022 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10531023 exit ;;
10541024 xtensa*:Linux:*:*)
1055 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1025 echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
10561026 exit ;;
10571027 i*86:DYNIX/ptx:4*:*)
10581028 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
10661036 # I am not positive that other SVR4 systems won't match this,
10671037 # I just have to hope. -- rms.
10681038 # Use sysv4.2uw... so that sysv4* matches it.
1069 echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
1039 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
10701040 exit ;;
10711041 i*86:OS/2:*:*)
10721042 # If we were able to find `uname', then EMX Unix compatibility
10731043 # is probably installed.
1074 echo "$UNAME_MACHINE"-pc-os2-emx
1044 echo ${UNAME_MACHINE}-pc-os2-emx
10751045 exit ;;
10761046 i*86:XTS-300:*:STOP)
1077 echo "$UNAME_MACHINE"-unknown-stop
1047 echo ${UNAME_MACHINE}-unknown-stop
10781048 exit ;;
10791049 i*86:atheos:*:*)
1080 echo "$UNAME_MACHINE"-unknown-atheos
1050 echo ${UNAME_MACHINE}-unknown-atheos
10811051 exit ;;
10821052 i*86:syllable:*:*)
1083 echo "$UNAME_MACHINE"-pc-syllable
1053 echo ${UNAME_MACHINE}-pc-syllable
10841054 exit ;;
10851055 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1086 echo i386-unknown-lynxos"$UNAME_RELEASE"
1056 echo i386-unknown-lynxos${UNAME_RELEASE}
10871057 exit ;;
10881058 i*86:*DOS:*:*)
1089 echo "$UNAME_MACHINE"-pc-msdosdjgpp
1090 exit ;;
1091 i*86:*:4.*:*)
1092 UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1059 echo ${UNAME_MACHINE}-pc-msdosdjgpp
1060 exit ;;
1061 i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1062 UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
10931063 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1094 echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
1064 echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
10951065 else
1096 echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
1066 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
10971067 fi
10981068 exit ;;
10991069 i*86:*:5:[678]*)
11031073 *Pentium) UNAME_MACHINE=i586 ;;
11041074 *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
11051075 esac
1106 echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
1076 echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
11071077 exit ;;
11081078 i*86:*:3.2:*)
11091079 if test -f /usr/options/cb.name; then
11101080 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1111 echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
1081 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
11121082 elif /bin/uname -X 2>/dev/null >/dev/null ; then
11131083 UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
11141084 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
11181088 && UNAME_MACHINE=i686
11191089 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
11201090 && UNAME_MACHINE=i686
1121 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
1091 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
11221092 else
1123 echo "$UNAME_MACHINE"-pc-sysv32
1093 echo ${UNAME_MACHINE}-pc-sysv32
11241094 fi
11251095 exit ;;
11261096 pc:*:*:*)
11281098 # uname -m prints for DJGPP always 'pc', but it prints nothing about
11291099 # the processor, so we play safe by assuming i586.
11301100 # Note: whatever this is, it MUST be the same as what config.sub
1131 # prints for the "djgpp" host, or else GDB configure will decide that
1101 # prints for the "djgpp" host, or else GDB configury will decide that
11321102 # this is a cross-build.
11331103 echo i586-pc-msdosdjgpp
11341104 exit ;;
11401110 exit ;;
11411111 i860:*:4.*:*) # i860-SVR4
11421112 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1143 echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
1113 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
11441114 else # Add other i860-SVR4 vendors below as they are discovered.
1145 echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4
1115 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
11461116 fi
11471117 exit ;;
11481118 mini*:CTIX:SYS*5:*)
11621132 test -r /etc/.relid \
11631133 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
11641134 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1165 && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1135 && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
11661136 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1167 && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1137 && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
11681138 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
11691139 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11701140 && { echo i486-ncr-sysv4; exit; } ;;
11731143 test -r /etc/.relid \
11741144 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
11751145 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1176 && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1146 && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
11771147 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1178 && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1148 && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
11791149 /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1180 && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1150 && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
11811151 m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1182 echo m68k-unknown-lynxos"$UNAME_RELEASE"
1152 echo m68k-unknown-lynxos${UNAME_RELEASE}
11831153 exit ;;
11841154 mc68030:UNIX_System_V:4.*:*)
11851155 echo m68k-atari-sysv4
11861156 exit ;;
11871157 TSUNAMI:LynxOS:2.*:*)
1188 echo sparc-unknown-lynxos"$UNAME_RELEASE"
1158 echo sparc-unknown-lynxos${UNAME_RELEASE}
11891159 exit ;;
11901160 rs6000:LynxOS:2.*:*)
1191 echo rs6000-unknown-lynxos"$UNAME_RELEASE"
1161 echo rs6000-unknown-lynxos${UNAME_RELEASE}
11921162 exit ;;
11931163 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1194 echo powerpc-unknown-lynxos"$UNAME_RELEASE"
1164 echo powerpc-unknown-lynxos${UNAME_RELEASE}
11951165 exit ;;
11961166 SM[BE]S:UNIX_SV:*:*)
1197 echo mips-dde-sysv"$UNAME_RELEASE"
1167 echo mips-dde-sysv${UNAME_RELEASE}
11981168 exit ;;
11991169 RM*:ReliantUNIX-*:*:*)
12001170 echo mips-sni-sysv4
12051175 *:SINIX-*:*:*)
12061176 if uname -p 2>/dev/null >/dev/null ; then
12071177 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1208 echo "$UNAME_MACHINE"-sni-sysv4
1178 echo ${UNAME_MACHINE}-sni-sysv4
12091179 else
12101180 echo ns32k-sni-sysv
12111181 fi
12251195 exit ;;
12261196 i*86:VOS:*:*)
12271197 # From Paul.Green@stratus.com.
1228 echo "$UNAME_MACHINE"-stratus-vos
1198 echo ${UNAME_MACHINE}-stratus-vos
12291199 exit ;;
12301200 *:VOS:*:*)
12311201 # From Paul.Green@stratus.com.
12321202 echo hppa1.1-stratus-vos
12331203 exit ;;
12341204 mc68*:A/UX:*:*)
1235 echo m68k-apple-aux"$UNAME_RELEASE"
1205 echo m68k-apple-aux${UNAME_RELEASE}
12361206 exit ;;
12371207 news*:NEWS-OS:6*:*)
12381208 echo mips-sony-newsos6
12391209 exit ;;
12401210 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
12411211 if [ -d /usr/nec ]; then
1242 echo mips-nec-sysv"$UNAME_RELEASE"
1212 echo mips-nec-sysv${UNAME_RELEASE}
12431213 else
1244 echo mips-unknown-sysv"$UNAME_RELEASE"
1214 echo mips-unknown-sysv${UNAME_RELEASE}
12451215 fi
12461216 exit ;;
12471217 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
12601230 echo x86_64-unknown-haiku
12611231 exit ;;
12621232 SX-4:SUPER-UX:*:*)
1263 echo sx4-nec-superux"$UNAME_RELEASE"
1233 echo sx4-nec-superux${UNAME_RELEASE}
12641234 exit ;;
12651235 SX-5:SUPER-UX:*:*)
1266 echo sx5-nec-superux"$UNAME_RELEASE"
1236 echo sx5-nec-superux${UNAME_RELEASE}
12671237 exit ;;
12681238 SX-6:SUPER-UX:*:*)
1269 echo sx6-nec-superux"$UNAME_RELEASE"
1239 echo sx6-nec-superux${UNAME_RELEASE}
12701240 exit ;;
12711241 SX-7:SUPER-UX:*:*)
1272 echo sx7-nec-superux"$UNAME_RELEASE"
1242 echo sx7-nec-superux${UNAME_RELEASE}
12731243 exit ;;
12741244 SX-8:SUPER-UX:*:*)
1275 echo sx8-nec-superux"$UNAME_RELEASE"
1245 echo sx8-nec-superux${UNAME_RELEASE}
12761246 exit ;;
12771247 SX-8R:SUPER-UX:*:*)
1278 echo sx8r-nec-superux"$UNAME_RELEASE"
1279 exit ;;
1280 SX-ACE:SUPER-UX:*:*)
1281 echo sxace-nec-superux"$UNAME_RELEASE"
1248 echo sx8r-nec-superux${UNAME_RELEASE}
12821249 exit ;;
12831250 Power*:Rhapsody:*:*)
1284 echo powerpc-apple-rhapsody"$UNAME_RELEASE"
1251 echo powerpc-apple-rhapsody${UNAME_RELEASE}
12851252 exit ;;
12861253 *:Rhapsody:*:*)
1287 echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
1254 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
12881255 exit ;;
12891256 *:Darwin:*:*)
12901257 UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1291 eval "$set_cc_for_build"
1258 eval $set_cc_for_build
12921259 if test "$UNAME_PROCESSOR" = unknown ; then
12931260 UNAME_PROCESSOR=powerpc
12941261 fi
1295 if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
1296 if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
1297 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1298 (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1299 grep IS_64BIT_ARCH >/dev/null
1300 then
1301 case $UNAME_PROCESSOR in
1302 i386) UNAME_PROCESSOR=x86_64 ;;
1303 powerpc) UNAME_PROCESSOR=powerpc64 ;;
1304 esac
1305 fi
1306 # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1307 if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1308 (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1309 grep IS_PPC >/dev/null
1310 then
1311 UNAME_PROCESSOR=powerpc
1312 fi
1262 if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1263 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1264 (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1265 grep IS_64BIT_ARCH >/dev/null
1266 then
1267 case $UNAME_PROCESSOR in
1268 i386) UNAME_PROCESSOR=x86_64 ;;
1269 powerpc) UNAME_PROCESSOR=powerpc64 ;;
1270 esac
13131271 fi
1314 elif test "$UNAME_PROCESSOR" = i386 ; then
1315 # Avoid executing cc on OS X 10.9, as it ships with a stub
1316 # that puts up a graphical alert prompting to install
1317 # developer tools. Any system running Mac OS X 10.7 or
1318 # later (Darwin 11 and later) is required to have a 64-bit
1319 # processor. This is not true of the ARM version of Darwin
1320 # that Apple uses in portable devices.
1321 UNAME_PROCESSOR=x86_64
1322 fi
1323 echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
1272 fi
1273 echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
13241274 exit ;;
13251275 *:procnto*:*:* | *:QNX:[0123456789]*:*)
13261276 UNAME_PROCESSOR=`uname -p`
1327 if test "$UNAME_PROCESSOR" = x86; then
1277 if test "$UNAME_PROCESSOR" = "x86"; then
13281278 UNAME_PROCESSOR=i386
13291279 UNAME_MACHINE=pc
13301280 fi
1331 echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
1281 echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
13321282 exit ;;
13331283 *:QNX:*:4*)
13341284 echo i386-pc-qnx
13351285 exit ;;
1336 NEO-*:NONSTOP_KERNEL:*:*)
1337 echo neo-tandem-nsk"$UNAME_RELEASE"
1286 NEO-?:NONSTOP_KERNEL:*:*)
1287 echo neo-tandem-nsk${UNAME_RELEASE}
13381288 exit ;;
13391289 NSE-*:NONSTOP_KERNEL:*:*)
1340 echo nse-tandem-nsk"$UNAME_RELEASE"
1341 exit ;;
1342 NSR-*:NONSTOP_KERNEL:*:*)
1343 echo nsr-tandem-nsk"$UNAME_RELEASE"
1344 exit ;;
1345 NSV-*:NONSTOP_KERNEL:*:*)
1346 echo nsv-tandem-nsk"$UNAME_RELEASE"
1347 exit ;;
1348 NSX-*:NONSTOP_KERNEL:*:*)
1349 echo nsx-tandem-nsk"$UNAME_RELEASE"
1290 echo nse-tandem-nsk${UNAME_RELEASE}
1291 exit ;;
1292 NSR-?:NONSTOP_KERNEL:*:*)
1293 echo nsr-tandem-nsk${UNAME_RELEASE}
13501294 exit ;;
13511295 *:NonStop-UX:*:*)
13521296 echo mips-compaq-nonstopux
13551299 echo bs2000-siemens-sysv
13561300 exit ;;
13571301 DS/*:UNIX_System_V:*:*)
1358 echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
1302 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
13591303 exit ;;
13601304 *:Plan9:*:*)
13611305 # "uname -m" is not consistent, so use $cputype instead. 386
13621306 # is converted to i386 for consistency with other x86
13631307 # operating systems.
1364 if test "$cputype" = 386; then
1308 if test "$cputype" = "386"; then
13651309 UNAME_MACHINE=i386
13661310 else
13671311 UNAME_MACHINE="$cputype"
13681312 fi
1369 echo "$UNAME_MACHINE"-unknown-plan9
1313 echo ${UNAME_MACHINE}-unknown-plan9
13701314 exit ;;
13711315 *:TOPS-10:*:*)
13721316 echo pdp10-unknown-tops10
13871331 echo pdp10-unknown-its
13881332 exit ;;
13891333 SEI:*:*:SEIUX)
1390 echo mips-sei-seiux"$UNAME_RELEASE"
1334 echo mips-sei-seiux${UNAME_RELEASE}
13911335 exit ;;
13921336 *:DragonFly:*:*)
1393 echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
1337 echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
13941338 exit ;;
13951339 *:*VMS:*:*)
13961340 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1397 case "$UNAME_MACHINE" in
1341 case "${UNAME_MACHINE}" in
13981342 A*) echo alpha-dec-vms ; exit ;;
13991343 I*) echo ia64-dec-vms ; exit ;;
14001344 V*) echo vax-dec-vms ; exit ;;
14031347 echo i386-pc-xenix
14041348 exit ;;
14051349 i*86:skyos:*:*)
1406 echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
1350 echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
14071351 exit ;;
14081352 i*86:rdos:*:*)
1409 echo "$UNAME_MACHINE"-pc-rdos
1353 echo ${UNAME_MACHINE}-pc-rdos
14101354 exit ;;
14111355 i*86:AROS:*:*)
1412 echo "$UNAME_MACHINE"-pc-aros
1356 echo ${UNAME_MACHINE}-pc-aros
14131357 exit ;;
14141358 x86_64:VMkernel:*:*)
1415 echo "$UNAME_MACHINE"-unknown-esx
1416 exit ;;
1417 amd64:Isilon\ OneFS:*:*)
1418 echo x86_64-unknown-onefs
1359 echo ${UNAME_MACHINE}-unknown-esx
14191360 exit ;;
14201361 esac
14211362
1422 echo "$0: unable to guess system type" >&2
1423
1424 case "$UNAME_MACHINE:$UNAME_SYSTEM" in
1425 mips:Linux | mips64:Linux)
1426 # If we got here on MIPS GNU/Linux, output extra information.
1427 cat >&2 <<EOF
1428
1429 NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1430 the system type. Please install a C compiler and try again.
1363 eval $set_cc_for_build
1364 cat >$dummy.c <<EOF
1365 #ifdef _SEQUENT_
1366 # include <sys/types.h>
1367 # include <sys/utsname.h>
1368 #endif
1369 main ()
1370 {
1371 #if defined (sony)
1372 #if defined (MIPSEB)
1373 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1374 I don't know.... */
1375 printf ("mips-sony-bsd\n"); exit (0);
1376 #else
1377 #include <sys/param.h>
1378 printf ("m68k-sony-newsos%s\n",
1379 #ifdef NEWSOS4
1380 "4"
1381 #else
1382 ""
1383 #endif
1384 ); exit (0);
1385 #endif
1386 #endif
1387
1388 #if defined (__arm) && defined (__acorn) && defined (__unix)
1389 printf ("arm-acorn-riscix\n"); exit (0);
1390 #endif
1391
1392 #if defined (hp300) && !defined (hpux)
1393 printf ("m68k-hp-bsd\n"); exit (0);
1394 #endif
1395
1396 #if defined (NeXT)
1397 #if !defined (__ARCHITECTURE__)
1398 #define __ARCHITECTURE__ "m68k"
1399 #endif
1400 int version;
1401 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1402 if (version < 4)
1403 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1404 else
1405 printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1406 exit (0);
1407 #endif
1408
1409 #if defined (MULTIMAX) || defined (n16)
1410 #if defined (UMAXV)
1411 printf ("ns32k-encore-sysv\n"); exit (0);
1412 #else
1413 #if defined (CMU)
1414 printf ("ns32k-encore-mach\n"); exit (0);
1415 #else
1416 printf ("ns32k-encore-bsd\n"); exit (0);
1417 #endif
1418 #endif
1419 #endif
1420
1421 #if defined (__386BSD__)
1422 printf ("i386-pc-bsd\n"); exit (0);
1423 #endif
1424
1425 #if defined (sequent)
1426 #if defined (i386)
1427 printf ("i386-sequent-dynix\n"); exit (0);
1428 #endif
1429 #if defined (ns32000)
1430 printf ("ns32k-sequent-dynix\n"); exit (0);
1431 #endif
1432 #endif
1433
1434 #if defined (_SEQUENT_)
1435 struct utsname un;
1436
1437 uname(&un);
1438
1439 if (strncmp(un.version, "V2", 2) == 0) {
1440 printf ("i386-sequent-ptx2\n"); exit (0);
1441 }
1442 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1443 printf ("i386-sequent-ptx1\n"); exit (0);
1444 }
1445 printf ("i386-sequent-ptx\n"); exit (0);
1446
1447 #endif
1448
1449 #if defined (vax)
1450 # if !defined (ultrix)
1451 # include <sys/param.h>
1452 # if defined (BSD)
1453 # if BSD == 43
1454 printf ("vax-dec-bsd4.3\n"); exit (0);
1455 # else
1456 # if BSD == 199006
1457 printf ("vax-dec-bsd4.3reno\n"); exit (0);
1458 # else
1459 printf ("vax-dec-bsd\n"); exit (0);
1460 # endif
1461 # endif
1462 # else
1463 printf ("vax-dec-bsd\n"); exit (0);
1464 # endif
1465 # else
1466 printf ("vax-dec-ultrix\n"); exit (0);
1467 # endif
1468 #endif
1469
1470 #if defined (alliant) && defined (i860)
1471 printf ("i860-alliant-bsd\n"); exit (0);
1472 #endif
1473
1474 exit (1);
1475 }
14311476 EOF
1432 ;;
1433 esac
1477
1478 $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1479 { echo "$SYSTEM_NAME"; exit; }
1480
1481 # Apollos put the system type in the environment.
1482
1483 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1484
1485 # Convex versions that predate uname can use getsysinfo(1)
1486
1487 if [ -x /usr/convex/getsysinfo ]
1488 then
1489 case `getsysinfo -f cpu_type` in
1490 c1*)
1491 echo c1-convex-bsd
1492 exit ;;
1493 c2*)
1494 if getsysinfo -f scalar_acc
1495 then echo c32-convex-bsd
1496 else echo c2-convex-bsd
1497 fi
1498 exit ;;
1499 c34*)
1500 echo c34-convex-bsd
1501 exit ;;
1502 c38*)
1503 echo c38-convex-bsd
1504 exit ;;
1505 c4*)
1506 echo c4-convex-bsd
1507 exit ;;
1508 esac
1509 fi
14341510
14351511 cat >&2 <<EOF
1436
1437 This script (version $timestamp), has failed to recognize the
1438 operating system you are using. If your script is old, overwrite *all*
1439 copies of config.guess and config.sub with the latest versions from:
1440
1441 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
1512 $0: unable to guess system type
1513
1514 This script, last modified $timestamp, has failed to recognize
1515 the operating system you are using. It is advised that you
1516 download the most up to date version of the config scripts from
1517
1518 http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
14421519 and
1443 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
1444
1445 If $0 has already been updated, send the following data and any
1446 information you think might be pertinent to config-patches@gnu.org to
1447 provide the necessary information to handle your system.
1520 http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1521
1522 If the version you run ($0) is already up to date, please
1523 send the following data and any information you think might be
1524 pertinent to <config-patches@gnu.org> in order to provide the needed
1525 information to handle your system.
14481526
14491527 config.guess timestamp = $timestamp
14501528
14631541 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
14641542 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
14651543
1466 UNAME_MACHINE = "$UNAME_MACHINE"
1467 UNAME_RELEASE = "$UNAME_RELEASE"
1468 UNAME_SYSTEM = "$UNAME_SYSTEM"
1469 UNAME_VERSION = "$UNAME_VERSION"
1544 UNAME_MACHINE = ${UNAME_MACHINE}
1545 UNAME_RELEASE = ${UNAME_RELEASE}
1546 UNAME_SYSTEM = ${UNAME_SYSTEM}
1547 UNAME_VERSION = ${UNAME_VERSION}
14701548 EOF
14711549
14721550 exit 1
14731551
14741552 # Local variables:
1475 # eval: (add-hook 'write-file-functions 'time-stamp)
1553 # eval: (add-hook 'write-file-hooks 'time-stamp)
14761554 # time-stamp-start: "timestamp='"
14771555 # time-stamp-format: "%:y-%02m-%02d"
14781556 # time-stamp-end: "'"
7575 /* Define to 1 if the system has the type `_Bool'. */
7676 #undef HAVE__BOOL
7777
78 /* Define to the sub-directory where libtool stores uninstalled libraries. */
78 /* Define to the sub-directory in which libtool stores uninstalled libraries.
79 */
7980 #undef LT_OBJDIR
8081
8182 /* Name of package */
00 #! /bin/sh
11 # Configuration validation subroutine script.
2 # Copyright 1992-2018 Free Software Foundation, Inc.
3
4 timestamp='2018-02-22'
2 # Copyright 1992-2013 Free Software Foundation, Inc.
3
4 timestamp='2013-08-10'
55
66 # This file is free software; you can redistribute it and/or modify it
77 # under the terms of the GNU General Public License as published by
1414 # General Public License for more details.
1515 #
1616 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, see <https://www.gnu.org/licenses/>.
17 # along with this program; if not, see <http://www.gnu.org/licenses/>.
1818 #
1919 # As a special exception to the GNU General Public License, if you
2020 # distribute this file as part of a program that contains a
2424 # of the GNU General Public License, version 3 ("GPLv3").
2525
2626
27 # Please send patches to <config-patches@gnu.org>.
27 # Please send patches with a ChangeLog entry to config-patches@gnu.org.
2828 #
2929 # Configuration subroutine to validate and canonicalize a configuration type.
3030 # Supply the specified configuration type as an argument.
3232 # Otherwise, we print the canonical config type on stdout and succeed.
3333
3434 # You can get the latest version of this script from:
35 # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
35 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
3636
3737 # This file is supposed to be the same for all GNU packages
3838 # and recognize all the CPU types, system types and aliases
5252 me=`echo "$0" | sed -e 's,.*/,,'`
5353
5454 usage="\
55 Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
55 Usage: $0 [OPTION] CPU-MFR-OPSYS
56 $0 [OPTION] ALIAS
5657
5758 Canonicalize a configuration name.
5859
59 Options:
60 Operation modes:
6061 -h, --help print this help, then exit
6162 -t, --time-stamp print date of last modification, then exit
6263 -v, --version print version number, then exit
6667 version="\
6768 GNU config.sub ($timestamp)
6869
69 Copyright 1992-2018 Free Software Foundation, Inc.
70 Copyright 1992-2013 Free Software Foundation, Inc.
7071
7172 This is free software; see the source for copying conditions. There is NO
7273 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
9394
9495 *local*)
9596 # First pass through any local machine types.
96 echo "$1"
97 echo $1
9798 exit ;;
9899
99100 * )
111112
112113 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
113114 # Here we must recognize all the valid KERNEL-OS combinations.
114 maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
115 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
115116 case $maybe_os in
116117 nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
117118 linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
118 knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
119 kopensolaris*-gnu* | cloudabi*-eabi* | \
119 knetbsd*-gnu* | netbsd*-gnu* | \
120 kopensolaris*-gnu* | \
120121 storm-chaos* | os2-emx* | rtmk-nova*)
121122 os=-$maybe_os
122 basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
123 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
123124 ;;
124125 android-linux)
125126 os=-linux-android
126 basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
127 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
127128 ;;
128129 *)
129 basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
130 if [ "$basic_machine" != "$1" ]
131 then os=`echo "$1" | sed 's/.*-/-/'`
130 basic_machine=`echo $1 | sed 's/-[^-]*$//'`
131 if [ $basic_machine != $1 ]
132 then os=`echo $1 | sed 's/.*-/-/'`
132133 else os=; fi
133134 ;;
134135 esac
177178 ;;
178179 -sco6)
179180 os=-sco5v6
180 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
181 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
181182 ;;
182183 -sco5)
183184 os=-sco3.2v5
184 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
185 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
185186 ;;
186187 -sco4)
187188 os=-sco3.2v4
188 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
189 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
189190 ;;
190191 -sco3.2.[4-9]*)
191192 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
192 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
193 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
193194 ;;
194195 -sco3.2v[4-9]*)
195196 # Don't forget version if it is 3.2v4 or newer.
196 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
197 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
197198 ;;
198199 -sco5v6*)
199200 # Don't forget version if it is 3.2v4 or newer.
200 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
201 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
201202 ;;
202203 -sco*)
203204 os=-sco3.2v2
204 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
205 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
205206 ;;
206207 -udk*)
207 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
208 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
208209 ;;
209210 -isc)
210211 os=-isc2.2
211 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
212 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
212213 ;;
213214 -clix*)
214215 basic_machine=clipper-intergraph
215216 ;;
216217 -isc*)
217 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
218 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
218219 ;;
219220 -lynx*178)
220221 os=-lynxos178
226227 os=-lynxos
227228 ;;
228229 -ptx*)
229 basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
230 basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
231 ;;
232 -windowsnt*)
233 os=`echo $os | sed -e 's/windowsnt/winnt/'`
230234 ;;
231235 -psos*)
232236 os=-psos
250254 | arc | arceb \
251255 | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
252256 | avr | avr32 \
253 | ba \
254257 | be32 | be64 \
255258 | bfin \
256259 | c4x | c8051 | clipper \
257260 | d10v | d30v | dlx | dsp16xx \
258 | e2k | epiphany \
259 | fido | fr30 | frv | ft32 \
261 | epiphany \
262 | fido | fr30 | frv \
260263 | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
261264 | hexagon \
262 | i370 | i860 | i960 | ia16 | ia64 \
265 | i370 | i860 | i960 | ia64 \
263266 | ip2k | iq2000 \
264 | k1om \
265267 | le32 | le64 \
266268 | lm32 \
267269 | m32c | m32r | m32rle | m68000 | m68k | m88k \
279281 | mips64vr5900 | mips64vr5900el \
280282 | mipsisa32 | mipsisa32el \
281283 | mipsisa32r2 | mipsisa32r2el \
282 | mipsisa32r6 | mipsisa32r6el \
283284 | mipsisa64 | mipsisa64el \
284285 | mipsisa64r2 | mipsisa64r2el \
285 | mipsisa64r6 | mipsisa64r6el \
286286 | mipsisa64sb1 | mipsisa64sb1el \
287287 | mipsisa64sr71k | mipsisa64sr71kel \
288288 | mipsr5900 | mipsr5900el \
294294 | nds32 | nds32le | nds32be \
295295 | nios | nios2 | nios2eb | nios2el \
296296 | ns16k | ns32k \
297 | open8 | or1k | or1knd | or32 \
298 | pdp10 | pj | pjl \
297 | open8 \
298 | or1k | or32 \
299 | pdp10 | pdp11 | pj | pjl \
299300 | powerpc | powerpc64 | powerpc64le | powerpcle \
300 | pru \
301301 | pyramid \
302 | riscv32 | riscv64 \
303302 | rl78 | rx \
304303 | score \
305 | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
304 | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
306305 | sh64 | sh64le \
307306 | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
308307 | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
310309 | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
311310 | ubicom32 \
312311 | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
313 | visium \
314 | wasm32 \
312 | we32k \
315313 | x86 | xc16x | xstormy16 | xtensa \
316314 | z8k | z80)
317315 basic_machine=$basic_machine-unknown
325323 c6x)
326324 basic_machine=tic6x-unknown
327325 ;;
328 leon|leon[3-9])
329 basic_machine=sparc-$basic_machine
330 ;;
331 m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
326 m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
332327 basic_machine=$basic_machine-unknown
333328 os=-none
334329 ;;
335 m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
330 m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
336331 ;;
337332 ms1)
338333 basic_machine=mt-unknown
361356 ;;
362357 # Object if more than one company name word.
363358 *-*-*)
364 echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
359 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
365360 exit 1
366361 ;;
367362 # Recognize the basic CPU types with company name.
373368 | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
374369 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
375370 | avr-* | avr32-* \
376 | ba-* \
377371 | be32-* | be64-* \
378372 | bfin-* | bs2000-* \
379373 | c[123]* | c30-* | [cjt]90-* | c4x-* \
380374 | c8051-* | clipper-* | craynv-* | cydra-* \
381375 | d10v-* | d30v-* | dlx-* \
382 | e2k-* | elxsi-* \
376 | elxsi-* \
383377 | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
384378 | h8300-* | h8500-* \
385379 | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
386380 | hexagon-* \
387 | i*86-* | i860-* | i960-* | ia16-* | ia64-* \
381 | i*86-* | i860-* | i960-* | ia64-* \
388382 | ip2k-* | iq2000-* \
389 | k1om-* \
390383 | le32-* | le64-* \
391384 | lm32-* \
392385 | m32c-* | m32r-* | m32rle-* \
406399 | mips64vr5900-* | mips64vr5900el-* \
407400 | mipsisa32-* | mipsisa32el-* \
408401 | mipsisa32r2-* | mipsisa32r2el-* \
409 | mipsisa32r6-* | mipsisa32r6el-* \
410402 | mipsisa64-* | mipsisa64el-* \
411403 | mipsisa64r2-* | mipsisa64r2el-* \
412 | mipsisa64r6-* | mipsisa64r6el-* \
413404 | mipsisa64sb1-* | mipsisa64sb1el-* \
414405 | mipsisa64sr71k-* | mipsisa64sr71kel-* \
415406 | mipsr5900-* | mipsr5900el-* \
421412 | nios-* | nios2-* | nios2eb-* | nios2el-* \
422413 | none-* | np1-* | ns16k-* | ns32k-* \
423414 | open8-* \
424 | or1k*-* \
425415 | orion-* \
426416 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
427417 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
428 | pru-* \
429418 | pyramid-* \
430 | riscv32-* | riscv64-* \
431419 | rl78-* | romp-* | rs6000-* | rx-* \
432420 | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
433421 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
434422 | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
435423 | sparclite-* \
436 | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
424 | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
437425 | tahoe-* \
438426 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
439427 | tile*-* \
441429 | ubicom32-* \
442430 | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
443431 | vax-* \
444 | visium-* \
445 | wasm32-* \
446432 | we32k-* \
447433 | x86-* | x86_64-* | xc16x-* | xps100-* \
448434 | xstormy16-* | xtensa*-* \
456442 # Recognize the various machine names and aliases which stand
457443 # for a CPU type and a company and sometimes even an OS.
458444 386bsd)
459 basic_machine=i386-pc
445 basic_machine=i386-unknown
460446 os=-bsd
461447 ;;
462448 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
490476 basic_machine=x86_64-pc
491477 ;;
492478 amd64-*)
493 basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
479 basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
494480 ;;
495481 amdahl)
496482 basic_machine=580-amdahl
519505 basic_machine=i386-pc
520506 os=-aros
521507 ;;
522 asmjs)
523 basic_machine=asmjs-unknown
524 ;;
525508 aux)
526509 basic_machine=m68k-apple
527510 os=-aux
535518 os=-linux
536519 ;;
537520 blackfin-*)
538 basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
521 basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
539522 os=-linux
540523 ;;
541524 bluegene*)
543526 os=-cnk
544527 ;;
545528 c54x-*)
546 basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
529 basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
547530 ;;
548531 c55x-*)
549 basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
532 basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
550533 ;;
551534 c6x-*)
552 basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
535 basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
553536 ;;
554537 c90)
555538 basic_machine=c90-cray
638621 basic_machine=rs6000-bull
639622 os=-bosx
640623 ;;
641 dpx2*)
624 dpx2* | dpx2*-bull)
642625 basic_machine=m68k-bull
643626 os=-sysv3
644 ;;
645 e500v[12])
646 basic_machine=powerpc-unknown
647 os=$os"spe"
648 ;;
649 e500v[12]-*)
650 basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
651 os=$os"spe"
652627 ;;
653628 ebmon29k)
654629 basic_machine=a29k-amd
739714 hp9k8[0-9][0-9] | hp8[0-9][0-9])
740715 basic_machine=hppa1.0-hp
741716 ;;
717 hppa-next)
718 os=-nextstep3
719 ;;
742720 hppaosf)
743721 basic_machine=hppa1.1-hp
744722 os=-osf
751729 basic_machine=i370-ibm
752730 ;;
753731 i*86v32)
754 basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
732 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
755733 os=-sysv32
756734 ;;
757735 i*86v4*)
758 basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
736 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
759737 os=-sysv4
760738 ;;
761739 i*86v)
762 basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
740 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
763741 os=-sysv
764742 ;;
765743 i*86sol2)
766 basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
744 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
767745 os=-solaris2
768746 ;;
769747 i386mach)
770748 basic_machine=i386-mach
771749 os=-mach
772750 ;;
773 vsta)
751 i386-vsta | vsta)
774752 basic_machine=i386-unknown
775753 os=-vsta
776754 ;;
788766 basic_machine=m68k-isi
789767 os=-sysv
790768 ;;
791 leon-*|leon[3-9]-*)
792 basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
793 ;;
794769 m68knommu)
795770 basic_machine=m68k-unknown
796771 os=-linux
797772 ;;
798773 m68knommu-*)
799 basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
774 basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
800775 os=-linux
776 ;;
777 m88k-omron*)
778 basic_machine=m88k-omron
801779 ;;
802780 magnum | m3230)
803781 basic_machine=mips-mips
830808 os=-mint
831809 ;;
832810 mips3*-*)
833 basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
811 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
834812 ;;
835813 mips3*)
836 basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
814 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
837815 ;;
838816 monitor)
839817 basic_machine=m68k-rom68k
843821 basic_machine=powerpc-unknown
844822 os=-morphos
845823 ;;
846 moxiebox)
847 basic_machine=moxie-unknown
848 os=-moxiebox
849 ;;
850824 msdos)
851825 basic_machine=i386-pc
852826 os=-msdos
853827 ;;
854828 ms1-*)
855 basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
829 basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
856830 ;;
857831 msys)
858832 basic_machine=i686-pc
894868 basic_machine=v70-nec
895869 os=-sysv
896870 ;;
897 next | m*-next)
871 next | m*-next )
898872 basic_machine=m68k-next
899873 case $os in
900874 -nextstep* )
939913 nsr-tandem)
940914 basic_machine=nsr-tandem
941915 ;;
942 nsv-tandem)
943 basic_machine=nsv-tandem
944 ;;
945 nsx-tandem)
946 basic_machine=nsx-tandem
947 ;;
948916 op50n-* | op60c-*)
949917 basic_machine=hppa1.1-oki
950918 os=-proelf
977945 os=-linux
978946 ;;
979947 parisc-*)
980 basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
948 basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
981949 os=-linux
982950 ;;
983951 pbd)
993961 basic_machine=i386-pc
994962 ;;
995963 pc98-*)
996 basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
964 basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
997965 ;;
998966 pentium | p5 | k5 | k6 | nexgen | viac3)
999967 basic_machine=i586-pc
1008976 basic_machine=i786-pc
1009977 ;;
1010978 pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
1011 basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
979 basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
1012980 ;;
1013981 pentiumpro-* | p6-* | 6x86-* | athlon-*)
1014 basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
982 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
1015983 ;;
1016984 pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
1017 basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
985 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
1018986 ;;
1019987 pentium4-*)
1020 basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
988 basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
1021989 ;;
1022990 pn)
1023991 basic_machine=pn-gould
1027995 ppc | ppcbe) basic_machine=powerpc-unknown
1028996 ;;
1029997 ppc-* | ppcbe-*)
1030 basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1031 ;;
1032 ppcle | powerpclittle)
998 basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
999 ;;
1000 ppcle | powerpclittle | ppc-le | powerpc-little)
10331001 basic_machine=powerpcle-unknown
10341002 ;;
10351003 ppcle-* | powerpclittle-*)
1036 basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1004 basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
10371005 ;;
10381006 ppc64) basic_machine=powerpc64-unknown
10391007 ;;
1040 ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1041 ;;
1042 ppc64le | powerpc64little)
1008 ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
1009 ;;
1010 ppc64le | powerpc64little | ppc64-le | powerpc64-little)
10431011 basic_machine=powerpc64le-unknown
10441012 ;;
10451013 ppc64le-* | powerpc64little-*)
1046 basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1014 basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
10471015 ;;
10481016 ps2)
10491017 basic_machine=i386-ibm
10971065 sequent)
10981066 basic_machine=i386-sequent
10991067 ;;
1068 sh)
1069 basic_machine=sh-hitachi
1070 os=-hms
1071 ;;
11001072 sh5el)
11011073 basic_machine=sh5le-unknown
11021074 ;;
1103 simso-wrs)
1075 sh64)
1076 basic_machine=sh64-unknown
1077 ;;
1078 sparclite-wrs | simso-wrs)
11041079 basic_machine=sparclite-wrs
11051080 os=-vxworks
11061081 ;;
11191094 os=-sysv4
11201095 ;;
11211096 strongarm-* | thumb-*)
1122 basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
1097 basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
11231098 ;;
11241099 sun2)
11251100 basic_machine=m68000-sun
12411216 basic_machine=hppa1.1-winbond
12421217 os=-proelf
12431218 ;;
1244 x64)
1245 basic_machine=x86_64-pc
1246 ;;
12471219 xbox)
12481220 basic_machine=i686-pc
12491221 os=-mingw32
12521224 basic_machine=xps100-honeywell
12531225 ;;
12541226 xscale-* | xscalee[bl]-*)
1255 basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
1227 basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
12561228 ;;
12571229 ymp)
12581230 basic_machine=ymp-cray
12591231 os=-unicos
1232 ;;
1233 z8k-*-coff)
1234 basic_machine=z8k-unknown
1235 os=-sim
1236 ;;
1237 z80-*-coff)
1238 basic_machine=z80-unknown
1239 os=-sim
12601240 ;;
12611241 none)
12621242 basic_machine=none-none
12861266 vax)
12871267 basic_machine=vax-dec
12881268 ;;
1269 pdp10)
1270 # there are many clones, so DEC is not a safe bet
1271 basic_machine=pdp10-unknown
1272 ;;
12891273 pdp11)
12901274 basic_machine=pdp11-dec
12911275 ;;
12951279 sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
12961280 basic_machine=sh-unknown
12971281 ;;
1282 sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
1283 basic_machine=sparc-sun
1284 ;;
12981285 cydra)
12991286 basic_machine=cydra-cydrome
13001287 ;;
13141301 # Make sure to match an already-canonicalized machine name.
13151302 ;;
13161303 *)
1317 echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
1304 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
13181305 exit 1
13191306 ;;
13201307 esac
13221309 # Here we canonicalize certain aliases for manufacturers.
13231310 case $basic_machine in
13241311 *-digital*)
1325 basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
1312 basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
13261313 ;;
13271314 *-commodore*)
1328 basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
1315 basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
13291316 ;;
13301317 *)
13311318 ;;
13361323 if [ x"$os" != x"" ]
13371324 then
13381325 case $os in
1339 # First match some system type aliases that might get confused
1340 # with valid system types.
1326 # First match some system type aliases
1327 # that might get confused with valid system types.
13411328 # -solaris* is a basic system type, with this one exception.
13421329 -auroraux)
13431330 os=-auroraux
13481335 -solaris)
13491336 os=-solaris2
13501337 ;;
1338 -svr4*)
1339 os=-sysv4
1340 ;;
13511341 -unixware*)
13521342 os=-sysv4.2uw
13531343 ;;
13541344 -gnu/linux*)
13551345 os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
13561346 ;;
1357 # es1800 is here to avoid being matched by es* (a different OS)
1358 -es1800*)
1359 os=-ose
1360 ;;
1361 # Now accept the basic system types.
1347 # First accept the basic system types.
13621348 # The portable systems comes first.
1363 # Each alternative MUST end in a * to match a version number.
1349 # Each alternative MUST END IN A *, to match a version number.
13641350 # -sysv* is not here because it comes later, after sysvr4.
13651351 -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
13661352 | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
13671353 | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
13681354 | -sym* | -kopensolaris* | -plan9* \
13691355 | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1370 | -aos* | -aros* | -cloudabi* | -sortix* \
1356 | -aos* | -aros* \
13711357 | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
13721358 | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1373 | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
1374 | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
1359 | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1360 | -bitrig* | -openbsd* | -solidbsd* \
13751361 | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
13761362 | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
13771363 | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
13781364 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1379 | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
1365 | -chorusos* | -chorusrdb* | -cegcc* \
13801366 | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1381 | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
1367 | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
13821368 | -linux-newlib* | -linux-musl* | -linux-uclibc* \
1383 | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
1384 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
1369 | -uxpv* | -beos* | -mpeix* | -udk* \
1370 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
13851371 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
13861372 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
13871373 | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1388 | -morphos* | -superux* | -rtmk* | -windiss* \
1374 | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
13891375 | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1390 | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
1391 | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
1392 | -midnightbsd*)
1376 | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
13931377 # Remember, each alternative MUST END IN *, to match a version number.
13941378 ;;
13951379 -qnx*)
14061390 -nto*)
14071391 os=`echo $os | sed -e 's|nto|nto-qnx|'`
14081392 ;;
1409 -sim | -xray | -os68k* | -v88r* \
1410 | -windows* | -osx | -abug | -netware* | -os9* \
1393 -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1394 | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
14111395 | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
14121396 ;;
14131397 -mac*)
1414 os=`echo "$os" | sed -e 's|mac|macos|'`
1398 os=`echo $os | sed -e 's|mac|macos|'`
14151399 ;;
14161400 -linux-dietlibc)
14171401 os=-linux-dietlibc
14201404 os=`echo $os | sed -e 's|linux|linux-gnu|'`
14211405 ;;
14221406 -sunos5*)
1423 os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
1407 os=`echo $os | sed -e 's|sunos5|solaris2|'`
14241408 ;;
14251409 -sunos6*)
1426 os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
1410 os=`echo $os | sed -e 's|sunos6|solaris3|'`
14271411 ;;
14281412 -opened*)
14291413 os=-openedition
14341418 -wince*)
14351419 os=-wince
14361420 ;;
1421 -osfrose*)
1422 os=-osfrose
1423 ;;
1424 -osf*)
1425 os=-osf
1426 ;;
14371427 -utek*)
14381428 os=-bsd
14391429 ;;
14581448 -nova*)
14591449 os=-rtmk-nova
14601450 ;;
1461 -ns2)
1451 -ns2 )
14621452 os=-nextstep2
14631453 ;;
14641454 -nsk*)
14801470 -oss*)
14811471 os=-sysv3
14821472 ;;
1483 -svr4*)
1473 -svr4)
14841474 os=-sysv4
14851475 ;;
14861476 -svr3)
14951485 -ose*)
14961486 os=-ose
14971487 ;;
1488 -es1800*)
1489 os=-ose
1490 ;;
1491 -xenix)
1492 os=-xenix
1493 ;;
14981494 -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
14991495 os=-mint
15001496 ;;
1497 -aros*)
1498 os=-aros
1499 ;;
15011500 -zvmoe)
15021501 os=-zvmoe
15031502 ;;
15041503 -dicos*)
15051504 os=-dicos
15061505 ;;
1507 -pikeos*)
1508 # Until real need of OS specific support for
1509 # particular features comes up, bare metal
1510 # configurations are quite functional.
1511 case $basic_machine in
1512 arm*)
1513 os=-eabi
1514 ;;
1515 *)
1516 os=-elf
1517 ;;
1518 esac
1519 ;;
15201506 -nacl*)
1521 ;;
1522 -ios)
15231507 ;;
15241508 -none)
15251509 ;;
15261510 *)
15271511 # Get rid of the `-' at the beginning of $os.
15281512 os=`echo $os | sed 's/[^-]*-//'`
1529 echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
1513 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
15301514 exit 1
15311515 ;;
15321516 esac
16071591 mips*-*)
16081592 os=-elf
16091593 ;;
1594 or1k-*)
1595 os=-elf
1596 ;;
16101597 or32-*)
16111598 os=-coff
16121599 ;;
16161603 sparc-* | *-sun)
16171604 os=-sunos4.1.1
16181605 ;;
1619 pru-*)
1620 os=-elf
1621 ;;
16221606 *-be)
16231607 os=-beos
16241608 ;;
1609 *-haiku)
1610 os=-haiku
1611 ;;
16251612 *-ibm)
16261613 os=-aix
16271614 ;;
16611648 m88k-omron*)
16621649 os=-luna
16631650 ;;
1664 *-next)
1651 *-next )
16651652 os=-nextstep
16661653 ;;
16671654 *-sequent)
16751662 ;;
16761663 i370-*)
16771664 os=-mvs
1665 ;;
1666 *-next)
1667 os=-nextstep3
16781668 ;;
16791669 *-gould)
16801670 os=-sysv
17851775 vendor=stratus
17861776 ;;
17871777 esac
1788 basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
1778 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
17891779 ;;
17901780 esac
17911781
1792 echo "$basic_machine$os"
1782 echo $basic_machine$os
17931783 exit
17941784
17951785 # Local variables:
1796 # eval: (add-hook 'write-file-functions 'time-stamp)
1786 # eval: (add-hook 'write-file-hooks 'time-stamp)
17971787 # time-stamp-start: "timestamp='"
17981788 # time-stamp-format: "%:y-%02m-%02d"
17991789 # time-stamp-end: "'"
+1466
-1903
configure less more
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for libheif 1.4.0.
2 # Generated by GNU Autoconf 2.69 for libheif 1.5.0.
33 #
44 # Report bugs to <opensource@struktur.de>.
55 #
589589 # Identity of this package.
590590 PACKAGE_NAME='libheif'
591591 PACKAGE_TARNAME='libheif'
592 PACKAGE_VERSION='1.4.0'
593 PACKAGE_STRING='libheif 1.4.0'
592 PACKAGE_VERSION='1.5.0'
593 PACKAGE_STRING='libheif 1.5.0'
594594 PACKAGE_BUGREPORT='opensource@struktur.de'
595595 PACKAGE_URL=''
596596
638638 ENABLE_LIBFUZZER
639639 ENABLE_LIBFUZZER_FALSE
640640 ENABLE_LIBFUZZER_TRUE
641 FUZZING_ENGINE
641642 gdk_pixbuf_cache_file
642643 gdk_pixbuf_moduledir
643644 gdk_pixbuf_binarydir
667668 PKG_CONFIG_LIBDIR
668669 PKG_CONFIG_PATH
669670 PKG_CONFIG
671 HAVE_TESTS_FALSE
672 HAVE_TESTS_TRUE
670673 HAVE_VISIBILITY_FALSE
671674 HAVE_VISIBILITY_TRUE
672675 HAVE_VISIBILITY
702705 am__isrc
703706 MINGW_FALSE
704707 MINGW_TRUE
708 WITH_EXAMPLES
709 WITH_EXAMPLES_FALSE
710 WITH_EXAMPLES_TRUE
705711 HAVE_GO
706712 HAVE_GO_FALSE
707713 HAVE_GO_TRUE
727733 CCASFLAGS
728734 CCAS
729735 CPP
730 LT_SYS_LIBRARY_PATH
731736 OTOOL64
732737 OTOOL
733738 LIPO
793798 docdir
794799 oldincludedir
795800 includedir
796 runstatedir
797801 localstatedir
798802 sharedstatedir
799803 sysconfdir
820824 enable_static
821825 with_pic
822826 enable_fast_install
823 with_aix_soname
824827 with_gnu_ld
825828 with_sysroot
826829 enable_libtool_lock
827830 enable_dependency_tracking
828831 enable_go
832 enable_examples
829833 enable_silent_rules
830834 enable_visibility
835 enable_tests
831836 enable_gdk_pixbuf
832837 enable_libfuzzer
833838 enable_multithreading
840845 LDFLAGS
841846 LIBS
842847 CPPFLAGS
843 LT_SYS_LIBRARY_PATH
844848 CPP
845849 CCAS
846850 CCASFLAGS
897901 sysconfdir='${prefix}/etc'
898902 sharedstatedir='${prefix}/com'
899903 localstatedir='${prefix}/var'
900 runstatedir='${localstatedir}/run'
901904 includedir='${prefix}/include'
902905 oldincludedir='/usr/include'
903906 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
11501153 | -silent | --silent | --silen | --sile | --sil)
11511154 silent=yes ;;
11521155
1153 -runstatedir | --runstatedir | --runstatedi | --runstated \
1154 | --runstate | --runstat | --runsta | --runst | --runs \
1155 | --run | --ru | --r)
1156 ac_prev=runstatedir ;;
1157 -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1158 | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1159 | --run=* | --ru=* | --r=*)
1160 runstatedir=$ac_optarg ;;
1161
11621156 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
11631157 ac_prev=sbindir ;;
11641158 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
12961290 for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12971291 datadir sysconfdir sharedstatedir localstatedir includedir \
12981292 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1299 libdir localedir mandir runstatedir
1293 libdir localedir mandir
13001294 do
13011295 eval ac_val=\$$ac_var
13021296 # Remove trailing slashes.
14091403 # Omit some internal or obsolete options to make the list less imposing.
14101404 # This message is too long to be a string in the A/UX 3.1 sh.
14111405 cat <<_ACEOF
1412 \`configure' configures libheif 1.4.0 to adapt to many kinds of systems.
1406 \`configure' configures libheif 1.5.0 to adapt to many kinds of systems.
14131407
14141408 Usage: $0 [OPTION]... [VAR=VALUE]...
14151409
14491443 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
14501444 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
14511445 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
1452 --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
14531446 --libdir=DIR object code libraries [EPREFIX/lib]
14541447 --includedir=DIR C header files [PREFIX/include]
14551448 --oldincludedir=DIR C header files for non-gcc [/usr/include]
14811474
14821475 if test -n "$ac_init_help"; then
14831476 case $ac_init_help in
1484 short | recursive ) echo "Configuration of libheif 1.4.0:";;
1477 short | recursive ) echo "Configuration of libheif 1.5.0:";;
14851478 esac
14861479 cat <<\_ACEOF
14871480
14991492 --disable-dependency-tracking
15001493 speeds up one-time build
15011494 --disable-go Disable building Go code / examples.
1495 --disable-examples Disable building examples.
15021496 --enable-silent-rules less verbose build output (undo: "make V=1")
15031497 --disable-silent-rules verbose build output (undo: "make V=0")
15041498 --disable-visibility Disable visibility definitions.
1499 --enable-tests Enable compiling tests ('visibility' must be
1500 disabled).
15051501 --disable-gdk-pixbuf Disable building of gdk-pixbuf plugin.
15061502 --enable-libfuzzer Enable fuzzing with libFuzzer.
15071503 --disable-multithreading
15121508 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
15131509 --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
15141510 both]
1515 --with-aix-soname=aix|svr4|both
1516 shared library versioning (aka "SONAME") variant to
1517 provide on AIX, [default=aix].
15181511 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
1519 --with-sysroot[=DIR] Search for dependent libraries within DIR (or the
1520 compiler's sysroot if not specified).
1512 --with-sysroot=DIR Search for dependent libraries within DIR
1513 (or the compiler's sysroot if not specified).
15211514
15221515 Some influential environment variables:
15231516 CC C compiler command
15271520 LIBS libraries to pass to the linker, e.g. -l<library>
15281521 CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
15291522 you have headers in a nonstandard directory <include dir>
1530 LT_SYS_LIBRARY_PATH
1531 User-defined run-time library search path.
15321523 CPP C preprocessor
15331524 CCAS assembler compiler command (defaults to CC)
15341525 CCASFLAGS assembler compiler flags (defaults to CFLAGS)
16201611 test -n "$ac_init_help" && exit $ac_status
16211612 if $ac_init_version; then
16221613 cat <<\_ACEOF
1623 libheif configure 1.4.0
1614 libheif configure 1.5.0
16241615 generated by GNU Autoconf 2.69
16251616
16261617 Copyright (C) 2012 Free Software Foundation, Inc.
22182209 This file contains any messages produced by compilers while
22192210 running configure, to aid debugging if configure makes a mistake.
22202211
2221 It was created by libheif $as_me 1.4.0, which was
2212 It was created by libheif $as_me 1.5.0, which was
22222213 generated by GNU Autoconf 2.69. Invocation command line was
22232214
22242215 $ $0 $@
25712562
25722563
25732564 # Note: do not forget to set the version in the CMakeLists.txt file accordingly
2574 NUMERIC_VERSION=0x01040000 # Numeric representation of the version (A.B.C[.D] = 0xAABBCCDD)
2565 NUMERIC_VERSION=0x01050000 # Numeric representation of the version (A.B.C[.D] = 0xAABBCCDD)
25752566
25762567
25772568 # From https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html:
25802571 # If any interfaces have been added since the last public release, then increment age.
25812572 # If any interfaces have been removed or changed since the last public release, then set age to 0.
25822573
2583 LIBHEIF_CURRENT=5
2574 LIBHEIF_CURRENT=6
25842575 LIBHEIF_REVISION=0
2585 LIBHEIF_AGE=4
2576 LIBHEIF_AGE=5
25862577
25872578
25882579
27352726
27362727
27372728
2738 macro_version='2.4.6'
2739 macro_revision='2.4.6'
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753 ltmain=$ac_aux_dir/ltmain.sh
2729 macro_version='2.4.2'
2730 macro_revision='1.3337'
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744 ltmain="$ac_aux_dir/ltmain.sh"
27542745
27552746 # Backslashify metacharacters that are still active within
27562747 # double-quoted strings.
27992790 $ECHO ""
28002791 }
28012792
2802 case $ECHO in
2793 case "$ECHO" in
28032794 printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
28042795 $as_echo "printf" >&6; } ;;
28052796 print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
28212812
28222813
28232814
2824 # Expand $ac_aux_dir to an absolute path.
2825 am_aux_dir=`cd "$ac_aux_dir" && pwd`
2815 # expand $ac_aux_dir to an absolute path
2816 am_aux_dir=`cd $ac_aux_dir && pwd`
28262817
28272818 ac_ext=c
28282819 ac_cpp='$CPP $CPPFLAGS'
39733964
39743965 # Check whether --with-gnu-ld was given.
39753966 if test "${with_gnu_ld+set}" = set; then :
3976 withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes
3967 withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
39773968 else
39783969 with_gnu_ld=no
39793970 fi
39803971
39813972 ac_prog=ld
3982 if test yes = "$GCC"; then
3973 if test "$GCC" = yes; then
39833974 # Check if gcc -print-prog-name=ld gives a path.
39843975 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
39853976 $as_echo_n "checking for ld used by $CC... " >&6; }
39863977 case $host in
39873978 *-*-mingw*)
3988 # gcc leaves a trailing carriage return, which upsets mingw
3979 # gcc leaves a trailing carriage return which upsets mingw
39893980 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
39903981 *)
39913982 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
39993990 while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
40003991 ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
40013992 done
4002 test -z "$LD" && LD=$ac_prog
3993 test -z "$LD" && LD="$ac_prog"
40033994 ;;
40043995 "")
40053996 # If it fails, then pretend we aren't using GCC.
40104001 with_gnu_ld=unknown
40114002 ;;
40124003 esac
4013 elif test yes = "$with_gnu_ld"; then
4004 elif test "$with_gnu_ld" = yes; then
40144005 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
40154006 $as_echo_n "checking for GNU ld... " >&6; }
40164007 else
40214012 $as_echo_n "(cached) " >&6
40224013 else
40234014 if test -z "$LD"; then
4024 lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
4015 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
40254016 for ac_dir in $PATH; do
4026 IFS=$lt_save_ifs
4017 IFS="$lt_save_ifs"
40274018 test -z "$ac_dir" && ac_dir=.
40284019 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
4029 lt_cv_path_LD=$ac_dir/$ac_prog
4020 lt_cv_path_LD="$ac_dir/$ac_prog"
40304021 # Check to see if the program is GNU ld. I'd rather use --version,
40314022 # but apparently some variants of GNU ld only accept -v.
40324023 # Break only if it was the GNU/non-GNU ld that we prefer.
40334024 case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
40344025 *GNU* | *'with BFD'*)
4035 test no != "$with_gnu_ld" && break
4026 test "$with_gnu_ld" != no && break
40364027 ;;
40374028 *)
4038 test yes != "$with_gnu_ld" && break
4029 test "$with_gnu_ld" != yes && break
40394030 ;;
40404031 esac
40414032 fi
40424033 done
4043 IFS=$lt_save_ifs
4044 else
4045 lt_cv_path_LD=$LD # Let the user override the test with a path.
4046 fi
4047 fi
4048
4049 LD=$lt_cv_path_LD
4034 IFS="$lt_save_ifs"
4035 else
4036 lt_cv_path_LD="$LD" # Let the user override the test with a path.
4037 fi
4038 fi
4039
4040 LD="$lt_cv_path_LD"
40504041 if test -n "$LD"; then
40514042 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
40524043 $as_echo "$LD" >&6; }
40894080 else
40904081 if test -n "$NM"; then
40914082 # Let the user override the test.
4092 lt_cv_path_NM=$NM
4093 else
4094 lt_nm_to_check=${ac_tool_prefix}nm
4083 lt_cv_path_NM="$NM"
4084 else
4085 lt_nm_to_check="${ac_tool_prefix}nm"
40954086 if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
40964087 lt_nm_to_check="$lt_nm_to_check nm"
40974088 fi
40984089 for lt_tmp_nm in $lt_nm_to_check; do
4099 lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
4090 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
41004091 for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
4101 IFS=$lt_save_ifs
4092 IFS="$lt_save_ifs"
41024093 test -z "$ac_dir" && ac_dir=.
4103 tmp_nm=$ac_dir/$lt_tmp_nm
4104 if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
4094 tmp_nm="$ac_dir/$lt_tmp_nm"
4095 if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
41054096 # Check to see if the nm accepts a BSD-compat flag.
4106 # Adding the 'sed 1q' prevents false positives on HP-UX, which says:
4097 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
41074098 # nm: unknown option "B" ignored
41084099 # Tru64's nm complains that /dev/null is an invalid object file
4109 # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
4110 case $build_os in
4111 mingw*) lt_bad_file=conftest.nm/nofile ;;
4112 *) lt_bad_file=/dev/null ;;
4113 esac
4114 case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
4115 *$lt_bad_file* | *'Invalid file or object type'*)
4100 case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
4101 */dev/null* | *'Invalid file or object type'*)
41164102 lt_cv_path_NM="$tmp_nm -B"
4117 break 2
4103 break
41184104 ;;
41194105 *)
41204106 case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
41214107 */dev/null*)
41224108 lt_cv_path_NM="$tmp_nm -p"
4123 break 2
4109 break
41244110 ;;
41254111 *)
41264112 lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
41314117 esac
41324118 fi
41334119 done
4134 IFS=$lt_save_ifs
4120 IFS="$lt_save_ifs"
41354121 done
41364122 : ${lt_cv_path_NM=no}
41374123 fi
41384124 fi
41394125 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
41404126 $as_echo "$lt_cv_path_NM" >&6; }
4141 if test no != "$lt_cv_path_NM"; then
4142 NM=$lt_cv_path_NM
4127 if test "$lt_cv_path_NM" != "no"; then
4128 NM="$lt_cv_path_NM"
41434129 else
41444130 # Didn't find any BSD compatible name lister, look for dumpbin.
41454131 if test -n "$DUMPBIN"; then :
42454231 fi
42464232 fi
42474233
4248 case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
4234 case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
42494235 *COFF*)
4250 DUMPBIN="$DUMPBIN -symbols -headers"
4236 DUMPBIN="$DUMPBIN -symbols"
42514237 ;;
42524238 *)
42534239 DUMPBIN=:
42554241 esac
42564242 fi
42574243
4258 if test : != "$DUMPBIN"; then
4259 NM=$DUMPBIN
4244 if test "$DUMPBIN" != ":"; then
4245 NM="$DUMPBIN"
42604246 fi
42614247 fi
42624248 test -z "$NM" && NM=nm
43074293 $as_echo_n "(cached) " >&6
43084294 else
43094295 i=0
4310 teststring=ABCD
4296 teststring="ABCD"
43114297
43124298 case $build_os in
43134299 msdosdjgpp*)
43474333 lt_cv_sys_max_cmd_len=8192;
43484334 ;;
43494335
4350 bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
4336 netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
43514337 # This has been around since 386BSD, at least. Likely further.
43524338 if test -x /sbin/sysctl; then
43534339 lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
43984384 *)
43994385 lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
44004386 if test -n "$lt_cv_sys_max_cmd_len" && \
4401 test undefined != "$lt_cv_sys_max_cmd_len"; then
4387 test undefined != "$lt_cv_sys_max_cmd_len"; then
44024388 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
44034389 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
44044390 else
44054391 # Make teststring a little bigger before we do anything with it.
44064392 # a 1K string should be a reasonable start.
4407 for i in 1 2 3 4 5 6 7 8; do
4393 for i in 1 2 3 4 5 6 7 8 ; do
44084394 teststring=$teststring$teststring
44094395 done
44104396 SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
44114397 # If test is not a shell built-in, we'll probably end up computing a
44124398 # maximum length that is only half of the actual maximum length, but
44134399 # we can't tell.
4414 while { test X`env echo "$teststring$teststring" 2>/dev/null` \
4400 while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
44154401 = "X$teststring$teststring"; } >/dev/null 2>&1 &&
4416 test 17 != "$i" # 1/2 MB should be enough
4402 test $i != 17 # 1/2 MB should be enough
44174403 do
44184404 i=`expr $i + 1`
44194405 teststring=$teststring$teststring
44314417
44324418 fi
44334419
4434 if test -n "$lt_cv_sys_max_cmd_len"; then
4420 if test -n $lt_cv_sys_max_cmd_len ; then
44354421 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
44364422 $as_echo "$lt_cv_sys_max_cmd_len" >&6; }
44374423 else
44484434 : ${CP="cp -f"}
44494435 : ${MV="mv -f"}
44504436 : ${RM="rm -f"}
4437
4438 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
4439 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
4440 # Try some XSI features
4441 xsi_shell=no
4442 ( _lt_dummy="a/b/c"
4443 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
4444 = c,a/b,b/c, \
4445 && eval 'test $(( 1 + 1 )) -eq 2 \
4446 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
4447 && xsi_shell=yes
4448 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
4449 $as_echo "$xsi_shell" >&6; }
4450
4451
4452 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
4453 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
4454 lt_shell_append=no
4455 ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
4456 >/dev/null 2>&1 \
4457 && lt_shell_append=yes
4458 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
4459 $as_echo "$lt_shell_append" >&6; }
4460
44514461
44524462 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
44534463 lt_unset=unset
45714581 reload_cmds='$LD$reload_flag -o $output$reload_objs'
45724582 case $host_os in
45734583 cygwin* | mingw* | pw32* | cegcc*)
4574 if test yes != "$GCC"; then
4584 if test "$GCC" != yes; then
45754585 reload_cmds=false
45764586 fi
45774587 ;;
45784588 darwin*)
4579 if test yes = "$GCC"; then
4580 reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs'
4589 if test "$GCC" = yes; then
4590 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
45814591 else
45824592 reload_cmds='$LD$reload_flag -o $output$reload_objs'
45834593 fi
47054715 # Need to set the preceding variable on all platforms that support
47064716 # interlibrary dependencies.
47074717 # 'none' -- dependencies not supported.
4708 # 'unknown' -- same as none, but documents that we really don't know.
4718 # `unknown' -- same as none, but documents that we really don't know.
47094719 # 'pass_all' -- all dependencies passed with no checks.
47104720 # 'test_compile' -- check by making test program.
47114721 # 'file_magic [[regex]]' -- check by looking for files in library path
4712 # that responds to the $file_magic_cmd with a given extended regex.
4713 # If you have 'file' or equivalent on your system and you're not sure
4714 # whether 'pass_all' will *always* work, you probably want this one.
4722 # which responds to the $file_magic_cmd with a given extended regex.
4723 # If you have `file' or equivalent on your system and you're not sure
4724 # whether `pass_all' will *always* work, you probably want this one.
47154725
47164726 case $host_os in
47174727 aix[4-9]*)
47384748 # Base MSYS/MinGW do not provide the 'file' command needed by
47394749 # func_win32_libid shell function, so use a weaker test based on 'objdump',
47404750 # unless we find 'file', for example because we are cross-compiling.
4741 if ( file / ) >/dev/null 2>&1; then
4751 # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
4752 if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
47424753 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
47434754 lt_cv_file_magic_cmd='func_win32_libid'
47444755 else
48344845 lt_cv_deplibs_check_method=pass_all
48354846 ;;
48364847
4837 openbsd* | bitrig*)
4838 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
4848 openbsd*)
4849 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
48394850 lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
48404851 else
48414852 lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
48884899 tpf*)
48894900 lt_cv_deplibs_check_method=pass_all
48904901 ;;
4891 os2*)
4892 lt_cv_deplibs_check_method=pass_all
4893 ;;
48944902 esac
48954903
48964904 fi
50485056
50495057 case $host_os in
50505058 cygwin* | mingw* | pw32* | cegcc*)
5051 # two different shell functions defined in ltmain.sh;
5052 # decide which one to use based on capabilities of $DLLTOOL
5059 # two different shell functions defined in ltmain.sh
5060 # decide which to use based on capabilities of $DLLTOOL
50535061 case `$DLLTOOL --help 2>&1` in
50545062 *--identify-strict*)
50555063 lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
50615069 ;;
50625070 *)
50635071 # fallback: assume linklib IS sharedlib
5064 lt_cv_sharedlib_from_linklib_cmd=$ECHO
5072 lt_cv_sharedlib_from_linklib_cmd="$ECHO"
50655073 ;;
50665074 esac
50675075
52165224 ac_status=$?
52175225 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
52185226 test $ac_status = 0; }
5219 if test 0 -eq "$ac_status"; then
5227 if test "$ac_status" -eq 0; then
52205228 # Ensure the archiver fails upon bogus file names.
52215229 rm -f conftest.$ac_objext libconftest.a
52225230 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
52245232 ac_status=$?
52255233 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
52265234 test $ac_status = 0; }
5227 if test 0 -ne "$ac_status"; then
5235 if test "$ac_status" -ne 0; then
52285236 lt_cv_ar_at_file=@
52295237 fi
52305238 fi
52375245 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
52385246 $as_echo "$lt_cv_ar_at_file" >&6; }
52395247
5240 if test no = "$lt_cv_ar_at_file"; then
5248 if test "x$lt_cv_ar_at_file" = xno; then
52415249 archiver_list_spec=
52425250 else
52435251 archiver_list_spec=$lt_cv_ar_at_file
54545462
54555463 if test -n "$RANLIB"; then
54565464 case $host_os in
5457 bitrig* | openbsd*)
5465 openbsd*)
54585466 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
54595467 ;;
54605468 *)
55865594 symcode='[ABCDGISTW]'
55875595 ;;
55885596 hpux*)
5589 if test ia64 = "$host_cpu"; then
5597 if test "$host_cpu" = ia64; then
55905598 symcode='[ABCDEGRST]'
55915599 fi
55925600 ;;
56195627 symcode='[ABCDGIRSTW]' ;;
56205628 esac
56215629
5622 if test "$lt_cv_nm_interface" = "MS dumpbin"; then
5623 # Gets list of data symbols to import.
5624 lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
5625 # Adjust the below global symbol transforms to fixup imported variables.
5626 lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
5627 lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'"
5628 lt_c_name_lib_hook="\
5629 -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\
5630 -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'"
5631 else
5632 # Disable hooks by default.
5633 lt_cv_sys_global_symbol_to_import=
5634 lt_cdecl_hook=
5635 lt_c_name_hook=
5636 lt_c_name_lib_hook=
5637 fi
5638
56395630 # Transform an extracted symbol line into a proper C declaration.
56405631 # Some systems (esp. on ia64) link data and code symbols differently,
56415632 # so use this general approach.
5642 lt_cv_sys_global_symbol_to_cdecl="sed -n"\
5643 $lt_cdecl_hook\
5644 " -e 's/^T .* \(.*\)$/extern int \1();/p'"\
5645 " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
5633 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
56465634
56475635 # Transform an extracted symbol line into symbol name and symbol address
5648 lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
5649 $lt_c_name_hook\
5650 " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
5651 " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'"
5652
5653 # Transform an extracted symbol line into symbol name with lib prefix and
5654 # symbol address.
5655 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
5656 $lt_c_name_lib_hook\
5657 " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
5658 " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\
5659 " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'"
5636 lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
5637 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'"
56605638
56615639 # Handle CRLF in mingw tool chain
56625640 opt_cr=
56745652
56755653 # Write the raw and C identifiers.
56765654 if test "$lt_cv_nm_interface" = "MS dumpbin"; then
5677 # Fake it for dumpbin and say T for any non-static function,
5678 # D for any global variable and I for any imported variable.
5655 # Fake it for dumpbin and say T for any non-static function
5656 # and D for any global variable.
56795657 # Also find C++ and __fastcall symbols from MSVC++,
56805658 # which start with @ or ?.
56815659 lt_cv_sys_global_symbol_pipe="$AWK '"\
56825660 " {last_section=section; section=\$ 3};"\
56835661 " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
56845662 " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
5685 " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
5686 " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
5687 " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
56885663 " \$ 0!~/External *\|/{next};"\
56895664 " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
56905665 " {if(hide[section]) next};"\
5691 " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
5692 " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
5693 " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
5694 " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
5666 " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
5667 " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
5668 " s[1]~/^[@?]/{print s[1], s[1]; next};"\
5669 " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
56955670 " ' prfx=^$ac_symprfx"
56965671 else
56975672 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
57395714 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
57405715 cat <<_LT_EOF > conftest.$ac_ext
57415716 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
5742 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
5743 /* DATA imports from DLLs on WIN32 can't be const, because runtime
5717 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
5718 /* DATA imports from DLLs on WIN32 con't be const, because runtime
57445719 relocations are performed -- see ld's documentation on pseudo-relocs. */
57455720 # define LT_DLSYM_CONST
5746 #elif defined __osf__
5721 #elif defined(__osf__)
57475722 /* This system does not cope well with relocations in const data. */
57485723 # define LT_DLSYM_CONST
57495724 #else
57695744 {
57705745 { "@PROGRAM@", (void *) 0 },
57715746 _LT_EOF
5772 $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
5747 $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
57735748 cat <<\_LT_EOF >> conftest.$ac_ext
57745749 {0, (void *) 0}
57755750 };
57895764 mv conftest.$ac_objext conftstm.$ac_objext
57905765 lt_globsym_save_LIBS=$LIBS
57915766 lt_globsym_save_CFLAGS=$CFLAGS
5792 LIBS=conftstm.$ac_objext
5767 LIBS="conftstm.$ac_objext"
57935768 CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
57945769 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
57955770 (eval $ac_link) 2>&5
57965771 ac_status=$?
57975772 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
5798 test $ac_status = 0; } && test -s conftest$ac_exeext; then
5773 test $ac_status = 0; } && test -s conftest${ac_exeext}; then
57995774 pipe_works=yes
58005775 fi
58015776 LIBS=$lt_globsym_save_LIBS
58165791 rm -rf conftest* conftst*
58175792
58185793 # Do not use the global_symbol_pipe unless it works.
5819 if test yes = "$pipe_works"; then
5794 if test "$pipe_works" = yes; then
58205795 break
58215796 else
58225797 lt_cv_sys_global_symbol_pipe=
58695844
58705845
58715846
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
58825847 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
58835848 $as_echo_n "checking for sysroot... " >&6; }
58845849
58915856
58925857
58935858 lt_sysroot=
5894 case $with_sysroot in #(
5859 case ${with_sysroot} in #(
58955860 yes)
5896 if test yes = "$GCC"; then
5861 if test "$GCC" = yes; then
58975862 lt_sysroot=`$CC --print-sysroot 2>/dev/null`
58985863 fi
58995864 ;; #(
59035868 no|'')
59045869 ;; #(
59055870 *)
5906 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5
5907 $as_echo "$with_sysroot" >&6; }
5871 { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
5872 $as_echo "${with_sysroot}" >&6; }
59085873 as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
59095874 ;;
59105875 esac
59165881
59175882
59185883
5919 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5
5920 $as_echo_n "checking for a working dd... " >&6; }
5921 if ${ac_cv_path_lt_DD+:} false; then :
5922 $as_echo_n "(cached) " >&6
5923 else
5924 printf 0123456789abcdef0123456789abcdef >conftest.i
5925 cat conftest.i conftest.i >conftest2.i
5926 : ${lt_DD:=$DD}
5927 if test -z "$lt_DD"; then
5928 ac_path_lt_DD_found=false
5929 # Loop through the user's path and test for each of PROGNAME-LIST
5930 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5931 for as_dir in $PATH
5932 do
5933 IFS=$as_save_IFS
5934 test -z "$as_dir" && as_dir=.
5935 for ac_prog in dd; do
5936 for ac_exec_ext in '' $ac_executable_extensions; do
5937 ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext"
5938 as_fn_executable_p "$ac_path_lt_DD" || continue
5939 if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
5940 cmp -s conftest.i conftest.out \
5941 && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
5942 fi
5943 $ac_path_lt_DD_found && break 3
5944 done
5945 done
5946 done
5947 IFS=$as_save_IFS
5948 if test -z "$ac_cv_path_lt_DD"; then
5949 :
5950 fi
5951 else
5952 ac_cv_path_lt_DD=$lt_DD
5953 fi
5954
5955 rm -f conftest.i conftest2.i conftest.out
5956 fi
5957 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5
5958 $as_echo "$ac_cv_path_lt_DD" >&6; }
5959
5960
5961 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5
5962 $as_echo_n "checking how to truncate binary pipes... " >&6; }
5963 if ${lt_cv_truncate_bin+:} false; then :
5964 $as_echo_n "(cached) " >&6
5965 else
5966 printf 0123456789abcdef0123456789abcdef >conftest.i
5967 cat conftest.i conftest.i >conftest2.i
5968 lt_cv_truncate_bin=
5969 if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
5970 cmp -s conftest.i conftest.out \
5971 && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
5972 fi
5973 rm -f conftest.i conftest2.i conftest.out
5974 test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"
5975 fi
5976 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5
5977 $as_echo "$lt_cv_truncate_bin" >&6; }
5978
5979
5980
5981
5982
5983
5984
5985 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
5986 func_cc_basename ()
5987 {
5988 for cc_temp in $*""; do
5989 case $cc_temp in
5990 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
5991 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
5992 \-*) ;;
5993 *) break;;
5994 esac
5995 done
5996 func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
5997 }
5998
59995884 # Check whether --enable-libtool-lock was given.
60005885 if test "${enable_libtool_lock+set}" = set; then :
60015886 enableval=$enable_libtool_lock;
60025887 fi
60035888
6004 test no = "$enable_libtool_lock" || enable_libtool_lock=yes
5889 test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
60055890
60065891 # Some flags need to be propagated to the compiler or linker for good
60075892 # libtool support.
60085893 case $host in
60095894 ia64-*-hpux*)
6010 # Find out what ABI is being produced by ac_compile, and set mode
6011 # options accordingly.
5895 # Find out which ABI we are using.
60125896 echo 'int i;' > conftest.$ac_ext
60135897 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
60145898 (eval $ac_compile) 2>&5
60175901 test $ac_status = 0; }; then
60185902 case `/usr/bin/file conftest.$ac_objext` in
60195903 *ELF-32*)
6020 HPUX_IA64_MODE=32
5904 HPUX_IA64_MODE="32"
60215905 ;;
60225906 *ELF-64*)
6023 HPUX_IA64_MODE=64
5907 HPUX_IA64_MODE="64"
60245908 ;;
60255909 esac
60265910 fi
60275911 rm -rf conftest*
60285912 ;;
60295913 *-*-irix6*)
6030 # Find out what ABI is being produced by ac_compile, and set linker
6031 # options accordingly.
5914 # Find out which ABI we are using.
60325915 echo '#line '$LINENO' "configure"' > conftest.$ac_ext
60335916 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
60345917 (eval $ac_compile) 2>&5
60355918 ac_status=$?
60365919 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
60375920 test $ac_status = 0; }; then
6038 if test yes = "$lt_cv_prog_gnu_ld"; then
5921 if test "$lt_cv_prog_gnu_ld" = yes; then
60395922 case `/usr/bin/file conftest.$ac_objext` in
60405923 *32-bit*)
60415924 LD="${LD-ld} -melf32bsmip"
60645947 rm -rf conftest*
60655948 ;;
60665949
6067 mips64*-*linux*)
6068 # Find out what ABI is being produced by ac_compile, and set linker
6069 # options accordingly.
6070 echo '#line '$LINENO' "configure"' > conftest.$ac_ext
6071 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
6072 (eval $ac_compile) 2>&5
6073 ac_status=$?
6074 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
6075 test $ac_status = 0; }; then
6076 emul=elf
6077 case `/usr/bin/file conftest.$ac_objext` in
6078 *32-bit*)
6079 emul="${emul}32"
6080 ;;
6081 *64-bit*)
6082 emul="${emul}64"
6083 ;;
6084 esac
6085 case `/usr/bin/file conftest.$ac_objext` in
6086 *MSB*)
6087 emul="${emul}btsmip"
6088 ;;
6089 *LSB*)
6090 emul="${emul}ltsmip"
6091 ;;
6092 esac
6093 case `/usr/bin/file conftest.$ac_objext` in
6094 *N32*)
6095 emul="${emul}n32"
6096 ;;
6097 esac
6098 LD="${LD-ld} -m $emul"
6099 fi
6100 rm -rf conftest*
6101 ;;
6102
61035950 x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
61045951 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
6105 # Find out what ABI is being produced by ac_compile, and set linker
6106 # options accordingly. Note that the listed cases only cover the
6107 # situations where additional linker options are needed (such as when
6108 # doing 32-bit compilation for a host where ld defaults to 64-bit, or
6109 # vice versa); the common cases where no linker options are needed do
6110 # not appear in the list.
5952 # Find out which ABI we are using.
61115953 echo 'int i;' > conftest.$ac_ext
61125954 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
61135955 (eval $ac_compile) 2>&5
61305972 ;;
61315973 esac
61325974 ;;
6133 powerpc64le-*linux*)
5975 powerpc64le-*)
61345976 LD="${LD-ld} -m elf32lppclinux"
61355977 ;;
6136 powerpc64-*linux*)
5978 powerpc64-*)
61375979 LD="${LD-ld} -m elf32ppclinux"
61385980 ;;
61395981 s390x-*linux*)
61525994 x86_64-*linux*)
61535995 LD="${LD-ld} -m elf_x86_64"
61545996 ;;
6155 powerpcle-*linux*)
5997 powerpcle-*)
61565998 LD="${LD-ld} -m elf64lppc"
61575999 ;;
6158 powerpc-*linux*)
6000 powerpc-*)
61596001 LD="${LD-ld} -m elf64ppc"
61606002 ;;
61616003 s390*-*linux*|s390*-*tpf*)
61736015
61746016 *-*-sco3.2v5*)
61756017 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
6176 SAVE_CFLAGS=$CFLAGS
6018 SAVE_CFLAGS="$CFLAGS"
61776019 CFLAGS="$CFLAGS -belf"
61786020 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
61796021 $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
62136055 fi
62146056 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
62156057 $as_echo "$lt_cv_cc_needs_belf" >&6; }
6216 if test yes != "$lt_cv_cc_needs_belf"; then
6058 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
62176059 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
6218 CFLAGS=$SAVE_CFLAGS
6060 CFLAGS="$SAVE_CFLAGS"
62196061 fi
62206062 ;;
62216063 *-*solaris*)
6222 # Find out what ABI is being produced by ac_compile, and set linker
6223 # options accordingly.
6064 # Find out which ABI we are using.
62246065 echo 'int i;' > conftest.$ac_ext
62256066 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
62266067 (eval $ac_compile) 2>&5
62326073 case $lt_cv_prog_gnu_ld in
62336074 yes*)
62346075 case $host in
6235 i?86-*-solaris*|x86_64-*-solaris*)
6076 i?86-*-solaris*)
62366077 LD="${LD-ld} -m elf_x86_64"
62376078 ;;
62386079 sparc*-*-solaris*)
62416082 esac
62426083 # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
62436084 if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
6244 LD=${LD-ld}_sol2
6085 LD="${LD-ld}_sol2"
62456086 fi
62466087 ;;
62476088 *)
62576098 ;;
62586099 esac
62596100
6260 need_locks=$enable_libtool_lock
6101 need_locks="$enable_libtool_lock"
62616102
62626103 if test -n "$ac_tool_prefix"; then
62636104 # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
63686209 fi
63696210 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
63706211 $as_echo "$lt_cv_path_mainfest_tool" >&6; }
6371 if test yes != "$lt_cv_path_mainfest_tool"; then
6212 if test "x$lt_cv_path_mainfest_tool" != xyes; then
63726213 MANIFEST_TOOL=:
63736214 fi
63746215
68716712 $as_echo_n "(cached) " >&6
68726713 else
68736714 lt_cv_apple_cc_single_mod=no
6874 if test -z "$LT_MULTI_MODULE"; then
6715 if test -z "${LT_MULTI_MODULE}"; then
68756716 # By default we will add the -single_module flag. You can override
68766717 # by either setting the environment variable LT_MULTI_MODULE
68776718 # non-empty at configure time, or by adding -multi_module to the
68896730 cat conftest.err >&5
68906731 # Otherwise, if the output was created with a 0 exit code from
68916732 # the compiler, it worked.
6892 elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
6733 elif test -f libconftest.dylib && test $_lt_result -eq 0; then
68936734 lt_cv_apple_cc_single_mod=yes
68946735 else
68956736 cat conftest.err >&5
69286769 fi
69296770 rm -f core conftest.err conftest.$ac_objext \
69306771 conftest$ac_exeext conftest.$ac_ext
6931 LDFLAGS=$save_LDFLAGS
6772 LDFLAGS="$save_LDFLAGS"
69326773
69336774 fi
69346775 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
69576798 _lt_result=$?
69586799 if test -s conftest.err && $GREP force_load conftest.err; then
69596800 cat conftest.err >&5
6960 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
6801 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
69616802 lt_cv_ld_force_load=yes
69626803 else
69636804 cat conftest.err >&5
69706811 $as_echo "$lt_cv_ld_force_load" >&6; }
69716812 case $host_os in
69726813 rhapsody* | darwin1.[012])
6973 _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
6814 _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
69746815 darwin1.*)
6975 _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
6816 _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
69766817 darwin*) # darwin 5.x on
69776818 # if running on 10.5 or later, the deployment target defaults
69786819 # to the OS version, if on x86, and 10.4, the deployment
69796820 # target defaults to 10.4. Don't you love it?
69806821 case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
69816822 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
6982 _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
6983 10.[012][,.]*)
6984 _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
6823 _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
6824 10.[012]*)
6825 _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
69856826 10.*)
6986 _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
6827 _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
69876828 esac
69886829 ;;
69896830 esac
6990 if test yes = "$lt_cv_apple_cc_single_mod"; then
6831 if test "$lt_cv_apple_cc_single_mod" = "yes"; then
69916832 _lt_dar_single_mod='$single_module'
69926833 fi
6993 if test yes = "$lt_cv_ld_exported_symbols_list"; then
6994 _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
6834 if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
6835 _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
69956836 else
6996 _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
6837 _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
69976838 fi
6998 if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
6839 if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
69996840 _lt_dsymutil='~$DSYMUTIL $lib || :'
70006841 else
70016842 _lt_dsymutil=
70026843 fi
70036844 ;;
70046845 esac
7005
7006 # func_munge_path_list VARIABLE PATH
7007 # -----------------------------------
7008 # VARIABLE is name of variable containing _space_ separated list of
7009 # directories to be munged by the contents of PATH, which is string
7010 # having a format:
7011 # "DIR[:DIR]:"
7012 # string "DIR[ DIR]" will be prepended to VARIABLE
7013 # ":DIR[:DIR]"
7014 # string "DIR[ DIR]" will be appended to VARIABLE
7015 # "DIRP[:DIRP]::[DIRA:]DIRA"
7016 # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
7017 # "DIRA[ DIRA]" will be appended to VARIABLE
7018 # "DIR[:DIR]"
7019 # VARIABLE will be replaced by "DIR[ DIR]"
7020 func_munge_path_list ()
7021 {
7022 case x$2 in
7023 x)
7024 ;;
7025 *:)
7026 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
7027 ;;
7028 x:*)
7029 eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
7030 ;;
7031 *::*)
7032 eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
7033 eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
7034 ;;
7035 *)
7036 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
7037 ;;
7038 esac
7039 }
70406846
70416847 ac_ext=c
70426848 ac_cpp='$CPP $CPPFLAGS'
73417147 *)
73427148 enable_shared=no
73437149 # Look at the argument we got. We use all the common list separators.
7344 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
7150 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
73457151 for pkg in $enableval; do
7346 IFS=$lt_save_ifs
7152 IFS="$lt_save_ifs"
73477153 if test "X$pkg" = "X$p"; then
73487154 enable_shared=yes
73497155 fi
73507156 done
7351 IFS=$lt_save_ifs
7157 IFS="$lt_save_ifs"
73527158 ;;
73537159 esac
73547160 else
73727178 *)
73737179 enable_static=no
73747180 # Look at the argument we got. We use all the common list separators.
7375 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
7181 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
73767182 for pkg in $enableval; do
7377 IFS=$lt_save_ifs
7183 IFS="$lt_save_ifs"
73787184 if test "X$pkg" = "X$p"; then
73797185 enable_static=yes
73807186 fi
73817187 done
7382 IFS=$lt_save_ifs
7188 IFS="$lt_save_ifs"
73837189 ;;
73847190 esac
73857191 else
74037209 *)
74047210 pic_mode=default
74057211 # Look at the argument we got. We use all the common list separators.
7406 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
7212 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
74077213 for lt_pkg in $withval; do
7408 IFS=$lt_save_ifs
7214 IFS="$lt_save_ifs"
74097215 if test "X$lt_pkg" = "X$lt_p"; then
74107216 pic_mode=yes
74117217 fi
74127218 done
7413 IFS=$lt_save_ifs
7219 IFS="$lt_save_ifs"
74147220 ;;
74157221 esac
74167222 else
74177223 pic_mode=default
74187224 fi
74197225
7226
7227 test -z "$pic_mode" && pic_mode=default
74207228
74217229
74227230
74337241 *)
74347242 enable_fast_install=no
74357243 # Look at the argument we got. We use all the common list separators.
7436 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
7244 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
74377245 for pkg in $enableval; do
7438 IFS=$lt_save_ifs
7246 IFS="$lt_save_ifs"
74397247 if test "X$pkg" = "X$p"; then
74407248 enable_fast_install=yes
74417249 fi
74427250 done
7443 IFS=$lt_save_ifs
7251 IFS="$lt_save_ifs"
74447252 ;;
74457253 esac
74467254 else
74547262
74557263
74567264
7457 shared_archive_member_spec=
7458 case $host,$enable_shared in
7459 power*-*-aix[5-9]*,yes)
7460 { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5
7461 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; }
7462
7463 # Check whether --with-aix-soname was given.
7464 if test "${with_aix_soname+set}" = set; then :
7465 withval=$with_aix_soname; case $withval in
7466 aix|svr4|both)
7467 ;;
7468 *)
7469 as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5
7470 ;;
7471 esac
7472 lt_cv_with_aix_soname=$with_aix_soname
7473 else
7474 if ${lt_cv_with_aix_soname+:} false; then :
7475 $as_echo_n "(cached) " >&6
7476 else
7477 lt_cv_with_aix_soname=aix
7478 fi
7479
7480 with_aix_soname=$lt_cv_with_aix_soname
7481 fi
7482
7483 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5
7484 $as_echo "$with_aix_soname" >&6; }
7485 if test aix != "$with_aix_soname"; then
7486 # For the AIX way of multilib, we name the shared archive member
7487 # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
7488 # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
7489 # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
7490 # the AIX toolchain works better with OBJECT_MODE set (default 32).
7491 if test 64 = "${OBJECT_MODE-32}"; then
7492 shared_archive_member_spec=shr_64
7493 else
7494 shared_archive_member_spec=shr
7495 fi
7496 fi
7497 ;;
7498 *)
7499 with_aix_soname=aix
7500 ;;
7501 esac
7502
7503
7504
7505
7506
7507
7508
75097265
75107266
75117267
75127268 # This can be used to rebuild libtool when needed
7513 LIBTOOL_DEPS=$ltmain
7269 LIBTOOL_DEPS="$ltmain"
75147270
75157271 # Always use our own libtool.
75167272 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
75597315
75607316
75617317
7562 if test -n "${ZSH_VERSION+set}"; then
7318 if test -n "${ZSH_VERSION+set}" ; then
75637319 setopt NO_GLOB_SUBST
75647320 fi
75657321
75987354 # AIX sometimes has problems with the GCC collect2 program. For some
75997355 # reason, if we set the COLLECT_NAMES environment variable, the problems
76007356 # vanish in a puff of smoke.
7601 if test set != "${COLLECT_NAMES+set}"; then
7357 if test "X${COLLECT_NAMES+set}" != Xset; then
76027358 COLLECT_NAMES=
76037359 export COLLECT_NAMES
76047360 fi
76097365 ofile=libtool
76107366 can_build_shared=yes
76117367
7612 # All known linkers require a '.a' archive for static linking (except MSVC,
7368 # All known linkers require a `.a' archive for static linking (except MSVC,
76137369 # which needs '.lib').
76147370 libext=a
76157371
7616 with_gnu_ld=$lt_cv_prog_gnu_ld
7617
7618 old_CC=$CC
7619 old_CFLAGS=$CFLAGS
7372 with_gnu_ld="$lt_cv_prog_gnu_ld"
7373
7374 old_CC="$CC"
7375 old_CFLAGS="$CFLAGS"
76207376
76217377 # Set sane defaults for various variables
76227378 test -z "$CC" && CC=cc
76257381 test -z "$LD" && LD=ld
76267382 test -z "$ac_objext" && ac_objext=o
76277383
7628 func_cc_basename $compiler
7629 cc_basename=$func_cc_basename_result
7384 for cc_temp in $compiler""; do
7385 case $cc_temp in
7386 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
7387 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
7388 \-*) ;;
7389 *) break;;
7390 esac
7391 done
7392 cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
76307393
76317394
76327395 # Only perform the check for file, if the check method requires it
76417404 else
76427405 case $MAGIC_CMD in
76437406 [\\/*] | ?:[\\/]*)
7644 lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
7407 lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
76457408 ;;
76467409 *)
7647 lt_save_MAGIC_CMD=$MAGIC_CMD
7648 lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
7410 lt_save_MAGIC_CMD="$MAGIC_CMD"
7411 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
76497412 ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
76507413 for ac_dir in $ac_dummy; do
7651 IFS=$lt_save_ifs
7414 IFS="$lt_save_ifs"
76527415 test -z "$ac_dir" && ac_dir=.
7653 if test -f "$ac_dir/${ac_tool_prefix}file"; then
7654 lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file"
7416 if test -f $ac_dir/${ac_tool_prefix}file; then
7417 lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
76557418 if test -n "$file_magic_test_file"; then
76567419 case $deplibs_check_method in
76577420 "file_magic "*)
76587421 file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
7659 MAGIC_CMD=$lt_cv_path_MAGIC_CMD
7422 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
76607423 if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
76617424 $EGREP "$file_magic_regex" > /dev/null; then
76627425 :
76797442 break
76807443 fi
76817444 done
7682 IFS=$lt_save_ifs
7683 MAGIC_CMD=$lt_save_MAGIC_CMD
7445 IFS="$lt_save_ifs"
7446 MAGIC_CMD="$lt_save_MAGIC_CMD"
76847447 ;;
76857448 esac
76867449 fi
76877450
7688 MAGIC_CMD=$lt_cv_path_MAGIC_CMD
7451 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
76897452 if test -n "$MAGIC_CMD"; then
76907453 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
76917454 $as_echo "$MAGIC_CMD" >&6; }
77077470 else
77087471 case $MAGIC_CMD in
77097472 [\\/*] | ?:[\\/]*)
7710 lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
7473 lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
77117474 ;;
77127475 *)
7713 lt_save_MAGIC_CMD=$MAGIC_CMD
7714 lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
7476 lt_save_MAGIC_CMD="$MAGIC_CMD"
7477 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
77157478 ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
77167479 for ac_dir in $ac_dummy; do
7717 IFS=$lt_save_ifs
7480 IFS="$lt_save_ifs"
77187481 test -z "$ac_dir" && ac_dir=.
7719 if test -f "$ac_dir/file"; then
7720 lt_cv_path_MAGIC_CMD=$ac_dir/"file"
7482 if test -f $ac_dir/file; then
7483 lt_cv_path_MAGIC_CMD="$ac_dir/file"
77217484 if test -n "$file_magic_test_file"; then
77227485 case $deplibs_check_method in
77237486 "file_magic "*)
77247487 file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
7725 MAGIC_CMD=$lt_cv_path_MAGIC_CMD
7488 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
77267489 if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
77277490 $EGREP "$file_magic_regex" > /dev/null; then
77287491 :
77457508 break
77467509 fi
77477510 done
7748 IFS=$lt_save_ifs
7749 MAGIC_CMD=$lt_save_MAGIC_CMD
7511 IFS="$lt_save_ifs"
7512 MAGIC_CMD="$lt_save_MAGIC_CMD"
77507513 ;;
77517514 esac
77527515 fi
77537516
7754 MAGIC_CMD=$lt_cv_path_MAGIC_CMD
7517 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
77557518 if test -n "$MAGIC_CMD"; then
77567519 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
77577520 $as_echo "$MAGIC_CMD" >&6; }
77727535
77737536 # Use C for the default configuration in the libtool script
77747537
7775 lt_save_CC=$CC
7538 lt_save_CC="$CC"
77767539 ac_ext=c
77777540 ac_cpp='$CPP $CPPFLAGS'
77787541 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
78347597
78357598 lt_prog_compiler_no_builtin_flag=
78367599
7837 if test yes = "$GCC"; then
7600 if test "$GCC" = yes; then
78387601 case $cc_basename in
78397602 nvcc*)
78407603 lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
78507613 lt_cv_prog_compiler_rtti_exceptions=no
78517614 ac_outfile=conftest.$ac_objext
78527615 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
7853 lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment
7616 lt_compiler_flag="-fno-rtti -fno-exceptions"
78547617 # Insert the option either (1) after the last *FLAGS variable, or
78557618 # (2) before a word containing "conftest.", or (3) at the end.
78567619 # Note that $ac_compile itself does not contain backslashes and begins
78807643 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
78817644 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
78827645
7883 if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then
7646 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
78847647 lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
78857648 else
78867649 :
78987661 lt_prog_compiler_static=
78997662
79007663
7901 if test yes = "$GCC"; then
7664 if test "$GCC" = yes; then
79027665 lt_prog_compiler_wl='-Wl,'
79037666 lt_prog_compiler_static='-static'
79047667
79057668 case $host_os in
79067669 aix*)
79077670 # All AIX code is PIC.
7908 if test ia64 = "$host_cpu"; then
7671 if test "$host_cpu" = ia64; then
79097672 # AIX 5 now supports IA64 processor
79107673 lt_prog_compiler_static='-Bstatic'
79117674 fi
7912 lt_prog_compiler_pic='-fPIC'
79137675 ;;
79147676
79157677 amigaos*)
79207682 ;;
79217683 m68k)
79227684 # FIXME: we need at least 68020 code to build shared libraries, but
7923 # adding the '-m68020' flag to GCC prevents building anything better,
7924 # like '-m68040'.
7685 # adding the `-m68020' flag to GCC prevents building anything better,
7686 # like `-m68040'.
79257687 lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
79267688 ;;
79277689 esac
79377699 # Although the cygwin gcc ignores -fPIC, still need this for old-style
79387700 # (--disable-auto-import) libraries
79397701 lt_prog_compiler_pic='-DDLL_EXPORT'
7940 case $host_os in
7941 os2*)
7942 lt_prog_compiler_static='$wl-static'
7943 ;;
7944 esac
79457702 ;;
79467703
79477704 darwin* | rhapsody*)
80127769 case $host_os in
80137770 aix*)
80147771 lt_prog_compiler_wl='-Wl,'
8015 if test ia64 = "$host_cpu"; then
7772 if test "$host_cpu" = ia64; then
80167773 # AIX 5 now supports IA64 processor
80177774 lt_prog_compiler_static='-Bstatic'
80187775 else
80207777 fi
80217778 ;;
80227779
8023 darwin* | rhapsody*)
8024 # PIC is the default on this platform
8025 # Common symbols not allowed in MH_DYLIB files
8026 lt_prog_compiler_pic='-fno-common'
8027 case $cc_basename in
8028 nagfor*)
8029 # NAG Fortran compiler
8030 lt_prog_compiler_wl='-Wl,-Wl,,'
8031 lt_prog_compiler_pic='-PIC'
8032 lt_prog_compiler_static='-Bstatic'
8033 ;;
8034 esac
8035 ;;
8036
80377780 mingw* | cygwin* | pw32* | os2* | cegcc*)
80387781 # This hack is so that the source file can tell whether it is being
80397782 # built for inclusion in a dll (and should export symbols for example).
80407783 lt_prog_compiler_pic='-DDLL_EXPORT'
8041 case $host_os in
8042 os2*)
8043 lt_prog_compiler_static='$wl-static'
8044 ;;
8045 esac
80467784 ;;
80477785
80487786 hpux9* | hpux10* | hpux11*)
80587796 ;;
80597797 esac
80607798 # Is there a better lt_prog_compiler_static that works with the bundled CC?
8061 lt_prog_compiler_static='$wl-a ${wl}archive'
7799 lt_prog_compiler_static='${wl}-a ${wl}archive'
80627800 ;;
80637801
80647802 irix5* | irix6* | nonstopux*)
80697807
80707808 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
80717809 case $cc_basename in
8072 # old Intel for x86_64, which still supported -KPIC.
7810 # old Intel for x86_64 which still supported -KPIC.
80737811 ecc*)
80747812 lt_prog_compiler_wl='-Wl,'
80757813 lt_prog_compiler_pic='-KPIC'
80937831 lt_prog_compiler_wl='-Wl,-Wl,,'
80947832 lt_prog_compiler_pic='-PIC'
80957833 lt_prog_compiler_static='-Bstatic'
8096 ;;
8097 tcc*)
8098 # Fabrice Bellard et al's Tiny C Compiler
8099 lt_prog_compiler_wl='-Wl,'
8100 lt_prog_compiler_pic='-fPIC'
8101 lt_prog_compiler_static='-static'
81027834 ;;
81037835 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
81047836 # Portland Group compilers (*not* the Pentium gcc compiler,
81977929 ;;
81987930
81997931 sysv4*MP*)
8200 if test -d /usr/nec; then
7932 if test -d /usr/nec ;then
82017933 lt_prog_compiler_pic='-Kconform_pic'
82027934 lt_prog_compiler_static='-Bstatic'
82037935 fi
82267958 fi
82277959
82287960 case $host_os in
8229 # For platforms that do not support PIC, -DPIC is meaningless:
7961 # For platforms which do not support PIC, -DPIC is meaningless:
82307962 *djgpp*)
82317963 lt_prog_compiler_pic=
82327964 ;;
82587990 lt_cv_prog_compiler_pic_works=no
82597991 ac_outfile=conftest.$ac_objext
82607992 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
8261 lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment
7993 lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
82627994 # Insert the option either (1) after the last *FLAGS variable, or
82637995 # (2) before a word containing "conftest.", or (3) at the end.
82647996 # Note that $ac_compile itself does not contain backslashes and begins
82888020 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
82898021 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
82908022
8291 if test yes = "$lt_cv_prog_compiler_pic_works"; then
8023 if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
82928024 case $lt_prog_compiler_pic in
82938025 "" | " "*) ;;
82948026 *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
83208052 $as_echo_n "(cached) " >&6
83218053 else
83228054 lt_cv_prog_compiler_static_works=no
8323 save_LDFLAGS=$LDFLAGS
8055 save_LDFLAGS="$LDFLAGS"
83248056 LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
83258057 echo "$lt_simple_link_test_code" > conftest.$ac_ext
83268058 if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
83398071 fi
83408072 fi
83418073 $RM -r conftest*
8342 LDFLAGS=$save_LDFLAGS
8074 LDFLAGS="$save_LDFLAGS"
83438075
83448076 fi
83458077 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
83468078 $as_echo "$lt_cv_prog_compiler_static_works" >&6; }
83478079
8348 if test yes = "$lt_cv_prog_compiler_static_works"; then
8080 if test x"$lt_cv_prog_compiler_static_works" = xyes; then
83498081 :
83508082 else
83518083 lt_prog_compiler_static=
84658197
84668198
84678199
8468 hard_links=nottested
8469 if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then
8200 hard_links="nottested"
8201 if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
84708202 # do not overwrite the value of need_locks provided by the user
84718203 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
84728204 $as_echo_n "checking if we can lock with hard links... " >&6; }
84788210 ln conftest.a conftest.b 2>/dev/null && hard_links=no
84798211 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
84808212 $as_echo "$hard_links" >&6; }
8481 if test no = "$hard_links"; then
8482 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5
8483 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;}
8213 if test "$hard_links" = no; then
8214 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
8215 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
84848216 need_locks=warn
84858217 fi
84868218 else
85238255 # included in the symbol list
85248256 include_expsyms=
85258257 # exclude_expsyms can be an extended regexp of symbols to exclude
8526 # it will be wrapped by ' (' and ')$', so one must not match beginning or
8527 # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
8528 # as well as any symbol that contains 'd'.
8258 # it will be wrapped by ` (' and `)$', so one must not match beginning or
8259 # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
8260 # as well as any symbol that contains `d'.
85298261 exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
85308262 # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
85318263 # platforms (ab)use it in PIC code, but their linkers get confused if
85408272 # FIXME: the MSVC++ port hasn't been tested in a loooong time
85418273 # When not using gcc, we currently assume that we are using
85428274 # Microsoft Visual C++.
8543 if test yes != "$GCC"; then
8275 if test "$GCC" != yes; then
85448276 with_gnu_ld=no
85458277 fi
85468278 ;;
85488280 # we just hope/assume this is gcc and not c89 (= MSVC++)
85498281 with_gnu_ld=yes
85508282 ;;
8551 openbsd* | bitrig*)
8283 openbsd*)
85528284 with_gnu_ld=no
85538285 ;;
85548286 linux* | k*bsd*-gnu | gnu*)
85618293 # On some targets, GNU ld is compatible enough with the native linker
85628294 # that we're better off using the native interface for both.
85638295 lt_use_gnu_ld_interface=no
8564 if test yes = "$with_gnu_ld"; then
8296 if test "$with_gnu_ld" = yes; then
85658297 case $host_os in
85668298 aix*)
85678299 # The AIX port of GNU ld has always aspired to compatibility
85838315 esac
85848316 fi
85858317
8586 if test yes = "$lt_use_gnu_ld_interface"; then
8318 if test "$lt_use_gnu_ld_interface" = yes; then
85878319 # If archive_cmds runs LD, not CC, wlarc should be empty
8588 wlarc='$wl'
8320 wlarc='${wl}'
85898321
85908322 # Set some defaults for GNU ld with shared library support. These
85918323 # are reset later if shared libraries are not supported. Putting them
85928324 # here allows them to be overridden if necessary.
85938325 runpath_var=LD_RUN_PATH
8594 hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
8595 export_dynamic_flag_spec='$wl--export-dynamic'
8326 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
8327 export_dynamic_flag_spec='${wl}--export-dynamic'
85968328 # ancient GNU ld didn't support --whole-archive et. al.
85978329 if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
8598 whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
8330 whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
85998331 else
86008332 whole_archive_flag_spec=
86018333 fi
86028334 supports_anon_versioning=no
8603 case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in
8335 case `$LD -v 2>&1` in
86048336 *GNU\ gold*) supports_anon_versioning=yes ;;
86058337 *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
86068338 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
86138345 case $host_os in
86148346 aix[3-9]*)
86158347 # On AIX/PPC, the GNU linker is very broken
8616 if test ia64 != "$host_cpu"; then
8348 if test "$host_cpu" != ia64; then
86178349 ld_shlibs=no
86188350 cat <<_LT_EOF 1>&2
86198351
86328364 case $host_cpu in
86338365 powerpc)
86348366 # see comment about AmigaOS4 .so support
8635 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
8367 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
86368368 archive_expsym_cmds=''
86378369 ;;
86388370 m68k)
86488380 allow_undefined_flag=unsupported
86498381 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
86508382 # support --undefined. This deserves some investigation. FIXME
8651 archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
8383 archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
86528384 else
86538385 ld_shlibs=no
86548386 fi
86588390 # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
86598391 # as there is no search path for DLLs.
86608392 hardcode_libdir_flag_spec='-L$libdir'
8661 export_dynamic_flag_spec='$wl--export-all-symbols'
8393 export_dynamic_flag_spec='${wl}--export-all-symbols'
86628394 allow_undefined_flag=unsupported
86638395 always_export_symbols=no
86648396 enable_shared_with_static_runtimes=yes
86668398 exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
86678399
86688400 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
8669 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
8670 # If the export-symbols file already is a .def file, use it as
8671 # is; otherwise, prepend EXPORTS...
8672 archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then
8673 cp $export_symbols $output_objdir/$soname.def;
8674 else
8675 echo EXPORTS > $output_objdir/$soname.def;
8676 cat $export_symbols >> $output_objdir/$soname.def;
8677 fi~
8678 $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
8401 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
8402 # If the export-symbols file already is a .def file (1st line
8403 # is EXPORTS), use it as is; otherwise, prepend...
8404 archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
8405 cp $export_symbols $output_objdir/$soname.def;
8406 else
8407 echo EXPORTS > $output_objdir/$soname.def;
8408 cat $export_symbols >> $output_objdir/$soname.def;
8409 fi~
8410 $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
86798411 else
86808412 ld_shlibs=no
86818413 fi
86828414 ;;
86838415
86848416 haiku*)
8685 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
8417 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
86868418 link_all_deplibs=yes
8687 ;;
8688
8689 os2*)
8690 hardcode_libdir_flag_spec='-L$libdir'
8691 hardcode_minus_L=yes
8692 allow_undefined_flag=unsupported
8693 shrext_cmds=.dll
8694 archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
8695 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
8696 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
8697 $ECHO EXPORTS >> $output_objdir/$libname.def~
8698 emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
8699 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
8700 emximp -o $lib $output_objdir/$libname.def'
8701 archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
8702 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
8703 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
8704 $ECHO EXPORTS >> $output_objdir/$libname.def~
8705 prefix_cmds="$SED"~
8706 if test EXPORTS = "`$SED 1q $export_symbols`"; then
8707 prefix_cmds="$prefix_cmds -e 1d";
8708 fi~
8709 prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
8710 cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
8711 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
8712 emximp -o $lib $output_objdir/$libname.def'
8713 old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
8714 enable_shared_with_static_runtimes=yes
87158419 ;;
87168420
87178421 interix[3-9]*)
87188422 hardcode_direct=no
87198423 hardcode_shlibpath_var=no
8720 hardcode_libdir_flag_spec='$wl-rpath,$libdir'
8721 export_dynamic_flag_spec='$wl-E'
8424 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
8425 export_dynamic_flag_spec='${wl}-E'
87228426 # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
87238427 # Instead, shared libraries are loaded at an image base (0x10000000 by
87248428 # default) and relocated if they conflict, which is a slow very memory
87258429 # consuming and fragmenting process. To avoid this, we pick a random,
87268430 # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
87278431 # time. Moving up from 0x10000000 also allows more sbrk(2) space.
8728 archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
8729 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'
8432 archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
8433 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'
87308434 ;;
87318435
87328436 gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
87338437 tmp_diet=no
8734 if test linux-dietlibc = "$host_os"; then
8438 if test "$host_os" = linux-dietlibc; then
87358439 case $cc_basename in
87368440 diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
87378441 esac
87388442 fi
87398443 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
8740 && test no = "$tmp_diet"
8444 && test "$tmp_diet" = no
87418445 then
87428446 tmp_addflag=' $pic_flag'
87438447 tmp_sharedflag='-shared'
87448448 case $cc_basename,$host_cpu in
87458449 pgcc*) # Portland Group C compiler
8746 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'
8450 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'
87478451 tmp_addflag=' $pic_flag'
87488452 ;;
87498453 pgf77* | pgf90* | pgf95* | pgfortran*)
87508454 # Portland Group f77 and f90 compilers
8751 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'
8455 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'
87528456 tmp_addflag=' $pic_flag -Mnomain' ;;
87538457 ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
87548458 tmp_addflag=' -i_dynamic' ;;
87598463 lf95*) # Lahey Fortran 8.1
87608464 whole_archive_flag_spec=
87618465 tmp_sharedflag='--shared' ;;
8762 nagfor*) # NAGFOR 5.3
8763 tmp_sharedflag='-Wl,-shared' ;;
87648466 xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
87658467 tmp_sharedflag='-qmkshrobj'
87668468 tmp_addflag= ;;
87678469 nvcc*) # Cuda Compiler Driver 2.2
8768 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'
8470 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'
87698471 compiler_needs_object=yes
87708472 ;;
87718473 esac
87728474 case `$CC -V 2>&1 | sed 5q` in
87738475 *Sun\ C*) # Sun C 5.9
8774 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'
8476 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'
87758477 compiler_needs_object=yes
87768478 tmp_sharedflag='-G' ;;
87778479 *Sun\ F*) # Sun Fortran 8.3
87788480 tmp_sharedflag='-G' ;;
87798481 esac
8780 archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
8781
8782 if test yes = "$supports_anon_versioning"; then
8482 archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8483
8484 if test "x$supports_anon_versioning" = xyes; then
87838485 archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
8784 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
8785 echo "local: *; };" >> $output_objdir/$libname.ver~
8786 $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
8486 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
8487 echo "local: *; };" >> $output_objdir/$libname.ver~
8488 $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
87878489 fi
87888490
87898491 case $cc_basename in
8790 tcc*)
8791 export_dynamic_flag_spec='-rdynamic'
8792 ;;
87938492 xlf* | bgf* | bgxlf* | mpixlf*)
87948493 # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
87958494 whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
8796 hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
8495 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
87978496 archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
8798 if test yes = "$supports_anon_versioning"; then
8497 if test "x$supports_anon_versioning" = xyes; then
87998498 archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
8800 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
8801 echo "local: *; };" >> $output_objdir/$libname.ver~
8802 $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
8499 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
8500 echo "local: *; };" >> $output_objdir/$libname.ver~
8501 $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
88038502 fi
88048503 ;;
88058504 esac
88138512 archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
88148513 wlarc=
88158514 else
8816 archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
8817 archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
8515 archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8516 archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
88188517 fi
88198518 ;;
88208519
88328531
88338532 _LT_EOF
88348533 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
8835 archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
8836 archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
8534 archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8535 archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
88378536 else
88388537 ld_shlibs=no
88398538 fi
88458544 ld_shlibs=no
88468545 cat <<_LT_EOF 1>&2
88478546
8848 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot
8547 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
88498548 *** reliably create shared libraries on SCO systems. Therefore, libtool
88508549 *** is disabling shared libraries support. We urge you to upgrade GNU
88518550 *** binutils to release 2.16.91.0.3 or newer. Another option is to modify
88608559 # DT_RUNPATH tag from executables and libraries. But doing so
88618560 # requires that you compile everything twice, which is a pain.
88628561 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
8863 hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
8864 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
8865 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
8562 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
8563 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8564 archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
88668565 else
88678566 ld_shlibs=no
88688567 fi
88798578
88808579 *)
88818580 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
8882 archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
8883 archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
8581 archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
8582 archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
88848583 else
88858584 ld_shlibs=no
88868585 fi
88878586 ;;
88888587 esac
88898588
8890 if test no = "$ld_shlibs"; then
8589 if test "$ld_shlibs" = no; then
88918590 runpath_var=
88928591 hardcode_libdir_flag_spec=
88938592 export_dynamic_flag_spec=
89038602 # Note: this linker hardcodes the directories in LIBPATH if there
89048603 # are no directories specified by -L.
89058604 hardcode_minus_L=yes
8906 if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then
8605 if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
89078606 # Neither direct hardcoding nor static linking is supported with a
89088607 # broken collect2.
89098608 hardcode_direct=unsupported
89118610 ;;
89128611
89138612 aix[4-9]*)
8914 if test ia64 = "$host_cpu"; then
8613 if test "$host_cpu" = ia64; then
89158614 # On IA64, the linker does run time linking by default, so we don't
89168615 # have to do anything special.
89178616 aix_use_runtimelinking=no
89188617 exp_sym_flag='-Bexport'
8919 no_entry_flag=
8618 no_entry_flag=""
89208619 else
89218620 # If we're using GNU nm, then we don't want the "-C" option.
8922 # -C means demangle to GNU nm, but means don't demangle to AIX nm.
8923 # Without the "-l" option, or with the "-B" option, AIX nm treats
8924 # weak defined symbols like other global defined symbols, whereas
8925 # GNU nm marks them as "W".
8926 # While the 'weak' keyword is ignored in the Export File, we need
8927 # it in the Import File for the 'aix-soname' feature, so we have
8928 # to replace the "-B" option with "-P" for AIX nm.
8621 # -C means demangle to AIX nm, but means don't demangle with GNU nm
8622 # Also, AIX nm treats weak defined symbols like other global
8623 # defined symbols, whereas GNU nm marks them as "W".
89298624 if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
8930 export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
8625 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'
89318626 else
8932 export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
8627 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'
89338628 fi
89348629 aix_use_runtimelinking=no
89358630
89368631 # Test if we are trying to use run time linking or normal
89378632 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
8938 # have runtime linking enabled, and use it for executables.
8939 # For shared libraries, we enable/disable runtime linking
8940 # depending on the kind of the shared library created -
8941 # when "with_aix_soname,aix_use_runtimelinking" is:
8942 # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables
8943 # "aix,yes" lib.so shared, rtl:yes, for executables
8944 # lib.a static archive
8945 # "both,no" lib.so.V(shr.o) shared, rtl:yes
8946 # lib.a(lib.so.V) shared, rtl:no, for executables
8947 # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
8948 # lib.a(lib.so.V) shared, rtl:no
8949 # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables
8950 # lib.a static archive
8633 # need to do runtime linking.
89518634 case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
89528635 for ld_flag in $LDFLAGS; do
8953 if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
8636 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
89548637 aix_use_runtimelinking=yes
89558638 break
89568639 fi
89578640 done
8958 if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
8959 # With aix-soname=svr4, we create the lib.so.V shared archives only,
8960 # so we don't have lib.a shared libs to link our executables.
8961 # We have to force runtime linking in this case.
8962 aix_use_runtimelinking=yes
8963 LDFLAGS="$LDFLAGS -Wl,-brtl"
8964 fi
89658641 ;;
89668642 esac
89678643
89808656 hardcode_direct_absolute=yes
89818657 hardcode_libdir_separator=':'
89828658 link_all_deplibs=yes
8983 file_list_spec='$wl-f,'
8984 case $with_aix_soname,$aix_use_runtimelinking in
8985 aix,*) ;; # traditional, no import file
8986 svr4,* | *,yes) # use import file
8987 # The Import File defines what to hardcode.
8988 hardcode_direct=no
8989 hardcode_direct_absolute=no
8990 ;;
8991 esac
8992
8993 if test yes = "$GCC"; then
8659 file_list_spec='${wl}-f,'
8660
8661 if test "$GCC" = yes; then
89948662 case $host_os in aix4.[012]|aix4.[012].*)
89958663 # We only want to do this on AIX 4.2 and lower, the check
89968664 # below for broken collect2 doesn't work under 4.3+
8997 collect2name=`$CC -print-prog-name=collect2`
8665 collect2name=`${CC} -print-prog-name=collect2`
89988666 if test -f "$collect2name" &&
89998667 strings "$collect2name" | $GREP resolve_lib_name >/dev/null
90008668 then
90138681 ;;
90148682 esac
90158683 shared_flag='-shared'
9016 if test yes = "$aix_use_runtimelinking"; then
9017 shared_flag="$shared_flag "'$wl-G'
8684 if test "$aix_use_runtimelinking" = yes; then
8685 shared_flag="$shared_flag "'${wl}-G'
90188686 fi
9019 # Need to ensure runtime linking is disabled for the traditional
9020 # shared library, or the linker may eventually find shared libraries
9021 # /with/ Import File - we do not want to mix them.
9022 shared_flag_aix='-shared'
9023 shared_flag_svr4='-shared $wl-G'
8687 link_all_deplibs=no
90248688 else
90258689 # not using gcc
9026 if test ia64 = "$host_cpu"; then
8690 if test "$host_cpu" = ia64; then
90278691 # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
90288692 # chokes on -Wl,-G. The following line is correct:
90298693 shared_flag='-G'
90308694 else
9031 if test yes = "$aix_use_runtimelinking"; then
9032 shared_flag='$wl-G'
8695 if test "$aix_use_runtimelinking" = yes; then
8696 shared_flag='${wl}-G'
90338697 else
9034 shared_flag='$wl-bM:SRE'
8698 shared_flag='${wl}-bM:SRE'
90358699 fi
9036 shared_flag_aix='$wl-bM:SRE'
9037 shared_flag_svr4='$wl-G'
90388700 fi
90398701 fi
90408702
9041 export_dynamic_flag_spec='$wl-bexpall'
8703 export_dynamic_flag_spec='${wl}-bexpall'
90428704 # It seems that -bexpall does not export symbols beginning with
90438705 # underscore (_), so it is better to generate a list of symbols to export.
90448706 always_export_symbols=yes
9045 if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
8707 if test "$aix_use_runtimelinking" = yes; then
90468708 # Warning - without using the other runtime loading flags (-brtl),
90478709 # -berok will link without error, but may produce a broken library.
90488710 allow_undefined_flag='-berok'
90498711 # Determine the default libpath from the value encoded in an
90508712 # empty executable.
9051 if test set = "${lt_cv_aix_libpath+set}"; then
8713 if test "${lt_cv_aix_libpath+set}" = set; then
90528714 aix_libpath=$lt_cv_aix_libpath
90538715 else
90548716 if ${lt_cv_aix_libpath_+:} false; then :
90838745 rm -f core conftest.err conftest.$ac_objext \
90848746 conftest$ac_exeext conftest.$ac_ext
90858747 if test -z "$lt_cv_aix_libpath_"; then
9086 lt_cv_aix_libpath_=/usr/lib:/lib
8748 lt_cv_aix_libpath_="/usr/lib:/lib"
90878749 fi
90888750
90898751 fi
90918753 aix_libpath=$lt_cv_aix_libpath_
90928754 fi
90938755
9094 hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
9095 archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
8756 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
8757 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"
90968758 else
9097 if test ia64 = "$host_cpu"; then
9098 hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib'
8759 if test "$host_cpu" = ia64; then
8760 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
90998761 allow_undefined_flag="-z nodefs"
9100 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"
8762 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"
91018763 else
91028764 # Determine the default libpath from the value encoded in an
91038765 # empty executable.
9104 if test set = "${lt_cv_aix_libpath+set}"; then
8766 if test "${lt_cv_aix_libpath+set}" = set; then
91058767 aix_libpath=$lt_cv_aix_libpath
91068768 else
91078769 if ${lt_cv_aix_libpath_+:} false; then :
91368798 rm -f core conftest.err conftest.$ac_objext \
91378799 conftest$ac_exeext conftest.$ac_ext
91388800 if test -z "$lt_cv_aix_libpath_"; then
9139 lt_cv_aix_libpath_=/usr/lib:/lib
8801 lt_cv_aix_libpath_="/usr/lib:/lib"
91408802 fi
91418803
91428804 fi
91448806 aix_libpath=$lt_cv_aix_libpath_
91458807 fi
91468808
9147 hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
8809 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
91488810 # Warning - without using the other run time loading flags,
91498811 # -berok will link without error, but may produce a broken library.
9150 no_undefined_flag=' $wl-bernotok'
9151 allow_undefined_flag=' $wl-berok'
9152 if test yes = "$with_gnu_ld"; then
8812 no_undefined_flag=' ${wl}-bernotok'
8813 allow_undefined_flag=' ${wl}-berok'
8814 if test "$with_gnu_ld" = yes; then
91538815 # We only use this code for GNU lds that support --whole-archive.
9154 whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive'
8816 whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
91558817 else
91568818 # Exported symbols can be pulled into shared objects from archives
91578819 whole_archive_flag_spec='$convenience'
91588820 fi
91598821 archive_cmds_need_lc=yes
9160 archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
9161 # -brtl affects multiple linker settings, -berok does not and is overridden later
9162 compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`'
9163 if test svr4 != "$with_aix_soname"; then
9164 # This is similar to how AIX traditionally builds its shared libraries.
9165 archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
9166 fi
9167 if test aix != "$with_aix_soname"; then
9168 archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
9169 else
9170 # used by -dlpreopen to get the symbols
9171 archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir'
9172 fi
9173 archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d'
8822 # This is similar to how AIX traditionally builds its shared libraries.
8823 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'
91748824 fi
91758825 fi
91768826 ;;
91798829 case $host_cpu in
91808830 powerpc)
91818831 # see comment about AmigaOS4 .so support
9182 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
8832 archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
91838833 archive_expsym_cmds=''
91848834 ;;
91858835 m68k)
92098859 # Tell ltmain to make .lib files, not .a files.
92108860 libext=lib
92118861 # Tell ltmain to make .dll files, not .so files.
9212 shrext_cmds=.dll
8862 shrext_cmds=".dll"
92138863 # FIXME: Setting linknames here is a bad hack.
9214 archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
9215 archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then
9216 cp "$export_symbols" "$output_objdir/$soname.def";
9217 echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
9218 else
9219 $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
9220 fi~
9221 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
9222 linknames='
8864 archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
8865 archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
8866 sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
8867 else
8868 sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
8869 fi~
8870 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
8871 linknames='
92238872 # The linker will not automatically build a static lib if we build a DLL.
92248873 # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
92258874 enable_shared_with_static_runtimes=yes
92288877 # Don't use ranlib
92298878 old_postinstall_cmds='chmod 644 $oldlib'
92308879 postlink_cmds='lt_outputfile="@OUTPUT@"~
9231 lt_tool_outputfile="@TOOL_OUTPUT@"~
9232 case $lt_outputfile in
9233 *.exe|*.EXE) ;;
9234 *)
9235 lt_outputfile=$lt_outputfile.exe
9236 lt_tool_outputfile=$lt_tool_outputfile.exe
9237 ;;
9238 esac~
9239 if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
9240 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
9241 $RM "$lt_outputfile.manifest";
9242 fi'
8880 lt_tool_outputfile="@TOOL_OUTPUT@"~
8881 case $lt_outputfile in
8882 *.exe|*.EXE) ;;
8883 *)
8884 lt_outputfile="$lt_outputfile.exe"
8885 lt_tool_outputfile="$lt_tool_outputfile.exe"
8886 ;;
8887 esac~
8888 if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
8889 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
8890 $RM "$lt_outputfile.manifest";
8891 fi'
92438892 ;;
92448893 *)
92458894 # Assume MSVC wrapper
92488897 # Tell ltmain to make .lib files, not .a files.
92498898 libext=lib
92508899 # Tell ltmain to make .dll files, not .so files.
9251 shrext_cmds=.dll
8900 shrext_cmds=".dll"
92528901 # FIXME: Setting linknames here is a bad hack.
92538902 archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
92548903 # The linker will automatically build a .lib file if we build a DLL.
92678916 hardcode_direct=no
92688917 hardcode_automatic=yes
92698918 hardcode_shlibpath_var=unsupported
9270 if test yes = "$lt_cv_ld_force_load"; then
9271 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\"`'
8919 if test "$lt_cv_ld_force_load" = "yes"; then
8920 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\"`'
92728921
92738922 else
92748923 whole_archive_flag_spec=''
92758924 fi
92768925 link_all_deplibs=yes
9277 allow_undefined_flag=$_lt_dar_allow_undefined
8926 allow_undefined_flag="$_lt_dar_allow_undefined"
92788927 case $cc_basename in
9279 ifort*|nagfor*) _lt_dar_can_shared=yes ;;
8928 ifort*) _lt_dar_can_shared=yes ;;
92808929 *) _lt_dar_can_shared=$GCC ;;
92818930 esac
9282 if test yes = "$_lt_dar_can_shared"; then
8931 if test "$_lt_dar_can_shared" = "yes"; then
92838932 output_verbose_link_cmd=func_echo_all
9284 archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
9285 module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
9286 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"
9287 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"
8933 archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
8934 module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
8935 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}"
8936 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}"
92888937
92898938 else
92908939 ld_shlibs=no
93268975 ;;
93278976
93288977 hpux9*)
9329 if test yes = "$GCC"; then
9330 archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
8978 if test "$GCC" = yes; then
8979 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'
93318980 else
9332 archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
8981 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'
93338982 fi
9334 hardcode_libdir_flag_spec='$wl+b $wl$libdir'
8983 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
93358984 hardcode_libdir_separator=:
93368985 hardcode_direct=yes
93378986
93388987 # hardcode_minus_L: Not really in the search PATH,
93398988 # but as the default location of the library.
93408989 hardcode_minus_L=yes
9341 export_dynamic_flag_spec='$wl-E'
8990 export_dynamic_flag_spec='${wl}-E'
93428991 ;;
93438992
93448993 hpux10*)
9345 if test yes,no = "$GCC,$with_gnu_ld"; then
9346 archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
8994 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
8995 archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
93478996 else
93488997 archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
93498998 fi
9350 if test no = "$with_gnu_ld"; then
9351 hardcode_libdir_flag_spec='$wl+b $wl$libdir'
8999 if test "$with_gnu_ld" = no; then
9000 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
93529001 hardcode_libdir_separator=:
93539002 hardcode_direct=yes
93549003 hardcode_direct_absolute=yes
9355 export_dynamic_flag_spec='$wl-E'
9004 export_dynamic_flag_spec='${wl}-E'
93569005 # hardcode_minus_L: Not really in the search PATH,
93579006 # but as the default location of the library.
93589007 hardcode_minus_L=yes
93609009 ;;
93619010
93629011 hpux11*)
9363 if test yes,no = "$GCC,$with_gnu_ld"; then
9012 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
93649013 case $host_cpu in
93659014 hppa*64*)
9366 archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
9015 archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
93679016 ;;
93689017 ia64*)
9369 archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
9018 archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
93709019 ;;
93719020 *)
9372 archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
9021 archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
93739022 ;;
93749023 esac
93759024 else
93769025 case $host_cpu in
93779026 hppa*64*)
9378 archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
9027 archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
93799028 ;;
93809029 ia64*)
9381 archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
9030 archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
93829031 ;;
93839032 *)
93849033
93909039 $as_echo_n "(cached) " >&6
93919040 else
93929041 lt_cv_prog_compiler__b=no
9393 save_LDFLAGS=$LDFLAGS
9042 save_LDFLAGS="$LDFLAGS"
93949043 LDFLAGS="$LDFLAGS -b"
93959044 echo "$lt_simple_link_test_code" > conftest.$ac_ext
93969045 if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
94099058 fi
94109059 fi
94119060 $RM -r conftest*
9412 LDFLAGS=$save_LDFLAGS
9061 LDFLAGS="$save_LDFLAGS"
94139062
94149063 fi
94159064 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
94169065 $as_echo "$lt_cv_prog_compiler__b" >&6; }
94179066
9418 if test yes = "$lt_cv_prog_compiler__b"; then
9419 archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
9067 if test x"$lt_cv_prog_compiler__b" = xyes; then
9068 archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
94209069 else
94219070 archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
94229071 fi
94249073 ;;
94259074 esac
94269075 fi
9427 if test no = "$with_gnu_ld"; then
9428 hardcode_libdir_flag_spec='$wl+b $wl$libdir'
9076 if test "$with_gnu_ld" = no; then
9077 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
94299078 hardcode_libdir_separator=:
94309079
94319080 case $host_cpu in
94369085 *)
94379086 hardcode_direct=yes
94389087 hardcode_direct_absolute=yes
9439 export_dynamic_flag_spec='$wl-E'
9088 export_dynamic_flag_spec='${wl}-E'
94409089
94419090 # hardcode_minus_L: Not really in the search PATH,
94429091 # but as the default location of the library.
94479096 ;;
94489097
94499098 irix5* | irix6* | nonstopux*)
9450 if test yes = "$GCC"; then
9451 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'
9099 if test "$GCC" = yes; then
9100 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'
94529101 # Try to use the -exported_symbol ld option, if it does not
94539102 # work, assume that -exports_file does not work either and
94549103 # implicitly export all symbols.
94589107 if ${lt_cv_irix_exported_symbol+:} false; then :
94599108 $as_echo_n "(cached) " >&6
94609109 else
9461 save_LDFLAGS=$LDFLAGS
9462 LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null"
9110 save_LDFLAGS="$LDFLAGS"
9111 LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
94639112 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
94649113 /* end confdefs.h. */
94659114 int foo (void) { return 0; }
94719120 fi
94729121 rm -f core conftest.err conftest.$ac_objext \
94739122 conftest$ac_exeext conftest.$ac_ext
9474 LDFLAGS=$save_LDFLAGS
9123 LDFLAGS="$save_LDFLAGS"
94759124 fi
94769125 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
94779126 $as_echo "$lt_cv_irix_exported_symbol" >&6; }
9478 if test yes = "$lt_cv_irix_exported_symbol"; then
9479 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'
9127 if test "$lt_cv_irix_exported_symbol" = yes; then
9128 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'
94809129 fi
9481 link_all_deplibs=no
94829130 else
9483 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'
9484 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'
9131 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'
9132 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'
94859133 fi
94869134 archive_cmds_need_lc='no'
9487 hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
9135 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
94889136 hardcode_libdir_separator=:
94899137 inherit_rpath=yes
94909138 link_all_deplibs=yes
9491 ;;
9492
9493 linux*)
9494 case $cc_basename in
9495 tcc*)
9496 # Fabrice Bellard et al's Tiny C Compiler
9497 ld_shlibs=yes
9498 archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
9499 ;;
9500 esac
95019139 ;;
95029140
95039141 netbsd* | netbsdelf*-gnu)
95149152 newsos6)
95159153 archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
95169154 hardcode_direct=yes
9517 hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
9155 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
95189156 hardcode_libdir_separator=:
95199157 hardcode_shlibpath_var=no
95209158 ;;
95229160 *nto* | *qnx*)
95239161 ;;
95249162
9525 openbsd* | bitrig*)
9163 openbsd*)
95269164 if test -f /usr/libexec/ld.so; then
95279165 hardcode_direct=yes
95289166 hardcode_shlibpath_var=no
95299167 hardcode_direct_absolute=yes
9530 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
9168 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
95319169 archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
9532 archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
9533 hardcode_libdir_flag_spec='$wl-rpath,$libdir'
9534 export_dynamic_flag_spec='$wl-E'
9170 archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
9171 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
9172 export_dynamic_flag_spec='${wl}-E'
95359173 else
9536 archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
9537 hardcode_libdir_flag_spec='$wl-rpath,$libdir'
9174 case $host_os in
9175 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
9176 archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
9177 hardcode_libdir_flag_spec='-R$libdir'
9178 ;;
9179 *)
9180 archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
9181 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
9182 ;;
9183 esac
95389184 fi
95399185 else
95409186 ld_shlibs=no
95459191 hardcode_libdir_flag_spec='-L$libdir'
95469192 hardcode_minus_L=yes
95479193 allow_undefined_flag=unsupported
9548 shrext_cmds=.dll
9549 archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
9550 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
9551 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
9552 $ECHO EXPORTS >> $output_objdir/$libname.def~
9553 emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
9554 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
9555 emximp -o $lib $output_objdir/$libname.def'
9556 archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
9557 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
9558 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
9559 $ECHO EXPORTS >> $output_objdir/$libname.def~
9560 prefix_cmds="$SED"~
9561 if test EXPORTS = "`$SED 1q $export_symbols`"; then
9562 prefix_cmds="$prefix_cmds -e 1d";
9563 fi~
9564 prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
9565 cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
9566 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
9567 emximp -o $lib $output_objdir/$libname.def'
9568 old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
9569 enable_shared_with_static_runtimes=yes
9194 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'
9195 old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
95709196 ;;
95719197
95729198 osf3*)
9573 if test yes = "$GCC"; then
9574 allow_undefined_flag=' $wl-expect_unresolved $wl\*'
9575 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'
9199 if test "$GCC" = yes; then
9200 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
9201 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'
95769202 else
95779203 allow_undefined_flag=' -expect_unresolved \*'
9578 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'
9204 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'
95799205 fi
95809206 archive_cmds_need_lc='no'
9581 hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
9207 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
95829208 hardcode_libdir_separator=:
95839209 ;;
95849210
95859211 osf4* | osf5*) # as osf3* with the addition of -msym flag
9586 if test yes = "$GCC"; then
9587 allow_undefined_flag=' $wl-expect_unresolved $wl\*'
9588 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'
9589 hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
9212 if test "$GCC" = yes; then
9213 allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
9214 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'
9215 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
95909216 else
95919217 allow_undefined_flag=' -expect_unresolved \*'
9592 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'
9218 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'
95939219 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~
9594 $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'
9220 $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'
95959221
95969222 # Both c and cxx compiler support -rpath directly
95979223 hardcode_libdir_flag_spec='-rpath $libdir'
96029228
96039229 solaris*)
96049230 no_undefined_flag=' -z defs'
9605 if test yes = "$GCC"; then
9606 wlarc='$wl'
9607 archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
9231 if test "$GCC" = yes; then
9232 wlarc='${wl}'
9233 archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
96089234 archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
9609 $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'
9235 $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'
96109236 else
96119237 case `$CC -V 2>&1` in
96129238 *"Compilers 5.0"*)
96139239 wlarc=''
9614 archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
9240 archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
96159241 archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
9616 $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
9242 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
96179243 ;;
96189244 *)
9619 wlarc='$wl'
9620 archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
9245 wlarc='${wl}'
9246 archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
96219247 archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
9622 $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
9248 $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
96239249 ;;
96249250 esac
96259251 fi
96299255 solaris2.[0-5] | solaris2.[0-5].*) ;;
96309256 *)
96319257 # The compiler driver will combine and reorder linker options,
9632 # but understands '-z linker_flag'. GCC discards it without '$wl',
9258 # but understands `-z linker_flag'. GCC discards it without `$wl',
96339259 # but is careful enough not to reorder.
96349260 # Supported since Solaris 2.6 (maybe 2.5.1?)
9635 if test yes = "$GCC"; then
9636 whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
9261 if test "$GCC" = yes; then
9262 whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
96379263 else
96389264 whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
96399265 fi
96439269 ;;
96449270
96459271 sunos4*)
9646 if test sequent = "$host_vendor"; then
9272 if test "x$host_vendor" = xsequent; then
96479273 # Use $CC to link under sequent, because it throws in some extra .o
96489274 # files that make .init and .fini sections work.
9649 archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
9275 archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
96509276 else
96519277 archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
96529278 fi
96959321 ;;
96969322
96979323 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
9698 no_undefined_flag='$wl-z,text'
9324 no_undefined_flag='${wl}-z,text'
96999325 archive_cmds_need_lc=no
97009326 hardcode_shlibpath_var=no
97019327 runpath_var='LD_RUN_PATH'
97029328
9703 if test yes = "$GCC"; then
9704 archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9705 archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9329 if test "$GCC" = yes; then
9330 archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9331 archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
97069332 else
9707 archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9708 archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9333 archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9334 archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
97099335 fi
97109336 ;;
97119337
97129338 sysv5* | sco3.2v5* | sco5v6*)
9713 # Note: We CANNOT use -z defs as we might desire, because we do not
9339 # Note: We can NOT use -z defs as we might desire, because we do not
97149340 # link with -lc, and that would cause any symbols used from libc to
97159341 # always be unresolved, which means just about no library would
97169342 # ever link correctly. If we're not using GNU ld we use -z text
97179343 # though, which does catch some bad symbols but isn't as heavy-handed
97189344 # as -z defs.
9719 no_undefined_flag='$wl-z,text'
9720 allow_undefined_flag='$wl-z,nodefs'
9345 no_undefined_flag='${wl}-z,text'
9346 allow_undefined_flag='${wl}-z,nodefs'
97219347 archive_cmds_need_lc=no
97229348 hardcode_shlibpath_var=no
9723 hardcode_libdir_flag_spec='$wl-R,$libdir'
9349 hardcode_libdir_flag_spec='${wl}-R,$libdir'
97249350 hardcode_libdir_separator=':'
97259351 link_all_deplibs=yes
9726 export_dynamic_flag_spec='$wl-Bexport'
9352 export_dynamic_flag_spec='${wl}-Bexport'
97279353 runpath_var='LD_RUN_PATH'
97289354
9729 if test yes = "$GCC"; then
9730 archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9731 archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9355 if test "$GCC" = yes; then
9356 archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9357 archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
97329358 else
9733 archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9734 archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9359 archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
9360 archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
97359361 fi
97369362 ;;
97379363
97469372 ;;
97479373 esac
97489374
9749 if test sni = "$host_vendor"; then
9375 if test x$host_vendor = xsni; then
97509376 case $host in
97519377 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
9752 export_dynamic_flag_spec='$wl-Blargedynsym'
9378 export_dynamic_flag_spec='${wl}-Blargedynsym'
97539379 ;;
97549380 esac
97559381 fi
97579383
97589384 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
97599385 $as_echo "$ld_shlibs" >&6; }
9760 test no = "$ld_shlibs" && can_build_shared=no
9386 test "$ld_shlibs" = no && can_build_shared=no
97619387
97629388 with_gnu_ld=$with_gnu_ld
97639389
97839409 # Assume -lc should be added
97849410 archive_cmds_need_lc=yes
97859411
9786 if test yes,yes = "$GCC,$enable_shared"; then
9412 if test "$enable_shared" = yes && test "$GCC" = yes; then
97879413 case $archive_cmds in
97889414 *'~'*)
97899415 # FIXME: we may have to deal with multi-command sequences.
99989624 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
99999625 $as_echo_n "checking dynamic linker characteristics... " >&6; }
100009626
10001 if test yes = "$GCC"; then
9627 if test "$GCC" = yes; then
100029628 case $host_os in
10003 darwin*) lt_awk_arg='/^libraries:/,/LR/' ;;
10004 *) lt_awk_arg='/^libraries:/' ;;
9629 darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
9630 *) lt_awk_arg="/^libraries:/" ;;
100059631 esac
100069632 case $host_os in
10007 mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;;
10008 *) lt_sed_strip_eq='s|=/|/|g' ;;
9633 mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
9634 *) lt_sed_strip_eq="s,=/,/,g" ;;
100099635 esac
100109636 lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
100119637 case $lt_search_path_spec in
100219647 ;;
100229648 esac
100239649 # Ok, now we have the path, separated by spaces, we can step through it
10024 # and add multilib dir if necessary...
9650 # and add multilib dir if necessary.
100259651 lt_tmp_lt_search_path_spec=
10026 lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
10027 # ...but if some path component already ends with the multilib dir we assume
10028 # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer).
10029 case "$lt_multi_os_dir; $lt_search_path_spec " in
10030 "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*)
10031 lt_multi_os_dir=
10032 ;;
10033 esac
9652 lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
100349653 for lt_sys_path in $lt_search_path_spec; do
10035 if test -d "$lt_sys_path$lt_multi_os_dir"; then
10036 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir"
10037 elif test -n "$lt_multi_os_dir"; then
9654 if test -d "$lt_sys_path/$lt_multi_os_dir"; then
9655 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
9656 else
100389657 test -d "$lt_sys_path" && \
100399658 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
100409659 fi
100419660 done
100429661 lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
10043 BEGIN {RS = " "; FS = "/|\n";} {
10044 lt_foo = "";
10045 lt_count = 0;
9662 BEGIN {RS=" "; FS="/|\n";} {
9663 lt_foo="";
9664 lt_count=0;
100469665 for (lt_i = NF; lt_i > 0; lt_i--) {
100479666 if ($lt_i != "" && $lt_i != ".") {
100489667 if ($lt_i == "..") {
100499668 lt_count++;
100509669 } else {
100519670 if (lt_count == 0) {
10052 lt_foo = "/" $lt_i lt_foo;
9671 lt_foo="/" $lt_i lt_foo;
100539672 } else {
100549673 lt_count--;
100559674 }
100639682 # for these hosts.
100649683 case $host_os in
100659684 mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
10066 $SED 's|/\([A-Za-z]:\)|\1|g'` ;;
9685 $SED 's,/\([A-Za-z]:\),\1,g'` ;;
100679686 esac
100689687 sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
100699688 else
100729691 library_names_spec=
100739692 libname_spec='lib$name'
100749693 soname_spec=
10075 shrext_cmds=.so
9694 shrext_cmds=".so"
100769695 postinstall_cmds=
100779696 postuninstall_cmds=
100789697 finish_cmds=
100899708 # flags to be left without arguments
100909709 need_version=unknown
100919710
10092
10093
100949711 case $host_os in
100959712 aix3*)
100969713 version_type=linux # correct to gnu/linux during the next big refactor
10097 library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
9714 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
100989715 shlibpath_var=LIBPATH
100999716
101009717 # AIX 3 has no versioning support, so we append a major version to the name.
10101 soname_spec='$libname$release$shared_ext$major'
9718 soname_spec='${libname}${release}${shared_ext}$major'
101029719 ;;
101039720
101049721 aix[4-9]*)
101069723 need_lib_prefix=no
101079724 need_version=no
101089725 hardcode_into_libs=yes
10109 if test ia64 = "$host_cpu"; then
9726 if test "$host_cpu" = ia64; then
101109727 # AIX 5 supports IA64
10111 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
9728 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
101129729 shlibpath_var=LD_LIBRARY_PATH
101139730 else
101149731 # With GCC up to 2.95.x, collect2 would create an import file
101159732 # for dependence libraries. The import file would start with
10116 # the line '#! .'. This would cause the generated library to
10117 # depend on '.', always an invalid library. This was fixed in
9733 # the line `#! .'. This would cause the generated library to
9734 # depend on `.', always an invalid library. This was fixed in
101189735 # development snapshots of GCC prior to 3.0.
101199736 case $host_os in
101209737 aix4 | aix4.[01] | aix4.[01].*)
101219738 if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
101229739 echo ' yes '
10123 echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
9740 echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
101249741 :
101259742 else
101269743 can_build_shared=no
101279744 fi
101289745 ;;
101299746 esac
10130 # Using Import Files as archive members, it is possible to support
10131 # filename-based versioning of shared library archives on AIX. While
10132 # this would work for both with and without runtime linking, it will
10133 # prevent static linking of such archives. So we do filename-based
10134 # shared library versioning with .so extension only, which is used
10135 # when both runtime linking and shared linking is enabled.
10136 # Unfortunately, runtime linking may impact performance, so we do
10137 # not want this to be the default eventually. Also, we use the
10138 # versioned .so libs for executables only if there is the -brtl
10139 # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
10140 # To allow for filename-based versioning support, we need to create
10141 # libNAME.so.V as an archive file, containing:
10142 # *) an Import File, referring to the versioned filename of the
10143 # archive as well as the shared archive member, telling the
10144 # bitwidth (32 or 64) of that shared object, and providing the
10145 # list of exported symbols of that shared object, eventually
10146 # decorated with the 'weak' keyword
10147 # *) the shared object with the F_LOADONLY flag set, to really avoid
10148 # it being seen by the linker.
10149 # At run time we better use the real file rather than another symlink,
10150 # but for link time we create the symlink libNAME.so -> libNAME.so.V
10151
10152 case $with_aix_soname,$aix_use_runtimelinking in
10153 # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
9747 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
101549748 # soname into executable. Probably we can add versioning support to
101559749 # collect2, so additional links can be useful in future.
10156 aix,yes) # traditional libtool
10157 dynamic_linker='AIX unversionable lib.so'
9750 if test "$aix_use_runtimelinking" = yes; then
101589751 # If using run time linking (on AIX 4.2 or later) use lib<name>.so
101599752 # instead of lib<name>.a to let people know that these are not
101609753 # typical AIX shared libraries.
10161 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10162 ;;
10163 aix,no) # traditional AIX only
10164 dynamic_linker='AIX lib.a(lib.so.V)'
9754 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
9755 else
101659756 # We preserve .a as extension for shared libraries through AIX4.2
101669757 # and later when we are not doing run time linking.
10167 library_names_spec='$libname$release.a $libname.a'
10168 soname_spec='$libname$release$shared_ext$major'
10169 ;;
10170 svr4,*) # full svr4 only
10171 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)"
10172 library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
10173 # We do not specify a path in Import Files, so LIBPATH fires.
10174 shlibpath_overrides_runpath=yes
10175 ;;
10176 *,yes) # both, prefer svr4
10177 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)"
10178 library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
10179 # unpreferred sharedlib libNAME.a needs extra handling
10180 postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
10181 postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
10182 # We do not specify a path in Import Files, so LIBPATH fires.
10183 shlibpath_overrides_runpath=yes
10184 ;;
10185 *,no) # both, prefer aix
10186 dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)"
10187 library_names_spec='$libname$release.a $libname.a'
10188 soname_spec='$libname$release$shared_ext$major'
10189 # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
10190 postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
10191 postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
10192 ;;
10193 esac
9758 library_names_spec='${libname}${release}.a $libname.a'
9759 soname_spec='${libname}${release}${shared_ext}$major'
9760 fi
101949761 shlibpath_var=LIBPATH
101959762 fi
101969763 ;;
102009767 powerpc)
102019768 # Since July 2007 AmigaOS4 officially supports .so libraries.
102029769 # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
10203 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
9770 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
102049771 ;;
102059772 m68k)
102069773 library_names_spec='$libname.ixlibrary $libname.a'
102079774 # Create ${libname}_ixlibrary.a entries in /sys/libs.
10208 finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
9775 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'
102099776 ;;
102109777 esac
102119778 ;;
102129779
102139780 beos*)
10214 library_names_spec='$libname$shared_ext'
9781 library_names_spec='${libname}${shared_ext}'
102159782 dynamic_linker="$host_os ld.so"
102169783 shlibpath_var=LIBRARY_PATH
102179784 ;;
102199786 bsdi[45]*)
102209787 version_type=linux # correct to gnu/linux during the next big refactor
102219788 need_version=no
10222 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10223 soname_spec='$libname$release$shared_ext$major'
9789 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
9790 soname_spec='${libname}${release}${shared_ext}$major'
102249791 finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
102259792 shlibpath_var=LD_LIBRARY_PATH
102269793 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
102329799
102339800 cygwin* | mingw* | pw32* | cegcc*)
102349801 version_type=windows
10235 shrext_cmds=.dll
9802 shrext_cmds=".dll"
102369803 need_version=no
102379804 need_lib_prefix=no
102389805
102419808 # gcc
102429809 library_names_spec='$libname.dll.a'
102439810 # DLL is installed to $(libdir)/../bin by postinstall_cmds
10244 postinstall_cmds='base_file=`basename \$file`~
10245 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
9811 postinstall_cmds='base_file=`basename \${file}`~
9812 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
102469813 dldir=$destdir/`dirname \$dlpath`~
102479814 test -d \$dldir || mkdir -p \$dldir~
102489815 $install_prog $dir/$dlname \$dldir/$dlname~
102589825 case $host_os in
102599826 cygwin*)
102609827 # Cygwin DLLs use 'cyg' prefix rather than 'lib'
10261 soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
9828 soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
102629829
102639830 sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
102649831 ;;
102659832 mingw* | cegcc*)
102669833 # MinGW DLLs use traditional 'lib' prefix
10267 soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
9834 soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
102689835 ;;
102699836 pw32*)
102709837 # pw32 DLLs use 'pw' prefix rather than 'lib'
10271 library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
9838 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
102729839 ;;
102739840 esac
102749841 dynamic_linker='Win32 ld.exe'
102779844 *,cl*)
102789845 # Native MSVC
102799846 libname_spec='$name'
10280 soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
10281 library_names_spec='$libname.dll.lib'
9847 soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
9848 library_names_spec='${libname}.dll.lib'
102829849
102839850 case $build_os in
102849851 mingw*)
103059872 sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
103069873 ;;
103079874 *)
10308 sys_lib_search_path_spec=$LIB
9875 sys_lib_search_path_spec="$LIB"
103099876 if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
103109877 # It is most probably a Windows format PATH.
103119878 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
103189885 esac
103199886
103209887 # DLL is installed to $(libdir)/../bin by postinstall_cmds
10321 postinstall_cmds='base_file=`basename \$file`~
10322 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
9888 postinstall_cmds='base_file=`basename \${file}`~
9889 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
103239890 dldir=$destdir/`dirname \$dlpath`~
103249891 test -d \$dldir || mkdir -p \$dldir~
103259892 $install_prog $dir/$dlname \$dldir/$dlname'
103329899
103339900 *)
103349901 # Assume MSVC wrapper
10335 library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib'
9902 library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
103369903 dynamic_linker='Win32 ld.exe'
103379904 ;;
103389905 esac
103459912 version_type=darwin
103469913 need_lib_prefix=no
103479914 need_version=no
10348 library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
10349 soname_spec='$libname$release$major$shared_ext'
9915 library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
9916 soname_spec='${libname}${release}${major}$shared_ext'
103509917 shlibpath_overrides_runpath=yes
103519918 shlibpath_var=DYLD_LIBRARY_PATH
103529919 shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
103599926 version_type=linux # correct to gnu/linux during the next big refactor
103609927 need_lib_prefix=no
103619928 need_version=no
10362 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10363 soname_spec='$libname$release$shared_ext$major'
9929 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
9930 soname_spec='${libname}${release}${shared_ext}$major'
103649931 shlibpath_var=LD_LIBRARY_PATH
103659932 ;;
103669933
103789945 version_type=freebsd-$objformat
103799946 case $version_type in
103809947 freebsd-elf*)
10381 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10382 soname_spec='$libname$release$shared_ext$major'
9948 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
103839949 need_version=no
103849950 need_lib_prefix=no
103859951 ;;
103869952 freebsd-*)
10387 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
9953 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
103889954 need_version=yes
103899955 ;;
103909956 esac
104149980 need_lib_prefix=no
104159981 need_version=no
104169982 dynamic_linker="$host_os runtime_loader"
10417 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10418 soname_spec='$libname$release$shared_ext$major'
9983 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
9984 soname_spec='${libname}${release}${shared_ext}$major'
104199985 shlibpath_var=LIBRARY_PATH
10420 shlibpath_overrides_runpath=no
9986 shlibpath_overrides_runpath=yes
104219987 sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
104229988 hardcode_into_libs=yes
104239989 ;;
1043510001 dynamic_linker="$host_os dld.so"
1043610002 shlibpath_var=LD_LIBRARY_PATH
1043710003 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
10438 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10439 soname_spec='$libname$release$shared_ext$major'
10440 if test 32 = "$HPUX_IA64_MODE"; then
10004 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
10005 soname_spec='${libname}${release}${shared_ext}$major'
10006 if test "X$HPUX_IA64_MODE" = X32; then
1044110007 sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
10442 sys_lib_dlsearch_path_spec=/usr/lib/hpux32
1044310008 else
1044410009 sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
10445 sys_lib_dlsearch_path_spec=/usr/lib/hpux64
1044610010 fi
10011 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
1044710012 ;;
1044810013 hppa*64*)
1044910014 shrext_cmds='.sl'
1045110016 dynamic_linker="$host_os dld.sl"
1045210017 shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
1045310018 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
10454 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10455 soname_spec='$libname$release$shared_ext$major'
10019 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
10020 soname_spec='${libname}${release}${shared_ext}$major'
1045610021 sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
1045710022 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
1045810023 ;;
1046110026 dynamic_linker="$host_os dld.sl"
1046210027 shlibpath_var=SHLIB_PATH
1046310028 shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
10464 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10465 soname_spec='$libname$release$shared_ext$major'
10029 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
10030 soname_spec='${libname}${release}${shared_ext}$major'
1046610031 ;;
1046710032 esac
1046810033 # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
1047510040 version_type=linux # correct to gnu/linux during the next big refactor
1047610041 need_lib_prefix=no
1047710042 need_version=no
10478 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10479 soname_spec='$libname$release$shared_ext$major'
10043 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
10044 soname_spec='${libname}${release}${shared_ext}$major'
1048010045 dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
1048110046 shlibpath_var=LD_LIBRARY_PATH
1048210047 shlibpath_overrides_runpath=no
1048710052 case $host_os in
1048810053 nonstopux*) version_type=nonstopux ;;
1048910054 *)
10490 if test yes = "$lt_cv_prog_gnu_ld"; then
10055 if test "$lt_cv_prog_gnu_ld" = yes; then
1049110056 version_type=linux # correct to gnu/linux during the next big refactor
1049210057 else
1049310058 version_type=irix
1049510060 esac
1049610061 need_lib_prefix=no
1049710062 need_version=no
10498 soname_spec='$libname$release$shared_ext$major'
10499 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
10063 soname_spec='${libname}${release}${shared_ext}$major'
10064 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
1050010065 case $host_os in
1050110066 irix5* | nonstopux*)
1050210067 libsuff= shlibsuff=
1051510080 esac
1051610081 shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
1051710082 shlibpath_overrides_runpath=no
10518 sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
10519 sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
10083 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
10084 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
1052010085 hardcode_into_libs=yes
1052110086 ;;
1052210087
1052310088 # No shared lib support for Linux oldld, aout, or coff.
1052410089 linux*oldld* | linux*aout* | linux*coff*)
1052510090 dynamic_linker=no
10526 ;;
10527
10528 linux*android*)
10529 version_type=none # Android doesn't support versioned libraries.
10530 need_lib_prefix=no
10531 need_version=no
10532 library_names_spec='$libname$release$shared_ext'
10533 soname_spec='$libname$release$shared_ext'
10534 finish_cmds=
10535 shlibpath_var=LD_LIBRARY_PATH
10536 shlibpath_overrides_runpath=yes
10537
10538 # This implies no fast_install, which is unacceptable.
10539 # Some rework will be needed to allow for fast_install
10540 # before this can be enabled.
10541 hardcode_into_libs=yes
10542
10543 dynamic_linker='Android linker'
10544 # Don't embed -rpath directories since the linker doesn't support them.
10545 hardcode_libdir_flag_spec='-L$libdir'
1054610091 ;;
1054710092
1054810093 # This must be glibc/ELF.
1055010095 version_type=linux # correct to gnu/linux during the next big refactor
1055110096 need_lib_prefix=no
1055210097 need_version=no
10553 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10554 soname_spec='$libname$release$shared_ext$major'
10098 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
10099 soname_spec='${libname}${release}${shared_ext}$major'
1055510100 finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
1055610101 shlibpath_var=LD_LIBRARY_PATH
1055710102 shlibpath_overrides_runpath=no
1059510140 # before this can be enabled.
1059610141 hardcode_into_libs=yes
1059710142
10598 # Ideally, we could use ldconfig to report *all* directores which are
10599 # searched for libraries, however this is still not possible. Aside from not
10600 # being certain /sbin/ldconfig is available, command
10601 # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
10602 # even though it is searched at run-time. Try to do the best guess by
10603 # appending ld.so.conf contents (and includes) to the search path.
10143 # Append ld.so.conf contents to the search path
1060410144 if test -f /etc/ld.so.conf; then
1060510145 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' ' '`
1060610146 sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
1063210172 need_lib_prefix=no
1063310173 need_version=no
1063410174 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
10635 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
10175 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
1063610176 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
1063710177 dynamic_linker='NetBSD (a.out) ld.so'
1063810178 else
10639 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10640 soname_spec='$libname$release$shared_ext$major'
10179 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
10180 soname_spec='${libname}${release}${shared_ext}$major'
1064110181 dynamic_linker='NetBSD ld.elf_so'
1064210182 fi
1064310183 shlibpath_var=LD_LIBRARY_PATH
1064710187
1064810188 newsos6)
1064910189 version_type=linux # correct to gnu/linux during the next big refactor
10650 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10190 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
1065110191 shlibpath_var=LD_LIBRARY_PATH
1065210192 shlibpath_overrides_runpath=yes
1065310193 ;;
1065610196 version_type=qnx
1065710197 need_lib_prefix=no
1065810198 need_version=no
10659 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10660 soname_spec='$libname$release$shared_ext$major'
10199 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
10200 soname_spec='${libname}${release}${shared_ext}$major'
1066110201 shlibpath_var=LD_LIBRARY_PATH
1066210202 shlibpath_overrides_runpath=no
1066310203 hardcode_into_libs=yes
1066410204 dynamic_linker='ldqnx.so'
1066510205 ;;
1066610206
10667 openbsd* | bitrig*)
10207 openbsd*)
1066810208 version_type=sunos
10669 sys_lib_dlsearch_path_spec=/usr/lib
10209 sys_lib_dlsearch_path_spec="/usr/lib"
1067010210 need_lib_prefix=no
10671 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
10672 need_version=no
10673 else
10674 need_version=yes
10675 fi
10676 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
10211 # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
10212 case $host_os in
10213 openbsd3.3 | openbsd3.3.*) need_version=yes ;;
10214 *) need_version=no ;;
10215 esac
10216 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
1067710217 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
1067810218 shlibpath_var=LD_LIBRARY_PATH
10679 shlibpath_overrides_runpath=yes
10219 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
10220 case $host_os in
10221 openbsd2.[89] | openbsd2.[89].*)
10222 shlibpath_overrides_runpath=no
10223 ;;
10224 *)
10225 shlibpath_overrides_runpath=yes
10226 ;;
10227 esac
10228 else
10229 shlibpath_overrides_runpath=yes
10230 fi
1068010231 ;;
1068110232
1068210233 os2*)
1068310234 libname_spec='$name'
10684 version_type=windows
10685 shrext_cmds=.dll
10686 need_version=no
10235 shrext_cmds=".dll"
1068710236 need_lib_prefix=no
10688 # OS/2 can only load a DLL with a base name of 8 characters or less.
10689 soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
10690 v=$($ECHO $release$versuffix | tr -d .-);
10691 n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
10692 $ECHO $n$v`$shared_ext'
10693 library_names_spec='${libname}_dll.$libext'
10237 library_names_spec='$libname${shared_ext} $libname.a'
1069410238 dynamic_linker='OS/2 ld.exe'
10695 shlibpath_var=BEGINLIBPATH
10696 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
10697 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
10698 postinstall_cmds='base_file=`basename \$file`~
10699 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
10700 dldir=$destdir/`dirname \$dlpath`~
10701 test -d \$dldir || mkdir -p \$dldir~
10702 $install_prog $dir/$dlname \$dldir/$dlname~
10703 chmod a+x \$dldir/$dlname~
10704 if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
10705 eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
10706 fi'
10707 postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
10708 dlpath=$dir/\$dldll~
10709 $RM \$dlpath'
10239 shlibpath_var=LIBPATH
1071010240 ;;
1071110241
1071210242 osf3* | osf4* | osf5*)
1071310243 version_type=osf
1071410244 need_lib_prefix=no
1071510245 need_version=no
10716 soname_spec='$libname$release$shared_ext$major'
10717 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10246 soname_spec='${libname}${release}${shared_ext}$major'
10247 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
1071810248 shlibpath_var=LD_LIBRARY_PATH
1071910249 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
10720 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
10250 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
1072110251 ;;
1072210252
1072310253 rdos*)
1072810258 version_type=linux # correct to gnu/linux during the next big refactor
1072910259 need_lib_prefix=no
1073010260 need_version=no
10731 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10732 soname_spec='$libname$release$shared_ext$major'
10261 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
10262 soname_spec='${libname}${release}${shared_ext}$major'
1073310263 shlibpath_var=LD_LIBRARY_PATH
1073410264 shlibpath_overrides_runpath=yes
1073510265 hardcode_into_libs=yes
1073910269
1074010270 sunos4*)
1074110271 version_type=sunos
10742 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
10272 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
1074310273 finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
1074410274 shlibpath_var=LD_LIBRARY_PATH
1074510275 shlibpath_overrides_runpath=yes
10746 if test yes = "$with_gnu_ld"; then
10276 if test "$with_gnu_ld" = yes; then
1074710277 need_lib_prefix=no
1074810278 fi
1074910279 need_version=yes
1075110281
1075210282 sysv4 | sysv4.3*)
1075310283 version_type=linux # correct to gnu/linux during the next big refactor
10754 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10755 soname_spec='$libname$release$shared_ext$major'
10284 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
10285 soname_spec='${libname}${release}${shared_ext}$major'
1075610286 shlibpath_var=LD_LIBRARY_PATH
1075710287 case $host_vendor in
1075810288 sni)
1077310303 ;;
1077410304
1077510305 sysv4*MP*)
10776 if test -d /usr/nec; then
10306 if test -d /usr/nec ;then
1077710307 version_type=linux # correct to gnu/linux during the next big refactor
10778 library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
10779 soname_spec='$libname$shared_ext.$major'
10308 library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
10309 soname_spec='$libname${shared_ext}.$major'
1078010310 shlibpath_var=LD_LIBRARY_PATH
1078110311 fi
1078210312 ;;
1078310313
1078410314 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
10785 version_type=sco
10315 version_type=freebsd-elf
1078610316 need_lib_prefix=no
1078710317 need_version=no
10788 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
10789 soname_spec='$libname$release$shared_ext$major'
10318 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
10319 soname_spec='${libname}${release}${shared_ext}$major'
1079010320 shlibpath_var=LD_LIBRARY_PATH
1079110321 shlibpath_overrides_runpath=yes
1079210322 hardcode_into_libs=yes
10793 if test yes = "$with_gnu_ld"; then
10323 if test "$with_gnu_ld" = yes; then
1079410324 sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
1079510325 else
1079610326 sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
1080810338 version_type=linux # correct to gnu/linux during the next big refactor
1080910339 need_lib_prefix=no
1081010340 need_version=no
10811 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10341 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
1081210342 shlibpath_var=LD_LIBRARY_PATH
1081310343 shlibpath_overrides_runpath=no
1081410344 hardcode_into_libs=yes
1081610346
1081710347 uts4*)
1081810348 version_type=linux # correct to gnu/linux during the next big refactor
10819 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
10820 soname_spec='$libname$release$shared_ext$major'
10349 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
10350 soname_spec='${libname}${release}${shared_ext}$major'
1082110351 shlibpath_var=LD_LIBRARY_PATH
1082210352 ;;
1082310353
1082710357 esac
1082810358 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
1082910359 $as_echo "$dynamic_linker" >&6; }
10830 test no = "$dynamic_linker" && can_build_shared=no
10360 test "$dynamic_linker" = no && can_build_shared=no
1083110361
1083210362 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
10833 if test yes = "$GCC"; then
10363 if test "$GCC" = yes; then
1083410364 variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
1083510365 fi
1083610366
10837 if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
10838 sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
10839 fi
10840
10841 if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
10842 sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
10843 fi
10844
10845 # remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
10846 configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
10847
10848 # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
10849 func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
10850
10851 # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
10852 configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
10853
10854
10855
10856
10857
10367 if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
10368 sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
10369 fi
10370 if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
10371 sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
10372 fi
1085810373
1085910374
1086010375
1095210467 hardcode_action=
1095310468 if test -n "$hardcode_libdir_flag_spec" ||
1095410469 test -n "$runpath_var" ||
10955 test yes = "$hardcode_automatic"; then
10470 test "X$hardcode_automatic" = "Xyes" ; then
1095610471
1095710472 # We can hardcode non-existent directories.
10958 if test no != "$hardcode_direct" &&
10473 if test "$hardcode_direct" != no &&
1095910474 # If the only mechanism to avoid hardcoding is shlibpath_var, we
1096010475 # have to relink, otherwise we might link with an installed library
1096110476 # when we should be linking with a yet-to-be-installed one
10962 ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" &&
10963 test no != "$hardcode_minus_L"; then
10477 ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
10478 test "$hardcode_minus_L" != no; then
1096410479 # Linking always hardcodes the temporary library directory.
1096510480 hardcode_action=relink
1096610481 else
1097510490 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
1097610491 $as_echo "$hardcode_action" >&6; }
1097710492
10978 if test relink = "$hardcode_action" ||
10979 test yes = "$inherit_rpath"; then
10493 if test "$hardcode_action" = relink ||
10494 test "$inherit_rpath" = yes; then
1098010495 # Fast installation is not supported
1098110496 enable_fast_install=no
10982 elif test yes = "$shlibpath_overrides_runpath" ||
10983 test no = "$enable_shared"; then
10497 elif test "$shlibpath_overrides_runpath" = yes ||
10498 test "$enable_shared" = no; then
1098410499 # Fast installation is not necessary
1098510500 enable_fast_install=needless
1098610501 fi
1099010505
1099110506
1099210507
10993 if test yes != "$enable_dlopen"; then
10508 if test "x$enable_dlopen" != xyes; then
1099410509 enable_dlopen=unknown
1099510510 enable_dlopen_self=unknown
1099610511 enable_dlopen_self_static=unknown
1100010515
1100110516 case $host_os in
1100210517 beos*)
11003 lt_cv_dlopen=load_add_on
10518 lt_cv_dlopen="load_add_on"
1100410519 lt_cv_dlopen_libs=
1100510520 lt_cv_dlopen_self=yes
1100610521 ;;
1100710522
1100810523 mingw* | pw32* | cegcc*)
11009 lt_cv_dlopen=LoadLibrary
10524 lt_cv_dlopen="LoadLibrary"
1101010525 lt_cv_dlopen_libs=
1101110526 ;;
1101210527
1101310528 cygwin*)
11014 lt_cv_dlopen=dlopen
10529 lt_cv_dlopen="dlopen"
1101510530 lt_cv_dlopen_libs=
1101610531 ;;
1101710532
1101810533 darwin*)
11019 # if libdl is installed we need to link against it
10534 # if libdl is installed we need to link against it
1102010535 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
1102110536 $as_echo_n "checking for dlopen in -ldl... " >&6; }
1102210537 if ${ac_cv_lib_dl_dlopen+:} false; then :
1105410569 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
1105510570 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
1105610571 if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
11057 lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl
11058 else
11059
11060 lt_cv_dlopen=dyld
10572 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
10573 else
10574
10575 lt_cv_dlopen="dyld"
1106110576 lt_cv_dlopen_libs=
1106210577 lt_cv_dlopen_self=yes
1106310578
1106410579 fi
1106510580
11066 ;;
11067
11068 tpf*)
11069 # Don't try to run any link tests for TPF. We know it's impossible
11070 # because TPF is a cross-compiler, and we know how we open DSOs.
11071 lt_cv_dlopen=dlopen
11072 lt_cv_dlopen_libs=
11073 lt_cv_dlopen_self=no
1107410581 ;;
1107510582
1107610583 *)
1107710584 ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
1107810585 if test "x$ac_cv_func_shl_load" = xyes; then :
11079 lt_cv_dlopen=shl_load
10586 lt_cv_dlopen="shl_load"
1108010587 else
1108110588 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
1108210589 $as_echo_n "checking for shl_load in -ldld... " >&6; }
1111510622 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
1111610623 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
1111710624 if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
11118 lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld
10625 lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
1111910626 else
1112010627 ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
1112110628 if test "x$ac_cv_func_dlopen" = xyes; then :
11122 lt_cv_dlopen=dlopen
10629 lt_cv_dlopen="dlopen"
1112310630 else
1112410631 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
1112510632 $as_echo_n "checking for dlopen in -ldl... " >&6; }
1115810665 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
1115910666 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
1116010667 if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
11161 lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl
10668 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
1116210669 else
1116310670 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
1116410671 $as_echo_n "checking for dlopen in -lsvld... " >&6; }
1119710704 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
1119810705 $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
1119910706 if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
11200 lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld
10707 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
1120110708 else
1120210709 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
1120310710 $as_echo_n "checking for dld_link in -ldld... " >&6; }
1123610743 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
1123710744 $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
1123810745 if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
11239 lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld
10746 lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
1124010747 fi
1124110748
1124210749
1125710764 ;;
1125810765 esac
1125910766
11260 if test no = "$lt_cv_dlopen"; then
10767 if test "x$lt_cv_dlopen" != xno; then
10768 enable_dlopen=yes
10769 else
1126110770 enable_dlopen=no
11262 else
11263 enable_dlopen=yes
1126410771 fi
1126510772
1126610773 case $lt_cv_dlopen in
1126710774 dlopen)
11268 save_CPPFLAGS=$CPPFLAGS
11269 test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
11270
11271 save_LDFLAGS=$LDFLAGS
10775 save_CPPFLAGS="$CPPFLAGS"
10776 test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
10777
10778 save_LDFLAGS="$LDFLAGS"
1127210779 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
1127310780
11274 save_LIBS=$LIBS
10781 save_LIBS="$LIBS"
1127510782 LIBS="$lt_cv_dlopen_libs $LIBS"
1127610783
1127710784 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
1127910786 if ${lt_cv_dlopen_self+:} false; then :
1128010787 $as_echo_n "(cached) " >&6
1128110788 else
11282 if test yes = "$cross_compiling"; then :
10789 if test "$cross_compiling" = yes; then :
1128310790 lt_cv_dlopen_self=cross
1128410791 else
1128510792 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1132610833 # endif
1132710834 #endif
1132810835
11329 /* When -fvisibility=hidden is used, assume the code has been annotated
10836 /* When -fvisbility=hidden is used, assume the code has been annotated
1133010837 correspondingly for the symbols needed. */
11331 #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
10838 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
1133210839 int fnord () __attribute__((visibility("default")));
1133310840 #endif
1133410841
1135810865 (eval $ac_link) 2>&5
1135910866 ac_status=$?
1136010867 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
11361 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then
10868 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
1136210869 (./conftest; exit; ) >&5 2>/dev/null
1136310870 lt_status=$?
1136410871 case x$lt_status in
1137810885 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
1137910886 $as_echo "$lt_cv_dlopen_self" >&6; }
1138010887
11381 if test yes = "$lt_cv_dlopen_self"; then
10888 if test "x$lt_cv_dlopen_self" = xyes; then
1138210889 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
1138310890 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
1138410891 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
1138510892 if ${lt_cv_dlopen_self_static+:} false; then :
1138610893 $as_echo_n "(cached) " >&6
1138710894 else
11388 if test yes = "$cross_compiling"; then :
10895 if test "$cross_compiling" = yes; then :
1138910896 lt_cv_dlopen_self_static=cross
1139010897 else
1139110898 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1143210939 # endif
1143310940 #endif
1143410941
11435 /* When -fvisibility=hidden is used, assume the code has been annotated
10942 /* When -fvisbility=hidden is used, assume the code has been annotated
1143610943 correspondingly for the symbols needed. */
11437 #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
10944 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
1143810945 int fnord () __attribute__((visibility("default")));
1143910946 #endif
1144010947
1146410971 (eval $ac_link) 2>&5
1146510972 ac_status=$?
1146610973 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
11467 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then
10974 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
1146810975 (./conftest; exit; ) >&5 2>/dev/null
1146910976 lt_status=$?
1147010977 case x$lt_status in
1148510992 $as_echo "$lt_cv_dlopen_self_static" >&6; }
1148610993 fi
1148710994
11488 CPPFLAGS=$save_CPPFLAGS
11489 LDFLAGS=$save_LDFLAGS
11490 LIBS=$save_LIBS
10995 CPPFLAGS="$save_CPPFLAGS"
10996 LDFLAGS="$save_LDFLAGS"
10997 LIBS="$save_LIBS"
1149110998 ;;
1149210999 esac
1149311000
1153111038 # FIXME - insert some real tests, host_os isn't really good enough
1153211039 case $host_os in
1153311040 darwin*)
11534 if test -n "$STRIP"; then
11041 if test -n "$STRIP" ; then
1153511042 striplib="$STRIP -x"
1153611043 old_striplib="$STRIP -S"
1153711044 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1155911066
1156011067
1156111068
11562 # Report what library types will actually be built
11069 # Report which library types will actually be built
1156311070 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
1156411071 $as_echo_n "checking if libtool supports shared libraries... " >&6; }
1156511072 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
1156711074
1156811075 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
1156911076 $as_echo_n "checking whether to build shared libraries... " >&6; }
11570 test no = "$can_build_shared" && enable_shared=no
11077 test "$can_build_shared" = "no" && enable_shared=no
1157111078
1157211079 # On AIX, shared libraries and static libraries use the same namespace, and
1157311080 # are all built from PIC.
1157411081 case $host_os in
1157511082 aix3*)
11576 test yes = "$enable_shared" && enable_static=no
11083 test "$enable_shared" = yes && enable_static=no
1157711084 if test -n "$RANLIB"; then
1157811085 archive_cmds="$archive_cmds~\$RANLIB \$lib"
1157911086 postinstall_cmds='$RANLIB $lib'
1158111088 ;;
1158211089
1158311090 aix[4-9]*)
11584 if test ia64 != "$host_cpu"; then
11585 case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
11586 yes,aix,yes) ;; # shared object as lib.so file only
11587 yes,svr4,*) ;; # shared object as lib.so archive member only
11588 yes,*) enable_static=no ;; # shared object in lib.a archive as well
11589 esac
11091 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
11092 test "$enable_shared" = yes && enable_static=no
1159011093 fi
1159111094 ;;
1159211095 esac
1159611099 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
1159711100 $as_echo_n "checking whether to build static libraries... " >&6; }
1159811101 # Make sure either enable_shared or enable_static is yes.
11599 test yes = "$enable_shared" || enable_static=yes
11102 test "$enable_shared" = yes || enable_static=yes
1160011103 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
1160111104 $as_echo "$enable_static" >&6; }
1160211105
1161011113 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
1161111114 ac_compiler_gnu=$ac_cv_c_compiler_gnu
1161211115
11613 CC=$lt_save_CC
11116 CC="$lt_save_CC"
1161411117
1161511118
1161611119
1213211635
1213311636 func_stripname_cnf ()
1213411637 {
12135 case $2 in
12136 .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;;
12137 *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;;
11638 case ${2} in
11639 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
11640 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
1213811641 esac
1213911642 } # func_stripname_cnf
1214011643
12141 if test -n "$CXX" && ( test no != "$CXX" &&
12142 ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) ||
12143 (test g++ != "$CXX"))); then
11644 if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
11645 ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
11646 (test "X$CXX" != "Xg++"))) ; then
1214411647 ac_ext=cpp
1214511648 ac_cpp='$CXXCPP $CPPFLAGS'
1214611649 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
1231911822 # the CXX compiler isn't working. Some variables (like enable_shared)
1232011823 # are currently assumed to apply to all compilers on this platform,
1232111824 # and will be corrupted by setting them based on a non-working compiler.
12322 if test yes != "$_lt_caught_CXX_error"; then
11825 if test "$_lt_caught_CXX_error" != yes; then
1232311826 # Code to be used in simple compile tests
1232411827 lt_simple_compile_test_code="int some_variable = 0;"
1232511828
1238011883 CFLAGS=$CXXFLAGS
1238111884 compiler=$CC
1238211885 compiler_CXX=$CC
12383 func_cc_basename $compiler
12384 cc_basename=$func_cc_basename_result
11886 for cc_temp in $compiler""; do
11887 case $cc_temp in
11888 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
11889 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
11890 \-*) ;;
11891 *) break;;
11892 esac
11893 done
11894 cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
1238511895
1238611896
1238711897 if test -n "$compiler"; then
1238811898 # We don't want -fno-exception when compiling C++ code, so set the
1238911899 # no_builtin_flag separately
12390 if test yes = "$GXX"; then
11900 if test "$GXX" = yes; then
1239111901 lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
1239211902 else
1239311903 lt_prog_compiler_no_builtin_flag_CXX=
1239411904 fi
1239511905
12396 if test yes = "$GXX"; then
11906 if test "$GXX" = yes; then
1239711907 # Set up default GNU C++ configuration
1239811908
1239911909
1240011910
1240111911 # Check whether --with-gnu-ld was given.
1240211912 if test "${with_gnu_ld+set}" = set; then :
12403 withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes
11913 withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
1240411914 else
1240511915 with_gnu_ld=no
1240611916 fi
1240711917
1240811918 ac_prog=ld
12409 if test yes = "$GCC"; then
11919 if test "$GCC" = yes; then
1241011920 # Check if gcc -print-prog-name=ld gives a path.
1241111921 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
1241211922 $as_echo_n "checking for ld used by $CC... " >&6; }
1241311923 case $host in
1241411924 *-*-mingw*)
12415 # gcc leaves a trailing carriage return, which upsets mingw
11925 # gcc leaves a trailing carriage return which upsets mingw
1241611926 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1241711927 *)
1241811928 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1242611936 while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
1242711937 ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
1242811938 done
12429 test -z "$LD" && LD=$ac_prog
11939 test -z "$LD" && LD="$ac_prog"
1243011940 ;;
1243111941 "")
1243211942 # If it fails, then pretend we aren't using GCC.
1243711947 with_gnu_ld=unknown
1243811948 ;;
1243911949 esac
12440 elif test yes = "$with_gnu_ld"; then
11950 elif test "$with_gnu_ld" = yes; then
1244111951 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
1244211952 $as_echo_n "checking for GNU ld... " >&6; }
1244311953 else
1244811958 $as_echo_n "(cached) " >&6
1244911959 else
1245011960 if test -z "$LD"; then
12451 lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
11961 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
1245211962 for ac_dir in $PATH; do
12453 IFS=$lt_save_ifs
11963 IFS="$lt_save_ifs"
1245411964 test -z "$ac_dir" && ac_dir=.
1245511965 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
12456 lt_cv_path_LD=$ac_dir/$ac_prog
11966 lt_cv_path_LD="$ac_dir/$ac_prog"
1245711967 # Check to see if the program is GNU ld. I'd rather use --version,
1245811968 # but apparently some variants of GNU ld only accept -v.
1245911969 # Break only if it was the GNU/non-GNU ld that we prefer.
1246011970 case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
1246111971 *GNU* | *'with BFD'*)
12462 test no != "$with_gnu_ld" && break
11972 test "$with_gnu_ld" != no && break
1246311973 ;;
1246411974 *)
12465 test yes != "$with_gnu_ld" && break
11975 test "$with_gnu_ld" != yes && break
1246611976 ;;
1246711977 esac
1246811978 fi
1246911979 done
12470 IFS=$lt_save_ifs
12471 else
12472 lt_cv_path_LD=$LD # Let the user override the test with a path.
12473 fi
12474 fi
12475
12476 LD=$lt_cv_path_LD
11980 IFS="$lt_save_ifs"
11981 else
11982 lt_cv_path_LD="$LD" # Let the user override the test with a path.
11983 fi
11984 fi
11985
11986 LD="$lt_cv_path_LD"
1247711987 if test -n "$LD"; then
1247811988 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
1247911989 $as_echo "$LD" >&6; }
1250912019
1251012020 # Check if GNU C++ uses GNU ld as the underlying linker, since the
1251112021 # archiving commands below assume that GNU ld is being used.
12512 if test yes = "$with_gnu_ld"; then
12513 archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
12514 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'
12515
12516 hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
12517 export_dynamic_flag_spec_CXX='$wl--export-dynamic'
12022 if test "$with_gnu_ld" = yes; then
12023 archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
12024 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'
12025
12026 hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
12027 export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
1251812028
1251912029 # If archive_cmds runs LD, not CC, wlarc should be empty
1252012030 # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
1252112031 # investigate it a little bit more. (MM)
12522 wlarc='$wl'
12032 wlarc='${wl}'
1252312033
1252412034 # ancient GNU ld didn't support --whole-archive et. al.
1252512035 if eval "`$CC -print-prog-name=ld` --help 2>&1" |
1252612036 $GREP 'no-whole-archive' > /dev/null; then
12527 whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
12037 whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
1252812038 else
1252912039 whole_archive_flag_spec_CXX=
1253012040 fi
1256112071 ld_shlibs_CXX=no
1256212072 ;;
1256312073 aix[4-9]*)
12564 if test ia64 = "$host_cpu"; then
12074 if test "$host_cpu" = ia64; then
1256512075 # On IA64, the linker does run time linking by default, so we don't
1256612076 # have to do anything special.
1256712077 aix_use_runtimelinking=no
1256812078 exp_sym_flag='-Bexport'
12569 no_entry_flag=
12079 no_entry_flag=""
1257012080 else
1257112081 aix_use_runtimelinking=no
1257212082
1257312083 # Test if we are trying to use run time linking or normal
1257412084 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
12575 # have runtime linking enabled, and use it for executables.
12576 # For shared libraries, we enable/disable runtime linking
12577 # depending on the kind of the shared library created -
12578 # when "with_aix_soname,aix_use_runtimelinking" is:
12579 # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables
12580 # "aix,yes" lib.so shared, rtl:yes, for executables
12581 # lib.a static archive
12582 # "both,no" lib.so.V(shr.o) shared, rtl:yes
12583 # lib.a(lib.so.V) shared, rtl:no, for executables
12584 # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
12585 # lib.a(lib.so.V) shared, rtl:no
12586 # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables
12587 # lib.a static archive
12085 # need to do runtime linking.
1258812086 case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
1258912087 for ld_flag in $LDFLAGS; do
1259012088 case $ld_flag in
1259412092 ;;
1259512093 esac
1259612094 done
12597 if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
12598 # With aix-soname=svr4, we create the lib.so.V shared archives only,
12599 # so we don't have lib.a shared libs to link our executables.
12600 # We have to force runtime linking in this case.
12601 aix_use_runtimelinking=yes
12602 LDFLAGS="$LDFLAGS -Wl,-brtl"
12603 fi
1260412095 ;;
1260512096 esac
1260612097
1261912110 hardcode_direct_absolute_CXX=yes
1262012111 hardcode_libdir_separator_CXX=':'
1262112112 link_all_deplibs_CXX=yes
12622 file_list_spec_CXX='$wl-f,'
12623 case $with_aix_soname,$aix_use_runtimelinking in
12624 aix,*) ;; # no import file
12625 svr4,* | *,yes) # use import file
12626 # The Import File defines what to hardcode.
12627 hardcode_direct_CXX=no
12628 hardcode_direct_absolute_CXX=no
12629 ;;
12630 esac
12631
12632 if test yes = "$GXX"; then
12113 file_list_spec_CXX='${wl}-f,'
12114
12115 if test "$GXX" = yes; then
1263312116 case $host_os in aix4.[012]|aix4.[012].*)
1263412117 # We only want to do this on AIX 4.2 and lower, the check
1263512118 # below for broken collect2 doesn't work under 4.3+
12636 collect2name=`$CC -print-prog-name=collect2`
12119 collect2name=`${CC} -print-prog-name=collect2`
1263712120 if test -f "$collect2name" &&
1263812121 strings "$collect2name" | $GREP resolve_lib_name >/dev/null
1263912122 then
1265112134 fi
1265212135 esac
1265312136 shared_flag='-shared'
12654 if test yes = "$aix_use_runtimelinking"; then
12655 shared_flag=$shared_flag' $wl-G'
12137 if test "$aix_use_runtimelinking" = yes; then
12138 shared_flag="$shared_flag "'${wl}-G'
1265612139 fi
12657 # Need to ensure runtime linking is disabled for the traditional
12658 # shared library, or the linker may eventually find shared libraries
12659 # /with/ Import File - we do not want to mix them.
12660 shared_flag_aix='-shared'
12661 shared_flag_svr4='-shared $wl-G'
1266212140 else
1266312141 # not using gcc
12664 if test ia64 = "$host_cpu"; then
12142 if test "$host_cpu" = ia64; then
1266512143 # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
1266612144 # chokes on -Wl,-G. The following line is correct:
1266712145 shared_flag='-G'
1266812146 else
12669 if test yes = "$aix_use_runtimelinking"; then
12670 shared_flag='$wl-G'
12147 if test "$aix_use_runtimelinking" = yes; then
12148 shared_flag='${wl}-G'
1267112149 else
12672 shared_flag='$wl-bM:SRE'
12150 shared_flag='${wl}-bM:SRE'
1267312151 fi
12674 shared_flag_aix='$wl-bM:SRE'
12675 shared_flag_svr4='$wl-G'
1267612152 fi
1267712153 fi
1267812154
12679 export_dynamic_flag_spec_CXX='$wl-bexpall'
12155 export_dynamic_flag_spec_CXX='${wl}-bexpall'
1268012156 # It seems that -bexpall does not export symbols beginning with
1268112157 # underscore (_), so it is better to generate a list of symbols to
1268212158 # export.
1268312159 always_export_symbols_CXX=yes
12684 if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
12160 if test "$aix_use_runtimelinking" = yes; then
1268512161 # Warning - without using the other runtime loading flags (-brtl),
1268612162 # -berok will link without error, but may produce a broken library.
12687 # The "-G" linker flag allows undefined symbols.
12688 no_undefined_flag_CXX='-bernotok'
12163 allow_undefined_flag_CXX='-berok'
1268912164 # Determine the default libpath from the value encoded in an empty
1269012165 # executable.
12691 if test set = "${lt_cv_aix_libpath+set}"; then
12166 if test "${lt_cv_aix_libpath+set}" = set; then
1269212167 aix_libpath=$lt_cv_aix_libpath
1269312168 else
1269412169 if ${lt_cv_aix_libpath__CXX+:} false; then :
1272312198 rm -f core conftest.err conftest.$ac_objext \
1272412199 conftest$ac_exeext conftest.$ac_ext
1272512200 if test -z "$lt_cv_aix_libpath__CXX"; then
12726 lt_cv_aix_libpath__CXX=/usr/lib:/lib
12201 lt_cv_aix_libpath__CXX="/usr/lib:/lib"
1272712202 fi
1272812203
1272912204 fi
1273112206 aix_libpath=$lt_cv_aix_libpath__CXX
1273212207 fi
1273312208
12734 hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath"
12735
12736 archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
12209 hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
12210
12211 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"
1273712212 else
12738 if test ia64 = "$host_cpu"; then
12739 hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib'
12213 if test "$host_cpu" = ia64; then
12214 hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
1274012215 allow_undefined_flag_CXX="-z nodefs"
12741 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"
12216 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"
1274212217 else
1274312218 # Determine the default libpath from the value encoded in an
1274412219 # empty executable.
12745 if test set = "${lt_cv_aix_libpath+set}"; then
12220 if test "${lt_cv_aix_libpath+set}" = set; then
1274612221 aix_libpath=$lt_cv_aix_libpath
1274712222 else
1274812223 if ${lt_cv_aix_libpath__CXX+:} false; then :
1277712252 rm -f core conftest.err conftest.$ac_objext \
1277812253 conftest$ac_exeext conftest.$ac_ext
1277912254 if test -z "$lt_cv_aix_libpath__CXX"; then
12780 lt_cv_aix_libpath__CXX=/usr/lib:/lib
12255 lt_cv_aix_libpath__CXX="/usr/lib:/lib"
1278112256 fi
1278212257
1278312258 fi
1278512260 aix_libpath=$lt_cv_aix_libpath__CXX
1278612261 fi
1278712262
12788 hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath"
12263 hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
1278912264 # Warning - without using the other run time loading flags,
1279012265 # -berok will link without error, but may produce a broken library.
12791 no_undefined_flag_CXX=' $wl-bernotok'
12792 allow_undefined_flag_CXX=' $wl-berok'
12793 if test yes = "$with_gnu_ld"; then
12266 no_undefined_flag_CXX=' ${wl}-bernotok'
12267 allow_undefined_flag_CXX=' ${wl}-berok'
12268 if test "$with_gnu_ld" = yes; then
1279412269 # We only use this code for GNU lds that support --whole-archive.
12795 whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive'
12270 whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
1279612271 else
1279712272 # Exported symbols can be pulled into shared objects from archives
1279812273 whole_archive_flag_spec_CXX='$convenience'
1279912274 fi
1280012275 archive_cmds_need_lc_CXX=yes
12801 archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
12802 # -brtl affects multiple linker settings, -berok does not and is overridden later
12803 compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`'
12804 if test svr4 != "$with_aix_soname"; then
12805 # This is similar to how AIX traditionally builds its shared
12806 # libraries. Need -bnortl late, we may have -brtl in LDFLAGS.
12807 archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
12808 fi
12809 if test aix != "$with_aix_soname"; then
12810 archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
12811 else
12812 # used by -dlpreopen to get the symbols
12813 archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir'
12814 fi
12815 archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d'
12276 # This is similar to how AIX traditionally builds its shared
12277 # libraries.
12278 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'
1281612279 fi
1281712280 fi
1281812281 ;;
1282212285 allow_undefined_flag_CXX=unsupported
1282312286 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
1282412287 # support --undefined. This deserves some investigation. FIXME
12825 archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
12288 archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1282612289 else
1282712290 ld_shlibs_CXX=no
1282812291 fi
1285012313 # Tell ltmain to make .lib files, not .a files.
1285112314 libext=lib
1285212315 # Tell ltmain to make .dll files, not .so files.
12853 shrext_cmds=.dll
12316 shrext_cmds=".dll"
1285412317 # FIXME: Setting linknames here is a bad hack.
12855 archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
12856 archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then
12857 cp "$export_symbols" "$output_objdir/$soname.def";
12858 echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
12859 else
12860 $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
12861 fi~
12862 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
12863 linknames='
12318 archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
12319 archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
12320 $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
12321 else
12322 $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
12323 fi~
12324 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
12325 linknames='
1286412326 # The linker will not automatically build a static lib if we build a DLL.
1286512327 # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
1286612328 enable_shared_with_static_runtimes_CXX=yes
1286712329 # Don't use ranlib
1286812330 old_postinstall_cmds_CXX='chmod 644 $oldlib'
1286912331 postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
12870 lt_tool_outputfile="@TOOL_OUTPUT@"~
12871 case $lt_outputfile in
12872 *.exe|*.EXE) ;;
12873 *)
12874 lt_outputfile=$lt_outputfile.exe
12875 lt_tool_outputfile=$lt_tool_outputfile.exe
12876 ;;
12877 esac~
12878 func_to_tool_file "$lt_outputfile"~
12879 if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
12880 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
12881 $RM "$lt_outputfile.manifest";
12882 fi'
12332 lt_tool_outputfile="@TOOL_OUTPUT@"~
12333 case $lt_outputfile in
12334 *.exe|*.EXE) ;;
12335 *)
12336 lt_outputfile="$lt_outputfile.exe"
12337 lt_tool_outputfile="$lt_tool_outputfile.exe"
12338 ;;
12339 esac~
12340 func_to_tool_file "$lt_outputfile"~
12341 if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
12342 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
12343 $RM "$lt_outputfile.manifest";
12344 fi'
1288312345 ;;
1288412346 *)
1288512347 # g++
1288612348 # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
1288712349 # as there is no search path for DLLs.
1288812350 hardcode_libdir_flag_spec_CXX='-L$libdir'
12889 export_dynamic_flag_spec_CXX='$wl--export-all-symbols'
12351 export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
1289012352 allow_undefined_flag_CXX=unsupported
1289112353 always_export_symbols_CXX=no
1289212354 enable_shared_with_static_runtimes_CXX=yes
1289312355
1289412356 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
12895 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'
12896 # If the export-symbols file already is a .def file, use it as
12897 # is; otherwise, prepend EXPORTS...
12898 archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then
12899 cp $export_symbols $output_objdir/$soname.def;
12900 else
12901 echo EXPORTS > $output_objdir/$soname.def;
12902 cat $export_symbols >> $output_objdir/$soname.def;
12903 fi~
12904 $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'
12357 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'
12358 # If the export-symbols file already is a .def file (1st line
12359 # is EXPORTS), use it as is; otherwise, prepend...
12360 archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
12361 cp $export_symbols $output_objdir/$soname.def;
12362 else
12363 echo EXPORTS > $output_objdir/$soname.def;
12364 cat $export_symbols >> $output_objdir/$soname.def;
12365 fi~
12366 $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'
1290512367 else
1290612368 ld_shlibs_CXX=no
1290712369 fi
1291512377 hardcode_direct_CXX=no
1291612378 hardcode_automatic_CXX=yes
1291712379 hardcode_shlibpath_var_CXX=unsupported
12918 if test yes = "$lt_cv_ld_force_load"; then
12919 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\"`'
12380 if test "$lt_cv_ld_force_load" = "yes"; then
12381 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\"`'
1292012382
1292112383 else
1292212384 whole_archive_flag_spec_CXX=''
1292312385 fi
1292412386 link_all_deplibs_CXX=yes
12925 allow_undefined_flag_CXX=$_lt_dar_allow_undefined
12387 allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
1292612388 case $cc_basename in
12927 ifort*|nagfor*) _lt_dar_can_shared=yes ;;
12389 ifort*) _lt_dar_can_shared=yes ;;
1292812390 *) _lt_dar_can_shared=$GCC ;;
1292912391 esac
12930 if test yes = "$_lt_dar_can_shared"; then
12392 if test "$_lt_dar_can_shared" = "yes"; then
1293112393 output_verbose_link_cmd=func_echo_all
12932 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"
12933 module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
12934 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"
12935 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"
12936 if test yes != "$lt_cv_apple_cc_single_mod"; then
12937 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"
12938 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"
12394 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}"
12395 module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
12396 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}"
12397 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}"
12398 if test "$lt_cv_apple_cc_single_mod" != "yes"; then
12399 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}"
12400 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}"
1293912401 fi
1294012402
1294112403 else
1294212404 ld_shlibs_CXX=no
1294312405 fi
1294412406
12945 ;;
12946
12947 os2*)
12948 hardcode_libdir_flag_spec_CXX='-L$libdir'
12949 hardcode_minus_L_CXX=yes
12950 allow_undefined_flag_CXX=unsupported
12951 shrext_cmds=.dll
12952 archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
12953 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
12954 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
12955 $ECHO EXPORTS >> $output_objdir/$libname.def~
12956 emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
12957 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
12958 emximp -o $lib $output_objdir/$libname.def'
12959 archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
12960 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
12961 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
12962 $ECHO EXPORTS >> $output_objdir/$libname.def~
12963 prefix_cmds="$SED"~
12964 if test EXPORTS = "`$SED 1q $export_symbols`"; then
12965 prefix_cmds="$prefix_cmds -e 1d";
12966 fi~
12967 prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
12968 cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
12969 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
12970 emximp -o $lib $output_objdir/$libname.def'
12971 old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
12972 enable_shared_with_static_runtimes_CXX=yes
1297312407 ;;
1297412408
1297512409 dgux*)
1300712441 ;;
1300812442
1300912443 haiku*)
13010 archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
12444 archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1301112445 link_all_deplibs_CXX=yes
1301212446 ;;
1301312447
1301412448 hpux9*)
13015 hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir'
12449 hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
1301612450 hardcode_libdir_separator_CXX=:
13017 export_dynamic_flag_spec_CXX='$wl-E'
12451 export_dynamic_flag_spec_CXX='${wl}-E'
1301812452 hardcode_direct_CXX=yes
1301912453 hardcode_minus_L_CXX=yes # Not in the search PATH,
1302012454 # but as the default
1302612460 ld_shlibs_CXX=no
1302712461 ;;
1302812462 aCC*)
13029 archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
12463 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'
1303012464 # Commands to make compiler produce verbose output that lists
1303112465 # what "hidden" libraries, object files and flags are used when
1303212466 # linking a shared library.
1303512469 # explicitly linking system object files so we need to strip them
1303612470 # from the output so that they don't get included in the library
1303712471 # dependencies.
13038 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"'
12472 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"'
1303912473 ;;
1304012474 *)
13041 if test yes = "$GXX"; then
13042 archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
12475 if test "$GXX" = yes; then
12476 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'
1304312477 else
1304412478 # FIXME: insert proper C++ library support
1304512479 ld_shlibs_CXX=no
1304912483 ;;
1305012484
1305112485 hpux10*|hpux11*)
13052 if test no = "$with_gnu_ld"; then
13053 hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir'
12486 if test $with_gnu_ld = no; then
12487 hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
1305412488 hardcode_libdir_separator_CXX=:
1305512489
1305612490 case $host_cpu in
1305712491 hppa*64*|ia64*)
1305812492 ;;
1305912493 *)
13060 export_dynamic_flag_spec_CXX='$wl-E'
12494 export_dynamic_flag_spec_CXX='${wl}-E'
1306112495 ;;
1306212496 esac
1306312497 fi
1308312517 aCC*)
1308412518 case $host_cpu in
1308512519 hppa*64*)
13086 archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
12520 archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1308712521 ;;
1308812522 ia64*)
13089 archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
12523 archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1309012524 ;;
1309112525 *)
13092 archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
12526 archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1309312527 ;;
1309412528 esac
1309512529 # Commands to make compiler produce verbose output that lists
1310012534 # explicitly linking system object files so we need to strip them
1310112535 # from the output so that they don't get included in the library
1310212536 # dependencies.
13103 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"'
12537 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"'
1310412538 ;;
1310512539 *)
13106 if test yes = "$GXX"; then
13107 if test no = "$with_gnu_ld"; then
12540 if test "$GXX" = yes; then
12541 if test $with_gnu_ld = no; then
1310812542 case $host_cpu in
1310912543 hppa*64*)
13110 archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
12544 archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1311112545 ;;
1311212546 ia64*)
13113 archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
12547 archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1311412548 ;;
1311512549 *)
13116 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'
12550 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'
1311712551 ;;
1311812552 esac
1311912553 fi
1312812562 interix[3-9]*)
1312912563 hardcode_direct_CXX=no
1313012564 hardcode_shlibpath_var_CXX=no
13131 hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
13132 export_dynamic_flag_spec_CXX='$wl-E'
12565 hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
12566 export_dynamic_flag_spec_CXX='${wl}-E'
1313312567 # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
1313412568 # Instead, shared libraries are loaded at an image base (0x10000000 by
1313512569 # default) and relocated if they conflict, which is a slow very memory
1313612570 # consuming and fragmenting process. To avoid this, we pick a random,
1313712571 # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
1313812572 # time. Moving up from 0x10000000 also allows more sbrk(2) space.
13139 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'
13140 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'
12573 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'
12574 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'
1314112575 ;;
1314212576 irix5* | irix6*)
1314312577 case $cc_basename in
1314412578 CC*)
1314512579 # SGI C++
13146 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'
12580 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'
1314712581
1314812582 # Archives containing C++ object files must be created using
1314912583 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
1315212586 old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
1315312587 ;;
1315412588 *)
13155 if test yes = "$GXX"; then
13156 if test no = "$with_gnu_ld"; then
13157 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'
12589 if test "$GXX" = yes; then
12590 if test "$with_gnu_ld" = no; then
12591 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'
1315812592 else
13159 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'
12593 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'
1316012594 fi
1316112595 fi
1316212596 link_all_deplibs_CXX=yes
1316312597 ;;
1316412598 esac
13165 hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
12599 hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
1316612600 hardcode_libdir_separator_CXX=:
1316712601 inherit_rpath_CXX=yes
1316812602 ;;
1317512609 # KCC will only create a shared library if the output file
1317612610 # ends with ".so" (or ".sl" for HP-UX), so rename the library
1317712611 # to its proper name (with version) after linking.
13178 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'
13179 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'
12612 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'
12613 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'
1318012614 # Commands to make compiler produce verbose output that lists
1318112615 # what "hidden" libraries, object files and flags are used when
1318212616 # linking a shared library.
1318512619 # explicitly linking system object files so we need to strip them
1318612620 # from the output so that they don't get included in the library
1318712621 # dependencies.
13188 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"'
13189
13190 hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
13191 export_dynamic_flag_spec_CXX='$wl--export-dynamic'
12622 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"'
12623
12624 hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
12625 export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
1319212626
1319312627 # Archives containing C++ object files must be created using
1319412628 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
1320212636 # earlier do not add the objects themselves.
1320312637 case `$CC -V 2>&1` in
1320412638 *"Version 7."*)
13205 archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
13206 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'
12639 archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
12640 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'
1320712641 ;;
1320812642 *) # Version 8.0 or newer
1320912643 tmp_idyn=
1321012644 case $host_cpu in
1321112645 ia64*) tmp_idyn=' -i_dynamic';;
1321212646 esac
13213 archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
13214 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'
12647 archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
12648 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'
1321512649 ;;
1321612650 esac
1321712651 archive_cmds_need_lc_CXX=no
13218 hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
13219 export_dynamic_flag_spec_CXX='$wl--export-dynamic'
13220 whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive'
12652 hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
12653 export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
12654 whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
1322112655 ;;
1322212656 pgCC* | pgcpp*)
1322312657 # Portland Group C++ compiler
1322412658 case `$CC -V` in
1322512659 *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
1322612660 prelink_cmds_CXX='tpldir=Template.dir~
13227 rm -rf $tpldir~
13228 $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
13229 compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
12661 rm -rf $tpldir~
12662 $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
12663 compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
1323012664 old_archive_cmds_CXX='tpldir=Template.dir~
13231 rm -rf $tpldir~
13232 $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
13233 $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
13234 $RANLIB $oldlib'
12665 rm -rf $tpldir~
12666 $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
12667 $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
12668 $RANLIB $oldlib'
1323512669 archive_cmds_CXX='tpldir=Template.dir~
13236 rm -rf $tpldir~
13237 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
13238 $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
12670 rm -rf $tpldir~
12671 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
12672 $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
1323912673 archive_expsym_cmds_CXX='tpldir=Template.dir~
13240 rm -rf $tpldir~
13241 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
13242 $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'
12674 rm -rf $tpldir~
12675 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
12676 $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'
1324312677 ;;
1324412678 *) # Version 6 and above use weak symbols
13245 archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
13246 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'
12679 archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
12680 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'
1324712681 ;;
1324812682 esac
1324912683
13250 hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir'
13251 export_dynamic_flag_spec_CXX='$wl--export-dynamic'
13252 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'
12684 hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
12685 export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
12686 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'
1325312687 ;;
1325412688 cxx*)
1325512689 # Compaq C++
13256 archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
13257 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'
12690 archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
12691 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'
1325812692
1325912693 runpath_var=LD_RUN_PATH
1326012694 hardcode_libdir_flag_spec_CXX='-rpath $libdir'
1326812702 # explicitly linking system object files so we need to strip them
1326912703 # from the output so that they don't get included in the library
1327012704 # dependencies.
13271 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'
12705 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'
1327212706 ;;
1327312707 xl* | mpixl* | bgxl*)
1327412708 # IBM XL 8.0 on PPC, with GNU ld
13275 hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
13276 export_dynamic_flag_spec_CXX='$wl--export-dynamic'
13277 archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
13278 if test yes = "$supports_anon_versioning"; then
12709 hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
12710 export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
12711 archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
12712 if test "x$supports_anon_versioning" = xyes; then
1327912713 archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
13280 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
13281 echo "local: *; };" >> $output_objdir/$libname.ver~
13282 $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
12714 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
12715 echo "local: *; };" >> $output_objdir/$libname.ver~
12716 $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
1328312717 fi
1328412718 ;;
1328512719 *)
1328712721 *Sun\ C*)
1328812722 # Sun C++ 5.9
1328912723 no_undefined_flag_CXX=' -zdefs'
13290 archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
13291 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'
12724 archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
12725 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'
1329212726 hardcode_libdir_flag_spec_CXX='-R$libdir'
13293 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'
12727 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'
1329412728 compiler_needs_object_CXX=yes
1329512729
1329612730 # Not sure whether something based on
1334812782 ld_shlibs_CXX=yes
1334912783 ;;
1335012784
13351 openbsd* | bitrig*)
12785 openbsd2*)
12786 # C++ shared libraries are fairly broken
12787 ld_shlibs_CXX=no
12788 ;;
12789
12790 openbsd*)
1335212791 if test -f /usr/libexec/ld.so; then
1335312792 hardcode_direct_CXX=yes
1335412793 hardcode_shlibpath_var_CXX=no
1335512794 hardcode_direct_absolute_CXX=yes
1335612795 archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
13357 hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
13358 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
13359 archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib'
13360 export_dynamic_flag_spec_CXX='$wl-E'
13361 whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
12796 hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
12797 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
12798 archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
12799 export_dynamic_flag_spec_CXX='${wl}-E'
12800 whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
1336212801 fi
1336312802 output_verbose_link_cmd=func_echo_all
1336412803 else
1337412813 # KCC will only create a shared library if the output file
1337512814 # ends with ".so" (or ".sl" for HP-UX), so rename the library
1337612815 # to its proper name (with version) after linking.
13377 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'
13378
13379 hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir'
12816 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'
12817
12818 hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
1338012819 hardcode_libdir_separator_CXX=:
1338112820
1338212821 # Archives containing C++ object files must be created using
1339412833 cxx*)
1339512834 case $host in
1339612835 osf3*)
13397 allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*'
13398 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'
13399 hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
12836 allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
12837 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'
12838 hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
1340012839 ;;
1340112840 *)
1340212841 allow_undefined_flag_CXX=' -expect_unresolved \*'
13403 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'
12842 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'
1340412843 archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
13405 echo "-hidden">> $lib.exp~
13406 $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~
13407 $RM $lib.exp'
12844 echo "-hidden">> $lib.exp~
12845 $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~
12846 $RM $lib.exp'
1340812847 hardcode_libdir_flag_spec_CXX='-rpath $libdir'
1340912848 ;;
1341012849 esac
1341912858 # explicitly linking system object files so we need to strip them
1342012859 # from the output so that they don't get included in the library
1342112860 # dependencies.
13422 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"'
12861 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"'
1342312862 ;;
1342412863 *)
13425 if test yes,no = "$GXX,$with_gnu_ld"; then
13426 allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*'
12864 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
12865 allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
1342712866 case $host in
1342812867 osf3*)
13429 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'
12868 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'
1343012869 ;;
1343112870 *)
13432 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'
12871 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'
1343312872 ;;
1343412873 esac
1343512874
13436 hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir'
12875 hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
1343712876 hardcode_libdir_separator_CXX=:
1343812877
1343912878 # Commands to make compiler produce verbose output that lists
1347912918 # Sun C++ 4.2, 5.x and Centerline C++
1348012919 archive_cmds_need_lc_CXX=yes
1348112920 no_undefined_flag_CXX=' -zdefs'
13482 archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
12921 archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
1348312922 archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
13484 $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'
12923 $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'
1348512924
1348612925 hardcode_libdir_flag_spec_CXX='-R$libdir'
1348712926 hardcode_shlibpath_var_CXX=no
1348912928 solaris2.[0-5] | solaris2.[0-5].*) ;;
1349012929 *)
1349112930 # The compiler driver will combine and reorder linker options,
13492 # but understands '-z linker_flag'.
12931 # but understands `-z linker_flag'.
1349312932 # Supported since Solaris 2.6 (maybe 2.5.1?)
1349412933 whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
1349512934 ;;
1350612945 ;;
1350712946 gcx*)
1350812947 # Green Hills C++ Compiler
13509 archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
12948 archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
1351012949
1351112950 # The C++ compiler must be used to create the archive.
1351212951 old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
1351312952 ;;
1351412953 *)
1351512954 # GNU C++ compiler with Solaris linker
13516 if test yes,no = "$GXX,$with_gnu_ld"; then
13517 no_undefined_flag_CXX=' $wl-z ${wl}defs'
12955 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
12956 no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
1351812957 if $CC --version | $GREP -v '^2\.7' > /dev/null; then
13519 archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
12958 archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
1352012959 archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
13521 $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
12960 $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
1352212961
1352312962 # Commands to make compiler produce verbose output that lists
1352412963 # what "hidden" libraries, object files and flags are used when
1352512964 # linking a shared library.
1352612965 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
1352712966 else
13528 # g++ 2.7 appears to require '-G' NOT '-shared' on this
12967 # g++ 2.7 appears to require `-G' NOT `-shared' on this
1352912968 # platform.
13530 archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
12969 archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
1353112970 archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
13532 $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
12971 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
1353312972
1353412973 # Commands to make compiler produce verbose output that lists
1353512974 # what "hidden" libraries, object files and flags are used when
1353712976 output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
1353812977 fi
1353912978
13540 hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir'
12979 hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
1354112980 case $host_os in
1354212981 solaris2.[0-5] | solaris2.[0-5].*) ;;
1354312982 *)
13544 whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
12983 whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
1354512984 ;;
1354612985 esac
1354712986 fi
1355012989 ;;
1355112990
1355212991 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
13553 no_undefined_flag_CXX='$wl-z,text'
12992 no_undefined_flag_CXX='${wl}-z,text'
1355412993 archive_cmds_need_lc_CXX=no
1355512994 hardcode_shlibpath_var_CXX=no
1355612995 runpath_var='LD_RUN_PATH'
1355712996
1355812997 case $cc_basename in
1355912998 CC*)
13560 archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13561 archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
12999 archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13000 archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
1356213001 ;;
1356313002 *)
13564 archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13565 archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13003 archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13004 archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
1356613005 ;;
1356713006 esac
1356813007 ;;
1356913008
1357013009 sysv5* | sco3.2v5* | sco5v6*)
13571 # Note: We CANNOT use -z defs as we might desire, because we do not
13010 # Note: We can NOT use -z defs as we might desire, because we do not
1357213011 # link with -lc, and that would cause any symbols used from libc to
1357313012 # always be unresolved, which means just about no library would
1357413013 # ever link correctly. If we're not using GNU ld we use -z text
1357513014 # though, which does catch some bad symbols but isn't as heavy-handed
1357613015 # as -z defs.
13577 no_undefined_flag_CXX='$wl-z,text'
13578 allow_undefined_flag_CXX='$wl-z,nodefs'
13016 no_undefined_flag_CXX='${wl}-z,text'
13017 allow_undefined_flag_CXX='${wl}-z,nodefs'
1357913018 archive_cmds_need_lc_CXX=no
1358013019 hardcode_shlibpath_var_CXX=no
13581 hardcode_libdir_flag_spec_CXX='$wl-R,$libdir'
13020 hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
1358213021 hardcode_libdir_separator_CXX=':'
1358313022 link_all_deplibs_CXX=yes
13584 export_dynamic_flag_spec_CXX='$wl-Bexport'
13023 export_dynamic_flag_spec_CXX='${wl}-Bexport'
1358513024 runpath_var='LD_RUN_PATH'
1358613025
1358713026 case $cc_basename in
1358813027 CC*)
13589 archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13590 archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13028 archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13029 archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
1359113030 old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
13592 '"$old_archive_cmds_CXX"
13031 '"$old_archive_cmds_CXX"
1359313032 reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
13594 '"$reload_cmds_CXX"
13033 '"$reload_cmds_CXX"
1359513034 ;;
1359613035 *)
13597 archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13598 archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13036 archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
13037 archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
1359913038 ;;
1360013039 esac
1360113040 ;;
1362713066
1362813067 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
1362913068 $as_echo "$ld_shlibs_CXX" >&6; }
13630 test no = "$ld_shlibs_CXX" && can_build_shared=no
13631
13632 GCC_CXX=$GXX
13633 LD_CXX=$LD
13069 test "$ld_shlibs_CXX" = no && can_build_shared=no
13070
13071 GCC_CXX="$GXX"
13072 LD_CXX="$LD"
1363413073
1363513074 ## CAVEAT EMPTOR:
1363613075 ## There is no encapsulation within the following macros, do not change
1367413113 pre_test_object_deps_done=no
1367513114
1367613115 for p in `eval "$output_verbose_link_cmd"`; do
13677 case $prev$p in
13116 case ${prev}${p} in
1367813117
1367913118 -L* | -R* | -l*)
1368013119 # Some compilers place space between "-{L,R}" and the path.
1368113120 # Remove the space.
13682 if test x-L = "$p" ||
13683 test x-R = "$p"; then
13121 if test $p = "-L" ||
13122 test $p = "-R"; then
1368413123 prev=$p
1368513124 continue
1368613125 fi
1369613135 case $p in
1369713136 =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
1369813137 esac
13699 if test no = "$pre_test_object_deps_done"; then
13700 case $prev in
13138 if test "$pre_test_object_deps_done" = no; then
13139 case ${prev} in
1370113140 -L | -R)
1370213141 # Internal compiler library paths should come after those
1370313142 # provided the user. The postdeps already come after the
1370413143 # user supplied libs so there is no need to process them.
1370513144 if test -z "$compiler_lib_search_path_CXX"; then
13706 compiler_lib_search_path_CXX=$prev$p
13145 compiler_lib_search_path_CXX="${prev}${p}"
1370713146 else
13708 compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p"
13147 compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
1370913148 fi
1371013149 ;;
1371113150 # The "-l" case would never come before the object being
1371313152 esac
1371413153 else
1371513154 if test -z "$postdeps_CXX"; then
13716 postdeps_CXX=$prev$p
13155 postdeps_CXX="${prev}${p}"
1371713156 else
13718 postdeps_CXX="${postdeps_CXX} $prev$p"
13157 postdeps_CXX="${postdeps_CXX} ${prev}${p}"
1371913158 fi
1372013159 fi
1372113160 prev=
1373013169 continue
1373113170 fi
1373213171
13733 if test no = "$pre_test_object_deps_done"; then
13172 if test "$pre_test_object_deps_done" = no; then
1373413173 if test -z "$predep_objects_CXX"; then
13735 predep_objects_CXX=$p
13174 predep_objects_CXX="$p"
1373613175 else
1373713176 predep_objects_CXX="$predep_objects_CXX $p"
1373813177 fi
1373913178 else
1374013179 if test -z "$postdep_objects_CXX"; then
13741 postdep_objects_CXX=$p
13180 postdep_objects_CXX="$p"
1374213181 else
1374313182 postdep_objects_CXX="$postdep_objects_CXX $p"
1374413183 fi
1376813207 postdep_objects_CXX=
1376913208 postdeps_CXX=
1377013209 ;;
13210
13211 linux*)
13212 case `$CC -V 2>&1 | sed 5q` in
13213 *Sun\ C*)
13214 # Sun C++ 5.9
13215
13216 # The more standards-conforming stlport4 library is
13217 # incompatible with the Cstd library. Avoid specifying
13218 # it if it's in CXXFLAGS. Ignore libCrun as
13219 # -library=stlport4 depends on it.
13220 case " $CXX $CXXFLAGS " in
13221 *" -library=stlport4 "*)
13222 solaris_use_stlport4=yes
13223 ;;
13224 esac
13225
13226 if test "$solaris_use_stlport4" != yes; then
13227 postdeps_CXX='-library=Cstd -library=Crun'
13228 fi
13229 ;;
13230 esac
13231 ;;
13232
13233 solaris*)
13234 case $cc_basename in
13235 CC* | sunCC*)
13236 # The more standards-conforming stlport4 library is
13237 # incompatible with the Cstd library. Avoid specifying
13238 # it if it's in CXXFLAGS. Ignore libCrun as
13239 # -library=stlport4 depends on it.
13240 case " $CXX $CXXFLAGS " in
13241 *" -library=stlport4 "*)
13242 solaris_use_stlport4=yes
13243 ;;
13244 esac
13245
13246 # Adding this requires a known-good setup of shared libraries for
13247 # Sun compiler versions before 5.6, else PIC objects from an old
13248 # archive will be linked into the output, leading to subtle bugs.
13249 if test "$solaris_use_stlport4" != yes; then
13250 postdeps_CXX='-library=Cstd -library=Crun'
13251 fi
13252 ;;
13253 esac
13254 ;;
1377113255 esac
1377213256
1377313257
1377613260 esac
1377713261 compiler_lib_search_dirs_CXX=
1377813262 if test -n "${compiler_lib_search_path_CXX}"; then
13779 compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'`
13263 compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
1378013264 fi
1378113265
1378213266
1381513299
1381613300
1381713301 # C++ specific cases for pic, static, wl, etc.
13818 if test yes = "$GXX"; then
13302 if test "$GXX" = yes; then
1381913303 lt_prog_compiler_wl_CXX='-Wl,'
1382013304 lt_prog_compiler_static_CXX='-static'
1382113305
1382213306 case $host_os in
1382313307 aix*)
1382413308 # All AIX code is PIC.
13825 if test ia64 = "$host_cpu"; then
13309 if test "$host_cpu" = ia64; then
1382613310 # AIX 5 now supports IA64 processor
1382713311 lt_prog_compiler_static_CXX='-Bstatic'
1382813312 fi
13829 lt_prog_compiler_pic_CXX='-fPIC'
1383013313 ;;
1383113314
1383213315 amigaos*)
1383713320 ;;
1383813321 m68k)
1383913322 # FIXME: we need at least 68020 code to build shared libraries, but
13840 # adding the '-m68020' flag to GCC prevents building anything better,
13841 # like '-m68040'.
13323 # adding the `-m68020' flag to GCC prevents building anything better,
13324 # like `-m68040'.
1384213325 lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
1384313326 ;;
1384413327 esac
1385313336 # Although the cygwin gcc ignores -fPIC, still need this for old-style
1385413337 # (--disable-auto-import) libraries
1385513338 lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
13856 case $host_os in
13857 os2*)
13858 lt_prog_compiler_static_CXX='$wl-static'
13859 ;;
13860 esac
1386113339 ;;
1386213340 darwin* | rhapsody*)
1386313341 # PIC is the default on this platform
1390713385 case $host_os in
1390813386 aix[4-9]*)
1390913387 # All AIX code is PIC.
13910 if test ia64 = "$host_cpu"; then
13388 if test "$host_cpu" = ia64; then
1391113389 # AIX 5 now supports IA64 processor
1391213390 lt_prog_compiler_static_CXX='-Bstatic'
1391313391 else
1394713425 case $cc_basename in
1394813426 CC*)
1394913427 lt_prog_compiler_wl_CXX='-Wl,'
13950 lt_prog_compiler_static_CXX='$wl-a ${wl}archive'
13951 if test ia64 != "$host_cpu"; then
13428 lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
13429 if test "$host_cpu" != ia64; then
1395213430 lt_prog_compiler_pic_CXX='+Z'
1395313431 fi
1395413432 ;;
1395513433 aCC*)
1395613434 lt_prog_compiler_wl_CXX='-Wl,'
13957 lt_prog_compiler_static_CXX='$wl-a ${wl}archive'
13435 lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
1395813436 case $host_cpu in
1395913437 hppa*64*|ia64*)
1396013438 # +Z the default
1399113469 lt_prog_compiler_pic_CXX='-fPIC'
1399213470 ;;
1399313471 ecpc* )
13994 # old Intel C++ for x86_64, which still supported -KPIC.
13472 # old Intel C++ for x86_64 which still supported -KPIC.
1399513473 lt_prog_compiler_wl_CXX='-Wl,'
1399613474 lt_prog_compiler_pic_CXX='-KPIC'
1399713475 lt_prog_compiler_static_CXX='-static'
1413613614 fi
1413713615
1413813616 case $host_os in
14139 # For platforms that do not support PIC, -DPIC is meaningless:
13617 # For platforms which do not support PIC, -DPIC is meaningless:
1414013618 *djgpp*)
1414113619 lt_prog_compiler_pic_CXX=
1414213620 ;;
1416813646 lt_cv_prog_compiler_pic_works_CXX=no
1416913647 ac_outfile=conftest.$ac_objext
1417013648 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
14171 lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment
13649 lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
1417213650 # Insert the option either (1) after the last *FLAGS variable, or
1417313651 # (2) before a word containing "conftest.", or (3) at the end.
1417413652 # Note that $ac_compile itself does not contain backslashes and begins
1419813676 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
1419913677 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
1420013678
14201 if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then
13679 if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
1420213680 case $lt_prog_compiler_pic_CXX in
1420313681 "" | " "*) ;;
1420413682 *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
1422413702 $as_echo_n "(cached) " >&6
1422513703 else
1422613704 lt_cv_prog_compiler_static_works_CXX=no
14227 save_LDFLAGS=$LDFLAGS
13705 save_LDFLAGS="$LDFLAGS"
1422813706 LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
1422913707 echo "$lt_simple_link_test_code" > conftest.$ac_ext
1423013708 if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
1424313721 fi
1424413722 fi
1424513723 $RM -r conftest*
14246 LDFLAGS=$save_LDFLAGS
13724 LDFLAGS="$save_LDFLAGS"
1424713725
1424813726 fi
1424913727 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
1425013728 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
1425113729
14252 if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then
13730 if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
1425313731 :
1425413732 else
1425513733 lt_prog_compiler_static_CXX=
1436313841
1436413842
1436513843
14366 hard_links=nottested
14367 if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then
13844 hard_links="nottested"
13845 if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
1436813846 # do not overwrite the value of need_locks provided by the user
1436913847 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
1437013848 $as_echo_n "checking if we can lock with hard links... " >&6; }
1437613854 ln conftest.a conftest.b 2>/dev/null && hard_links=no
1437713855 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
1437813856 $as_echo "$hard_links" >&6; }
14379 if test no = "$hard_links"; then
14380 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5
14381 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;}
13857 if test "$hard_links" = no; then
13858 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
13859 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
1438213860 need_locks=warn
1438313861 fi
1438413862 else
1439513873 case $host_os in
1439613874 aix[4-9]*)
1439713875 # If we're using GNU nm, then we don't want the "-C" option.
14398 # -C means demangle to GNU nm, but means don't demangle to AIX nm.
14399 # Without the "-l" option, or with the "-B" option, AIX nm treats
14400 # weak defined symbols like other global defined symbols, whereas
14401 # GNU nm marks them as "W".
14402 # While the 'weak' keyword is ignored in the Export File, we need
14403 # it in the Import File for the 'aix-soname' feature, so we have
14404 # to replace the "-B" option with "-P" for AIX nm.
13876 # -C means demangle to AIX nm, but means don't demangle with GNU nm
13877 # Also, AIX nm treats weak defined symbols like other global defined
13878 # symbols, whereas GNU nm marks them as "W".
1440513879 if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
14406 export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
13880 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'
1440713881 else
14408 export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
13882 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'
1440913883 fi
1441013884 ;;
1441113885 pw32*)
14412 export_symbols_cmds_CXX=$ltdll_cmds
13886 export_symbols_cmds_CXX="$ltdll_cmds"
1441313887 ;;
1441413888 cygwin* | mingw* | cegcc*)
1441513889 case $cc_basename in
1443213906
1443313907 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
1443413908 $as_echo "$ld_shlibs_CXX" >&6; }
14435 test no = "$ld_shlibs_CXX" && can_build_shared=no
13909 test "$ld_shlibs_CXX" = no && can_build_shared=no
1443613910
1443713911 with_gnu_ld_CXX=$with_gnu_ld
1443813912
1444913923 # Assume -lc should be added
1445013924 archive_cmds_need_lc_CXX=yes
1445113925
14452 if test yes,yes = "$GCC,$enable_shared"; then
13926 if test "$enable_shared" = yes && test "$GCC" = yes; then
1445313927 case $archive_cmds_CXX in
1445413928 *'~'*)
1445513929 # FIXME: we may have to deal with multi-command sequences.
1457714051 library_names_spec=
1457814052 libname_spec='lib$name'
1457914053 soname_spec=
14580 shrext_cmds=.so
14054 shrext_cmds=".so"
1458114055 postinstall_cmds=
1458214056 postuninstall_cmds=
1458314057 finish_cmds=
1459414068 # flags to be left without arguments
1459514069 need_version=unknown
1459614070
14597
14598
1459914071 case $host_os in
1460014072 aix3*)
1460114073 version_type=linux # correct to gnu/linux during the next big refactor
14602 library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
14074 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
1460314075 shlibpath_var=LIBPATH
1460414076
1460514077 # AIX 3 has no versioning support, so we append a major version to the name.
14606 soname_spec='$libname$release$shared_ext$major'
14078 soname_spec='${libname}${release}${shared_ext}$major'
1460714079 ;;
1460814080
1460914081 aix[4-9]*)
1461114083 need_lib_prefix=no
1461214084 need_version=no
1461314085 hardcode_into_libs=yes
14614 if test ia64 = "$host_cpu"; then
14086 if test "$host_cpu" = ia64; then
1461514087 # AIX 5 supports IA64
14616 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
14088 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
1461714089 shlibpath_var=LD_LIBRARY_PATH
1461814090 else
1461914091 # With GCC up to 2.95.x, collect2 would create an import file
1462014092 # for dependence libraries. The import file would start with
14621 # the line '#! .'. This would cause the generated library to
14622 # depend on '.', always an invalid library. This was fixed in
14093 # the line `#! .'. This would cause the generated library to
14094 # depend on `.', always an invalid library. This was fixed in
1462314095 # development snapshots of GCC prior to 3.0.
1462414096 case $host_os in
1462514097 aix4 | aix4.[01] | aix4.[01].*)
1462614098 if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
1462714099 echo ' yes '
14628 echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
14100 echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
1462914101 :
1463014102 else
1463114103 can_build_shared=no
1463214104 fi
1463314105 ;;
1463414106 esac
14635 # Using Import Files as archive members, it is possible to support
14636 # filename-based versioning of shared library archives on AIX. While
14637 # this would work for both with and without runtime linking, it will
14638 # prevent static linking of such archives. So we do filename-based
14639 # shared library versioning with .so extension only, which is used
14640 # when both runtime linking and shared linking is enabled.
14641 # Unfortunately, runtime linking may impact performance, so we do
14642 # not want this to be the default eventually. Also, we use the
14643 # versioned .so libs for executables only if there is the -brtl
14644 # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
14645 # To allow for filename-based versioning support, we need to create
14646 # libNAME.so.V as an archive file, containing:
14647 # *) an Import File, referring to the versioned filename of the
14648 # archive as well as the shared archive member, telling the
14649 # bitwidth (32 or 64) of that shared object, and providing the
14650 # list of exported symbols of that shared object, eventually
14651 # decorated with the 'weak' keyword
14652 # *) the shared object with the F_LOADONLY flag set, to really avoid
14653 # it being seen by the linker.
14654 # At run time we better use the real file rather than another symlink,
14655 # but for link time we create the symlink libNAME.so -> libNAME.so.V
14656
14657 case $with_aix_soname,$aix_use_runtimelinking in
14658 # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
14107 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
1465914108 # soname into executable. Probably we can add versioning support to
1466014109 # collect2, so additional links can be useful in future.
14661 aix,yes) # traditional libtool
14662 dynamic_linker='AIX unversionable lib.so'
14110 if test "$aix_use_runtimelinking" = yes; then
1466314111 # If using run time linking (on AIX 4.2 or later) use lib<name>.so
1466414112 # instead of lib<name>.a to let people know that these are not
1466514113 # typical AIX shared libraries.
14666 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14667 ;;
14668 aix,no) # traditional AIX only
14669 dynamic_linker='AIX lib.a(lib.so.V)'
14114 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14115 else
1467014116 # We preserve .a as extension for shared libraries through AIX4.2
1467114117 # and later when we are not doing run time linking.
14672 library_names_spec='$libname$release.a $libname.a'
14673 soname_spec='$libname$release$shared_ext$major'
14674 ;;
14675 svr4,*) # full svr4 only
14676 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)"
14677 library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
14678 # We do not specify a path in Import Files, so LIBPATH fires.
14679 shlibpath_overrides_runpath=yes
14680 ;;
14681 *,yes) # both, prefer svr4
14682 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)"
14683 library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
14684 # unpreferred sharedlib libNAME.a needs extra handling
14685 postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
14686 postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
14687 # We do not specify a path in Import Files, so LIBPATH fires.
14688 shlibpath_overrides_runpath=yes
14689 ;;
14690 *,no) # both, prefer aix
14691 dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)"
14692 library_names_spec='$libname$release.a $libname.a'
14693 soname_spec='$libname$release$shared_ext$major'
14694 # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
14695 postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
14696 postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
14697 ;;
14698 esac
14118 library_names_spec='${libname}${release}.a $libname.a'
14119 soname_spec='${libname}${release}${shared_ext}$major'
14120 fi
1469914121 shlibpath_var=LIBPATH
1470014122 fi
1470114123 ;;
1470514127 powerpc)
1470614128 # Since July 2007 AmigaOS4 officially supports .so libraries.
1470714129 # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
14708 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14130 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
1470914131 ;;
1471014132 m68k)
1471114133 library_names_spec='$libname.ixlibrary $libname.a'
1471214134 # Create ${libname}_ixlibrary.a entries in /sys/libs.
14713 finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
14135 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'
1471414136 ;;
1471514137 esac
1471614138 ;;
1471714139
1471814140 beos*)
14719 library_names_spec='$libname$shared_ext'
14141 library_names_spec='${libname}${shared_ext}'
1472014142 dynamic_linker="$host_os ld.so"
1472114143 shlibpath_var=LIBRARY_PATH
1472214144 ;;
1472414146 bsdi[45]*)
1472514147 version_type=linux # correct to gnu/linux during the next big refactor
1472614148 need_version=no
14727 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14728 soname_spec='$libname$release$shared_ext$major'
14149 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14150 soname_spec='${libname}${release}${shared_ext}$major'
1472914151 finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
1473014152 shlibpath_var=LD_LIBRARY_PATH
1473114153 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
1473714159
1473814160 cygwin* | mingw* | pw32* | cegcc*)
1473914161 version_type=windows
14740 shrext_cmds=.dll
14162 shrext_cmds=".dll"
1474114163 need_version=no
1474214164 need_lib_prefix=no
1474314165
1474614168 # gcc
1474714169 library_names_spec='$libname.dll.a'
1474814170 # DLL is installed to $(libdir)/../bin by postinstall_cmds
14749 postinstall_cmds='base_file=`basename \$file`~
14750 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
14171 postinstall_cmds='base_file=`basename \${file}`~
14172 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
1475114173 dldir=$destdir/`dirname \$dlpath`~
1475214174 test -d \$dldir || mkdir -p \$dldir~
1475314175 $install_prog $dir/$dlname \$dldir/$dlname~
1476314185 case $host_os in
1476414186 cygwin*)
1476514187 # Cygwin DLLs use 'cyg' prefix rather than 'lib'
14766 soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
14188 soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
1476714189
1476814190 ;;
1476914191 mingw* | cegcc*)
1477014192 # MinGW DLLs use traditional 'lib' prefix
14771 soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
14193 soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
1477214194 ;;
1477314195 pw32*)
1477414196 # pw32 DLLs use 'pw' prefix rather than 'lib'
14775 library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
14197 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
1477614198 ;;
1477714199 esac
1477814200 dynamic_linker='Win32 ld.exe'
1478114203 *,cl*)
1478214204 # Native MSVC
1478314205 libname_spec='$name'
14784 soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
14785 library_names_spec='$libname.dll.lib'
14206 soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
14207 library_names_spec='${libname}.dll.lib'
1478614208
1478714209 case $build_os in
1478814210 mingw*)
1480914231 sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
1481014232 ;;
1481114233 *)
14812 sys_lib_search_path_spec=$LIB
14234 sys_lib_search_path_spec="$LIB"
1481314235 if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
1481414236 # It is most probably a Windows format PATH.
1481514237 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
1482214244 esac
1482314245
1482414246 # DLL is installed to $(libdir)/../bin by postinstall_cmds
14825 postinstall_cmds='base_file=`basename \$file`~
14826 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
14247 postinstall_cmds='base_file=`basename \${file}`~
14248 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
1482714249 dldir=$destdir/`dirname \$dlpath`~
1482814250 test -d \$dldir || mkdir -p \$dldir~
1482914251 $install_prog $dir/$dlname \$dldir/$dlname'
1483614258
1483714259 *)
1483814260 # Assume MSVC wrapper
14839 library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib'
14261 library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
1484014262 dynamic_linker='Win32 ld.exe'
1484114263 ;;
1484214264 esac
1484914271 version_type=darwin
1485014272 need_lib_prefix=no
1485114273 need_version=no
14852 library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
14853 soname_spec='$libname$release$major$shared_ext'
14274 library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
14275 soname_spec='${libname}${release}${major}$shared_ext'
1485414276 shlibpath_overrides_runpath=yes
1485514277 shlibpath_var=DYLD_LIBRARY_PATH
1485614278 shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
1486214284 version_type=linux # correct to gnu/linux during the next big refactor
1486314285 need_lib_prefix=no
1486414286 need_version=no
14865 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14866 soname_spec='$libname$release$shared_ext$major'
14287 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
14288 soname_spec='${libname}${release}${shared_ext}$major'
1486714289 shlibpath_var=LD_LIBRARY_PATH
1486814290 ;;
1486914291
1488114303 version_type=freebsd-$objformat
1488214304 case $version_type in
1488314305 freebsd-elf*)
14884 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14885 soname_spec='$libname$release$shared_ext$major'
14306 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
1488614307 need_version=no
1488714308 need_lib_prefix=no
1488814309 ;;
1488914310 freebsd-*)
14890 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
14311 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
1489114312 need_version=yes
1489214313 ;;
1489314314 esac
1491714338 need_lib_prefix=no
1491814339 need_version=no
1491914340 dynamic_linker="$host_os runtime_loader"
14920 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14921 soname_spec='$libname$release$shared_ext$major'
14341 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
14342 soname_spec='${libname}${release}${shared_ext}$major'
1492214343 shlibpath_var=LIBRARY_PATH
14923 shlibpath_overrides_runpath=no
14344 shlibpath_overrides_runpath=yes
1492414345 sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
1492514346 hardcode_into_libs=yes
1492614347 ;;
1493814359 dynamic_linker="$host_os dld.so"
1493914360 shlibpath_var=LD_LIBRARY_PATH
1494014361 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
14941 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14942 soname_spec='$libname$release$shared_ext$major'
14943 if test 32 = "$HPUX_IA64_MODE"; then
14362 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14363 soname_spec='${libname}${release}${shared_ext}$major'
14364 if test "X$HPUX_IA64_MODE" = X32; then
1494414365 sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
14945 sys_lib_dlsearch_path_spec=/usr/lib/hpux32
1494614366 else
1494714367 sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
14948 sys_lib_dlsearch_path_spec=/usr/lib/hpux64
1494914368 fi
14369 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
1495014370 ;;
1495114371 hppa*64*)
1495214372 shrext_cmds='.sl'
1495414374 dynamic_linker="$host_os dld.sl"
1495514375 shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
1495614376 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
14957 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14958 soname_spec='$libname$release$shared_ext$major'
14377 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14378 soname_spec='${libname}${release}${shared_ext}$major'
1495914379 sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
1496014380 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
1496114381 ;;
1496414384 dynamic_linker="$host_os dld.sl"
1496514385 shlibpath_var=SHLIB_PATH
1496614386 shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
14967 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14968 soname_spec='$libname$release$shared_ext$major'
14387 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14388 soname_spec='${libname}${release}${shared_ext}$major'
1496914389 ;;
1497014390 esac
1497114391 # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
1497814398 version_type=linux # correct to gnu/linux during the next big refactor
1497914399 need_lib_prefix=no
1498014400 need_version=no
14981 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14982 soname_spec='$libname$release$shared_ext$major'
14401 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
14402 soname_spec='${libname}${release}${shared_ext}$major'
1498314403 dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
1498414404 shlibpath_var=LD_LIBRARY_PATH
1498514405 shlibpath_overrides_runpath=no
1499014410 case $host_os in
1499114411 nonstopux*) version_type=nonstopux ;;
1499214412 *)
14993 if test yes = "$lt_cv_prog_gnu_ld"; then
14413 if test "$lt_cv_prog_gnu_ld" = yes; then
1499414414 version_type=linux # correct to gnu/linux during the next big refactor
1499514415 else
1499614416 version_type=irix
1499814418 esac
1499914419 need_lib_prefix=no
1500014420 need_version=no
15001 soname_spec='$libname$release$shared_ext$major'
15002 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
14421 soname_spec='${libname}${release}${shared_ext}$major'
14422 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
1500314423 case $host_os in
1500414424 irix5* | nonstopux*)
1500514425 libsuff= shlibsuff=
1501814438 esac
1501914439 shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
1502014440 shlibpath_overrides_runpath=no
15021 sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
15022 sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
14441 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
14442 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
1502314443 hardcode_into_libs=yes
1502414444 ;;
1502514445
1502614446 # No shared lib support for Linux oldld, aout, or coff.
1502714447 linux*oldld* | linux*aout* | linux*coff*)
1502814448 dynamic_linker=no
15029 ;;
15030
15031 linux*android*)
15032 version_type=none # Android doesn't support versioned libraries.
15033 need_lib_prefix=no
15034 need_version=no
15035 library_names_spec='$libname$release$shared_ext'
15036 soname_spec='$libname$release$shared_ext'
15037 finish_cmds=
15038 shlibpath_var=LD_LIBRARY_PATH
15039 shlibpath_overrides_runpath=yes
15040
15041 # This implies no fast_install, which is unacceptable.
15042 # Some rework will be needed to allow for fast_install
15043 # before this can be enabled.
15044 hardcode_into_libs=yes
15045
15046 dynamic_linker='Android linker'
15047 # Don't embed -rpath directories since the linker doesn't support them.
15048 hardcode_libdir_flag_spec_CXX='-L$libdir'
1504914449 ;;
1505014450
1505114451 # This must be glibc/ELF.
1505314453 version_type=linux # correct to gnu/linux during the next big refactor
1505414454 need_lib_prefix=no
1505514455 need_version=no
15056 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
15057 soname_spec='$libname$release$shared_ext$major'
14456 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14457 soname_spec='${libname}${release}${shared_ext}$major'
1505814458 finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
1505914459 shlibpath_var=LD_LIBRARY_PATH
1506014460 shlibpath_overrides_runpath=no
1509814498 # before this can be enabled.
1509914499 hardcode_into_libs=yes
1510014500
15101 # Ideally, we could use ldconfig to report *all* directores which are
15102 # searched for libraries, however this is still not possible. Aside from not
15103 # being certain /sbin/ldconfig is available, command
15104 # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
15105 # even though it is searched at run-time. Try to do the best guess by
15106 # appending ld.so.conf contents (and includes) to the search path.
14501 # Append ld.so.conf contents to the search path
1510714502 if test -f /etc/ld.so.conf; then
1510814503 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' ' '`
1510914504 sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
1513514530 need_lib_prefix=no
1513614531 need_version=no
1513714532 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
15138 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
14533 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
1513914534 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
1514014535 dynamic_linker='NetBSD (a.out) ld.so'
1514114536 else
15142 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
15143 soname_spec='$libname$release$shared_ext$major'
14537 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
14538 soname_spec='${libname}${release}${shared_ext}$major'
1514414539 dynamic_linker='NetBSD ld.elf_so'
1514514540 fi
1514614541 shlibpath_var=LD_LIBRARY_PATH
1515014545
1515114546 newsos6)
1515214547 version_type=linux # correct to gnu/linux during the next big refactor
15153 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14548 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
1515414549 shlibpath_var=LD_LIBRARY_PATH
1515514550 shlibpath_overrides_runpath=yes
1515614551 ;;
1515914554 version_type=qnx
1516014555 need_lib_prefix=no
1516114556 need_version=no
15162 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
15163 soname_spec='$libname$release$shared_ext$major'
14557 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14558 soname_spec='${libname}${release}${shared_ext}$major'
1516414559 shlibpath_var=LD_LIBRARY_PATH
1516514560 shlibpath_overrides_runpath=no
1516614561 hardcode_into_libs=yes
1516714562 dynamic_linker='ldqnx.so'
1516814563 ;;
1516914564
15170 openbsd* | bitrig*)
14565 openbsd*)
1517114566 version_type=sunos
15172 sys_lib_dlsearch_path_spec=/usr/lib
14567 sys_lib_dlsearch_path_spec="/usr/lib"
1517314568 need_lib_prefix=no
15174 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
15175 need_version=no
15176 else
15177 need_version=yes
15178 fi
15179 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
14569 # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
14570 case $host_os in
14571 openbsd3.3 | openbsd3.3.*) need_version=yes ;;
14572 *) need_version=no ;;
14573 esac
14574 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
1518014575 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
1518114576 shlibpath_var=LD_LIBRARY_PATH
15182 shlibpath_overrides_runpath=yes
14577 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
14578 case $host_os in
14579 openbsd2.[89] | openbsd2.[89].*)
14580 shlibpath_overrides_runpath=no
14581 ;;
14582 *)
14583 shlibpath_overrides_runpath=yes
14584 ;;
14585 esac
14586 else
14587 shlibpath_overrides_runpath=yes
14588 fi
1518314589 ;;
1518414590
1518514591 os2*)
1518614592 libname_spec='$name'
15187 version_type=windows
15188 shrext_cmds=.dll
15189 need_version=no
14593 shrext_cmds=".dll"
1519014594 need_lib_prefix=no
15191 # OS/2 can only load a DLL with a base name of 8 characters or less.
15192 soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
15193 v=$($ECHO $release$versuffix | tr -d .-);
15194 n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
15195 $ECHO $n$v`$shared_ext'
15196 library_names_spec='${libname}_dll.$libext'
14595 library_names_spec='$libname${shared_ext} $libname.a'
1519714596 dynamic_linker='OS/2 ld.exe'
15198 shlibpath_var=BEGINLIBPATH
15199 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
15200 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
15201 postinstall_cmds='base_file=`basename \$file`~
15202 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
15203 dldir=$destdir/`dirname \$dlpath`~
15204 test -d \$dldir || mkdir -p \$dldir~
15205 $install_prog $dir/$dlname \$dldir/$dlname~
15206 chmod a+x \$dldir/$dlname~
15207 if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
15208 eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
15209 fi'
15210 postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
15211 dlpath=$dir/\$dldll~
15212 $RM \$dlpath'
14597 shlibpath_var=LIBPATH
1521314598 ;;
1521414599
1521514600 osf3* | osf4* | osf5*)
1521614601 version_type=osf
1521714602 need_lib_prefix=no
1521814603 need_version=no
15219 soname_spec='$libname$release$shared_ext$major'
15220 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14604 soname_spec='${libname}${release}${shared_ext}$major'
14605 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
1522114606 shlibpath_var=LD_LIBRARY_PATH
1522214607 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
15223 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
14608 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
1522414609 ;;
1522514610
1522614611 rdos*)
1523114616 version_type=linux # correct to gnu/linux during the next big refactor
1523214617 need_lib_prefix=no
1523314618 need_version=no
15234 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
15235 soname_spec='$libname$release$shared_ext$major'
14619 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14620 soname_spec='${libname}${release}${shared_ext}$major'
1523614621 shlibpath_var=LD_LIBRARY_PATH
1523714622 shlibpath_overrides_runpath=yes
1523814623 hardcode_into_libs=yes
1524214627
1524314628 sunos4*)
1524414629 version_type=sunos
15245 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
14630 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
1524614631 finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
1524714632 shlibpath_var=LD_LIBRARY_PATH
1524814633 shlibpath_overrides_runpath=yes
15249 if test yes = "$with_gnu_ld"; then
14634 if test "$with_gnu_ld" = yes; then
1525014635 need_lib_prefix=no
1525114636 fi
1525214637 need_version=yes
1525414639
1525514640 sysv4 | sysv4.3*)
1525614641 version_type=linux # correct to gnu/linux during the next big refactor
15257 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
15258 soname_spec='$libname$release$shared_ext$major'
14642 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14643 soname_spec='${libname}${release}${shared_ext}$major'
1525914644 shlibpath_var=LD_LIBRARY_PATH
1526014645 case $host_vendor in
1526114646 sni)
1527614661 ;;
1527714662
1527814663 sysv4*MP*)
15279 if test -d /usr/nec; then
14664 if test -d /usr/nec ;then
1528014665 version_type=linux # correct to gnu/linux during the next big refactor
15281 library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
15282 soname_spec='$libname$shared_ext.$major'
14666 library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
14667 soname_spec='$libname${shared_ext}.$major'
1528314668 shlibpath_var=LD_LIBRARY_PATH
1528414669 fi
1528514670 ;;
1528614671
1528714672 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
15288 version_type=sco
14673 version_type=freebsd-elf
1528914674 need_lib_prefix=no
1529014675 need_version=no
15291 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
15292 soname_spec='$libname$release$shared_ext$major'
14676 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
14677 soname_spec='${libname}${release}${shared_ext}$major'
1529314678 shlibpath_var=LD_LIBRARY_PATH
1529414679 shlibpath_overrides_runpath=yes
1529514680 hardcode_into_libs=yes
15296 if test yes = "$with_gnu_ld"; then
14681 if test "$with_gnu_ld" = yes; then
1529714682 sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
1529814683 else
1529914684 sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
1531114696 version_type=linux # correct to gnu/linux during the next big refactor
1531214697 need_lib_prefix=no
1531314698 need_version=no
15314 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
14699 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
1531514700 shlibpath_var=LD_LIBRARY_PATH
1531614701 shlibpath_overrides_runpath=no
1531714702 hardcode_into_libs=yes
1531914704
1532014705 uts4*)
1532114706 version_type=linux # correct to gnu/linux during the next big refactor
15322 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
15323 soname_spec='$libname$release$shared_ext$major'
14707 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
14708 soname_spec='${libname}${release}${shared_ext}$major'
1532414709 shlibpath_var=LD_LIBRARY_PATH
1532514710 ;;
1532614711
1533014715 esac
1533114716 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
1533214717 $as_echo "$dynamic_linker" >&6; }
15333 test no = "$dynamic_linker" && can_build_shared=no
14718 test "$dynamic_linker" = no && can_build_shared=no
1533414719
1533514720 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
15336 if test yes = "$GCC"; then
14721 if test "$GCC" = yes; then
1533714722 variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
1533814723 fi
1533914724
15340 if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
15341 sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
15342 fi
15343
15344 if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
15345 sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
15346 fi
15347
15348 # remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
15349 configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
15350
15351 # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
15352 func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
15353
15354 # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
15355 configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
15356
15357
14725 if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
14726 sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
14727 fi
14728 if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
14729 sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
14730 fi
1535814731
1535914732
1536014733
1539814771 hardcode_action_CXX=
1539914772 if test -n "$hardcode_libdir_flag_spec_CXX" ||
1540014773 test -n "$runpath_var_CXX" ||
15401 test yes = "$hardcode_automatic_CXX"; then
14774 test "X$hardcode_automatic_CXX" = "Xyes" ; then
1540214775
1540314776 # We can hardcode non-existent directories.
15404 if test no != "$hardcode_direct_CXX" &&
14777 if test "$hardcode_direct_CXX" != no &&
1540514778 # If the only mechanism to avoid hardcoding is shlibpath_var, we
1540614779 # have to relink, otherwise we might link with an installed library
1540714780 # when we should be linking with a yet-to-be-installed one
15408 ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" &&
15409 test no != "$hardcode_minus_L_CXX"; then
14781 ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
14782 test "$hardcode_minus_L_CXX" != no; then
1541014783 # Linking always hardcodes the temporary library directory.
1541114784 hardcode_action_CXX=relink
1541214785 else
1542114794 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
1542214795 $as_echo "$hardcode_action_CXX" >&6; }
1542314796
15424 if test relink = "$hardcode_action_CXX" ||
15425 test yes = "$inherit_rpath_CXX"; then
14797 if test "$hardcode_action_CXX" = relink ||
14798 test "$inherit_rpath_CXX" = yes; then
1542614799 # Fast installation is not supported
1542714800 enable_fast_install=no
15428 elif test yes = "$shlibpath_overrides_runpath" ||
15429 test no = "$enable_shared"; then
14801 elif test "$shlibpath_overrides_runpath" = yes ||
14802 test "$enable_shared" = no; then
1543014803 # Fast installation is not necessary
1543114804 enable_fast_install=needless
1543214805 fi
1544914822 lt_cv_path_LD=$lt_save_path_LD
1545014823 lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
1545114824 lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
15452 fi # test yes != "$_lt_caught_CXX_error"
14825 fi # test "$_lt_caught_CXX_error" != yes
1545314826
1545414827 ac_ext=c
1545514828 ac_cpp='$CPP $CPPFLAGS'
1628215655
1628315656
1628415657
15658 # Check whether --enable-examples was given.
15659 if test "${enable_examples+set}" = set; then :
15660 enableval=$enable_examples; enable_examples=no
15661 else
15662 enable_examples=yes
15663 fi
15664
15665 if test "x$enable_examples" = "xyes"; then
15666 WITH_EXAMPLES_TRUE=
15667 WITH_EXAMPLES_FALSE='#'
15668 else
15669 WITH_EXAMPLES_TRUE='#'
15670 WITH_EXAMPLES_FALSE=
15671 fi
15672
15673
15674
1628515675 if expr $host : '.*-mingw' >/dev/null 2>&1; then
1628615676 MINGW_TRUE=
1628715677 MINGW_FALSE='#'
1629115681 fi
1629215682
1629315683
16294 am__api_version='1.15'
15684 am__api_version='1.14'
1629515685
1629615686 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
1629715687 $as_echo_n "checking whether build environment is sane... " >&6; }
1638715777 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
1638815778 fi
1638915779
16390 if test x"${install_sh+set}" != xset; then
15780 if test x"${install_sh}" != xset; then
1639115781 case $am_aux_dir in
1639215782 *\ * | *\ *)
1639315783 install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
1663016020
1663116021 # Define the identity of the package.
1663216022 PACKAGE='libheif'
16633 VERSION='1.4.0'
16023 VERSION='1.5.0'
1663416024
1663516025
1663616026 cat >>confdefs.h <<_ACEOF
1666416054 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
1666516055 mkdir_p='$(MKDIR_P)'
1666616056
16667 # We need awk for the "check" target (and possibly the TAP driver). The
16668 # system "awk" is bad on some platforms.
16057 # We need awk for the "check" target. The system "awk" is bad on
16058 # some platforms.
1666916059 # Always define AMTAR for backward compatibility. Yes, it's still used
1667016060 # in the wild :-( We should find a proper way to deprecate it ...
1667116061 AMTAR='$${TAR-tar}'
1698016370 fi
1698116371
1698216372
16983
1698416373 ax_cxx_compile_cxx11_required=true
1698516374 ac_ext=cpp
1698616375 ac_cpp='$CXXCPP $CPPFLAGS'
1754016929 if eval "test x$enable_visibility = x" ; then enable_visibility=yes ; fi
1754116930
1754216931
16932 # Check whether --enable-tests was given.
16933 if test "${enable_tests+set}" = set; then :
16934 enableval=$enable_tests;
16935 fi
16936
16937 if test "x$enable_tests" = "xyes"; then :
16938
16939 HAVE_TESTS=1
16940
16941 fi
16942 if test "x$HAVE_TESTS" == "x1"; then
16943 HAVE_TESTS_TRUE=
16944 HAVE_TESTS_FALSE='#'
16945 else
16946 HAVE_TESTS_TRUE='#'
16947 HAVE_TESTS_FALSE=
16948 fi
16949
16950
16951
16952
1754316953
1754416954
1754516955
1820517615 # Check whether --enable-libfuzzer was given.
1820617616 if test "${enable_libfuzzer+set}" = set; then :
1820717617 enableval=$enable_libfuzzer;
18208 fi
18209
18210 if eval "test x$enable_libfuzzer = xyes"; then
17618 else
17619 enable_libfuzzer=no
17620 fi
17621
17622 if eval "test x$enable_libfuzzer != xno"; then
1821117623 { $as_echo "$as_me:${as_lineno-$LINENO}: Enable libFuzzer" >&5
1821217624 $as_echo "$as_me: Enable libFuzzer" >&6;}
1821317625
1821417626 $as_echo "#define HAVE_LIBFUZZER 1" >>confdefs.h
1821517627
18216 LIBFUZZER_FLAGS="-fsanitize=fuzzer-no-link,address,shift,integer -fno-sanitize-recover=shift,integer"
18217 CFLAGS="$CFLAGS $LIBFUZZER_FLAGS"
18218 CXXFLAGS="$CXXFLAGS $LIBFUZZER_FLAGS"
18219 fi
18220 if test "x$enable_libfuzzer" = "xyes"; then
17628
17629 FUZZING_ENGINE="-lFuzzingEngine"
17630 if eval "test x$enable_libfuzzer != xyes"; then
17631 FUZZING_ENGINE="$enable_libfuzzer"
17632 fi
17633 { $as_echo "$as_me:${as_lineno-$LINENO}: Fuzzing engine flags: $FUZZING_ENGINE" >&5
17634 $as_echo "$as_me: Fuzzing engine flags: $FUZZING_ENGINE" >&6;}
17635
17636 fi
17637 if test "x$enable_libfuzzer" != "xno"; then
1822117638 ENABLE_LIBFUZZER_TRUE=
1822217639 ENABLE_LIBFUZZER_FALSE='#'
1822317640 else
1824217659 fi
1824317660
1824417661
18245 CXXFLAGS="$CXXFLAGS -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter"
18246 CFLAGS="$CFLAGS -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter"
17662 WARNING_FLAGS="-Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter -Wno-error=deprecated-declarations"
17663
17664 CXXFLAGS="$CXXFLAGS $WARNING_FLAGS"
17665 CFLAGS="$CFLAGS $WARNING_FLAGS"
17666
17667
17668 NEW_CFLAGS="$CFLAGS"
17669 NEW_CXXFLAGS="$CXXFLAGS"
17670 for ac_flag in -Wno-error=potentially-evaluated-expression
17671 do
17672 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports $ac_flag" >&5
17673 $as_echo_n "checking whether compiler supports $ac_flag... " >&6; }
17674 CXXFLAGS="$NEW_CXXFLAGS $ac_flag"
17675 ac_ext=cpp
17676 ac_cpp='$CXXCPP $CPPFLAGS'
17677 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
17678 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
17679 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
17680
17681 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17682 /* end confdefs.h. */
17683
17684 int
17685 main ()
17686 {
17687
17688 ;
17689
17690 ;
17691 return 0;
17692 }
17693 _ACEOF
17694 if ac_fn_cxx_try_compile "$LINENO"; then :
17695
17696
17697 NEW_CFLAGS="$NEW_CFLAGS $ac_flag"
17698 NEW_CXXFLAGS="$NEW_CXXFLAGS $ac_flag"
17699
17700 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
17701 $as_echo "yes" >&6; }
17702
17703 else
17704 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
17705 $as_echo "no" >&6; }
17706 fi
17707 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
17708 done
17709
17710 CFLAGS=$NEW_CFLAGS
17711 CXXFLAGS=$NEW_CXXFLAGS
17712
1824717713
1824817714 { $as_echo "$as_me:${as_lineno-$LINENO}: ---------------------------------------" >&5
1824917715 $as_echo "$as_me: ---------------------------------------" >&6;}
1826117727 $as_echo "$as_me: PNG output: $have_libpng" >&6;}
1826217728 { $as_echo "$as_me:${as_lineno-$LINENO}: GdkPixbuf2 loader: $have_gdkpixbuf2" >&5
1826317729 $as_echo "$as_me: GdkPixbuf2 loader: $have_gdkpixbuf2" >&6;}
17730 { $as_echo "$as_me:${as_lineno-$LINENO}: Examples: $enable_examples" >&5
17731 $as_echo "$as_me: Examples: $enable_examples" >&6;}
17732 { $as_echo "$as_me:${as_lineno-$LINENO}: Tests: $enable_tests (tests require that 'visibility' is turned off)" >&5
17733 $as_echo "$as_me: Tests: $enable_tests (tests require that 'visibility' is turned off)" >&6;}
1826417734 { $as_echo "$as_me:${as_lineno-$LINENO}: ---------------------------------------" >&5
1826517735 $as_echo "$as_me: ---------------------------------------" >&6;}
1826617736
1827917749 ac_config_files="$ac_config_files gnome/Makefile"
1828017750
1828117751 ac_config_files="$ac_config_files scripts/Makefile"
17752
17753 ac_config_files="$ac_config_files tests/Makefile"
1828217754
1828317755 ac_config_files="$ac_config_files libheif/Makefile"
1828417756
1840717879 as_fn_error $? "conditional \"HAVE_GO\" was never defined.
1840817880 Usually this means the macro was only invoked conditionally." "$LINENO" 5
1840917881 fi
17882 if test -z "${WITH_EXAMPLES_TRUE}" && test -z "${WITH_EXAMPLES_FALSE}"; then
17883 as_fn_error $? "conditional \"WITH_EXAMPLES\" was never defined.
17884 Usually this means the macro was only invoked conditionally." "$LINENO" 5
17885 fi
1841017886 if test -z "${MINGW_TRUE}" && test -z "${MINGW_FALSE}"; then
1841117887 as_fn_error $? "conditional \"MINGW\" was never defined.
1841217888 Usually this means the macro was only invoked conditionally." "$LINENO" 5
1843717913
1843817914 if test -z "${HAVE_VISIBILITY_TRUE}" && test -z "${HAVE_VISIBILITY_FALSE}"; then
1843917915 as_fn_error $? "conditional \"HAVE_VISIBILITY\" was never defined.
17916 Usually this means the macro was only invoked conditionally." "$LINENO" 5
17917 fi
17918 if test -z "${HAVE_TESTS_TRUE}" && test -z "${HAVE_TESTS_FALSE}"; then
17919 as_fn_error $? "conditional \"HAVE_TESTS\" was never defined.
1844017920 Usually this means the macro was only invoked conditionally." "$LINENO" 5
1844117921 fi
1844217922 if test -z "${HAVE_LIBDE265_TRUE}" && test -z "${HAVE_LIBDE265_FALSE}"; then
1886018340 # report actual input values of CONFIG_FILES etc. instead of their
1886118341 # values after options handling.
1886218342 ac_log="
18863 This file was extended by libheif $as_me 1.4.0, which was
18343 This file was extended by libheif $as_me 1.5.0, which was
1886418344 generated by GNU Autoconf 2.69. Invocation command line was
1886518345
1886618346 CONFIG_FILES = $CONFIG_FILES
1892618406 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1892718407 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1892818408 ac_cs_version="\\
18929 libheif config.status 1.4.0
18409 libheif config.status 1.5.0
1893018410 configured by $0, generated by GNU Autoconf 2.69,
1893118411 with options \\"\$ac_cs_config\\"
1893218412
1906018540 enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
1906118541 pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
1906218542 enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
19063 shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`'
1906418543 SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
1906518544 ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
1906618545 PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
1911018589 GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
1911118590 lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
1911218591 lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
19113 lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`'
1911418592 lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
1911518593 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"`'
19116 lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`'
1911718594 nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
1911818595 lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
19119 lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`'
1912018596 objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
1912118597 MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
1912218598 lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
1918118657 finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
1918218658 hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
1918318659 sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
19184 configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`'
19185 configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`'
18660 sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
1918618661 hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
1918718662 enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
1918818663 enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
1928718762 compiler \
1928818763 lt_cv_sys_global_symbol_pipe \
1928918764 lt_cv_sys_global_symbol_to_cdecl \
19290 lt_cv_sys_global_symbol_to_import \
1929118765 lt_cv_sys_global_symbol_to_c_name_address \
1929218766 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
19293 lt_cv_nm_interface \
1929418767 nm_file_list_spec \
19295 lt_cv_truncate_bin \
1929618768 lt_prog_compiler_no_builtin_flag \
1929718769 lt_prog_compiler_pic \
1929818770 lt_prog_compiler_wl \
1935818830 compiler_lib_search_path_CXX; do
1935918831 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
1936018832 *[\\\\\\\`\\"\\\$]*)
19361 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
18833 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
1936218834 ;;
1936318835 *)
1936418836 eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
1938518857 postuninstall_cmds \
1938618858 finish_cmds \
1938718859 sys_lib_search_path_spec \
19388 configure_time_dlsearch_path \
19389 configure_time_lt_sys_library_path \
18860 sys_lib_dlsearch_path_spec \
1939018861 reload_cmds_CXX \
1939118862 old_archive_cmds_CXX \
1939218863 old_archive_from_new_cmds_CXX \
1940018871 postlink_cmds_CXX; do
1940118872 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
1940218873 *[\\\\\\\`\\"\\\$]*)
19403 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
18874 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
1940418875 ;;
1940518876 *)
1940618877 eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
1940918880 done
1941018881
1941118882 ac_aux_dir='$ac_aux_dir'
19412
19413 # See if we are running on zsh, and set the options that allow our
18883 xsi_shell='$xsi_shell'
18884 lt_shell_append='$lt_shell_append'
18885
18886 # See if we are running on zsh, and set the options which allow our
1941418887 # commands through without removal of \ escapes INIT.
19415 if test -n "\${ZSH_VERSION+set}"; then
18888 if test -n "\${ZSH_VERSION+set}" ; then
1941618889 setopt NO_GLOB_SUBST
1941718890 fi
1941818891
1941918892
1942018893 PACKAGE='$PACKAGE'
1942118894 VERSION='$VERSION'
18895 TIMESTAMP='$TIMESTAMP'
1942218896 RM='$RM'
1942318897 ofile='$ofile'
1942418898
1944718921 "go/Makefile") CONFIG_FILES="$CONFIG_FILES go/Makefile" ;;
1944818922 "gnome/Makefile") CONFIG_FILES="$CONFIG_FILES gnome/Makefile" ;;
1944918923 "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
18924 "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
1945018925 "libheif/Makefile") CONFIG_FILES="$CONFIG_FILES libheif/Makefile" ;;
1945118926 "libheif/heif_version.h") CONFIG_FILES="$CONFIG_FILES libheif/heif_version.h" ;;
1945218927 "libheif.pc") CONFIG_FILES="$CONFIG_FILES libheif.pc" ;;
2004719522 case $ac_file$ac_mode in
2004819523 "libtool":C)
2004919524
20050 # See if we are running on zsh, and set the options that allow our
19525 # See if we are running on zsh, and set the options which allow our
2005119526 # commands through without removal of \ escapes.
20052 if test -n "${ZSH_VERSION+set}"; then
19527 if test -n "${ZSH_VERSION+set}" ; then
2005319528 setopt NO_GLOB_SUBST
2005419529 fi
2005519530
20056 cfgfile=${ofile}T
19531 cfgfile="${ofile}T"
2005719532 trap "$RM \"$cfgfile\"; exit 1" 1 2 15
2005819533 $RM "$cfgfile"
2005919534
2006019535 cat <<_LT_EOF >> "$cfgfile"
2006119536 #! $SHELL
20062 # Generated automatically by $as_me ($PACKAGE) $VERSION
19537
19538 # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
19539 # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
19540 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
2006319541 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
20064
20065 # Provide generalized library-building support services.
20066 # Written by Gordon Matzigkeit, 1996
20067
20068 # Copyright (C) 2014 Free Software Foundation, Inc.
20069 # This is free software; see the source for copying conditions. There is NO
20070 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20071
20072 # GNU Libtool is free software; you can redistribute it and/or modify
20073 # it under the terms of the GNU General Public License as published by
20074 # the Free Software Foundation; either version 2 of of the License, or
20075 # (at your option) any later version.
2007619542 #
20077 # As a special exception to the GNU General Public License, if you
20078 # distribute this file as part of a program or library that is built
20079 # using GNU Libtool, you may include this file under the same
20080 # distribution terms that you use for the rest of that program.
19543 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
19544 # 2006, 2007, 2008, 2009, 2010, 2011 Free Software
19545 # Foundation, Inc.
19546 # Written by Gordon Matzigkeit, 1996
2008119547 #
20082 # GNU Libtool is distributed in the hope that it will be useful, but
20083 # WITHOUT ANY WARRANTY; without even the implied warranty of
19548 # This file is part of GNU Libtool.
19549 #
19550 # GNU Libtool is free software; you can redistribute it and/or
19551 # modify it under the terms of the GNU General Public License as
19552 # published by the Free Software Foundation; either version 2 of
19553 # the License, or (at your option) any later version.
19554 #
19555 # As a special exception to the GNU General Public License,
19556 # if you distribute this file as part of a program or library that
19557 # is built using GNU Libtool, you may include this file under the
19558 # same distribution terms that you use for the rest of that program.
19559 #
19560 # GNU Libtool is distributed in the hope that it will be useful,
19561 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2008419562 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2008519563 # GNU General Public License for more details.
2008619564 #
2008719565 # You should have received a copy of the GNU General Public License
20088 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19566 # along with GNU Libtool; see the file COPYING. If not, a copy
19567 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
19568 # obtained by writing to the Free Software Foundation, Inc.,
19569 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2008919570
2009019571
2009119572 # The names of the tagged configurations supported by this script.
20092 available_tags='CXX '
20093
20094 # Configured defaults for sys_lib_dlsearch_path munging.
20095 : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
19573 available_tags="CXX "
2009619574
2009719575 # ### BEGIN LIBTOOL CONFIG
2009819576
2011119589
2011219590 # Whether or not to optimize for fast installation.
2011319591 fast_install=$enable_fast_install
20114
20115 # Shared archive member basename,for filename based shared library versioning on AIX.
20116 shared_archive_member_spec=$shared_archive_member_spec
2011719592
2011819593 # Shell to use when invoking shell scripts.
2011919594 SHELL=$lt_SHELL
2023219707 # Transform the output of nm in a proper C declaration.
2023319708 global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
2023419709
20235 # Transform the output of nm into a list of symbols to manually relocate.
20236 global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import
20237
2023819710 # Transform the output of nm in a C name address pair.
2023919711 global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
2024019712
2024119713 # Transform the output of nm in a C name address pair when lib prefix is needed.
2024219714 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
2024319715
20244 # The name lister interface.
20245 nm_interface=$lt_lt_cv_nm_interface
20246
2024719716 # Specify filename containing input files for \$NM.
2024819717 nm_file_list_spec=$lt_nm_file_list_spec
2024919718
20250 # The root where to search for dependent libraries,and where our libraries should be installed.
19719 # The root where to search for dependent libraries,and in which our libraries should be installed.
2025119720 lt_sysroot=$lt_sysroot
20252
20253 # Command to truncate a binary pipe.
20254 lt_truncate_bin=$lt_lt_cv_truncate_bin
2025519721
2025619722 # The name of the directory that contains temporary libtool files.
2025719723 objdir=$objdir
2034319809 # Compile-time system search path for libraries.
2034419810 sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
2034519811
20346 # Detected run-time system search path for libraries.
20347 sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path
20348
20349 # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
20350 configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path
19812 # Run-time system search path for libraries.
19813 sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
2035119814
2035219815 # Whether dlopen is supported.
2035319816 dlopen_support=$enable_dlopen
2044019903 # Whether we need a single "-rpath" flag with a separated argument.
2044119904 hardcode_libdir_separator=$lt_hardcode_libdir_separator
2044219905
20443 # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
19906 # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
2044419907 # DIR into the resulting binary.
2044519908 hardcode_direct=$hardcode_direct
2044619909
20447 # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
19910 # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
2044819911 # DIR into the resulting binary and the resulting library dependency is
20449 # "absolute",i.e impossible to change by setting \$shlibpath_var if the
19912 # "absolute",i.e impossible to change by setting \${shlibpath_var} if the
2045019913 # library is relocated.
2045119914 hardcode_direct_absolute=$hardcode_direct_absolute
2045219915
2051219975
2051319976 _LT_EOF
2051419977
20515 cat <<'_LT_EOF' >> "$cfgfile"
20516
20517 # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
20518
20519 # func_munge_path_list VARIABLE PATH
20520 # -----------------------------------
20521 # VARIABLE is name of variable containing _space_ separated list of
20522 # directories to be munged by the contents of PATH, which is string
20523 # having a format:
20524 # "DIR[:DIR]:"
20525 # string "DIR[ DIR]" will be prepended to VARIABLE
20526 # ":DIR[:DIR]"
20527 # string "DIR[ DIR]" will be appended to VARIABLE
20528 # "DIRP[:DIRP]::[DIRA:]DIRA"
20529 # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
20530 # "DIRA[ DIRA]" will be appended to VARIABLE
20531 # "DIR[:DIR]"
20532 # VARIABLE will be replaced by "DIR[ DIR]"
20533 func_munge_path_list ()
20534 {
20535 case x$2 in
20536 x)
20537 ;;
20538 *:)
20539 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
20540 ;;
20541 x:*)
20542 eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
20543 ;;
20544 *::*)
20545 eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
20546 eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
20547 ;;
20548 *)
20549 eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
20550 ;;
20551 esac
20552 }
20553
20554
20555 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
20556 func_cc_basename ()
20557 {
20558 for cc_temp in $*""; do
20559 case $cc_temp in
20560 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
20561 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
20562 \-*) ;;
20563 *) break;;
20564 esac
20565 done
20566 func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
20567 }
20568
20569
20570 # ### END FUNCTIONS SHARED WITH CONFIGURE
20571
20572 _LT_EOF
20573
2057419978 case $host_os in
2057519979 aix3*)
2057619980 cat <<\_LT_EOF >> "$cfgfile"
2057719981 # AIX sometimes has problems with the GCC collect2 program. For some
2057819982 # reason, if we set the COLLECT_NAMES environment variable, the problems
2057919983 # vanish in a puff of smoke.
20580 if test set != "${COLLECT_NAMES+set}"; then
19984 if test "X${COLLECT_NAMES+set}" != Xset; then
2058119985 COLLECT_NAMES=
2058219986 export COLLECT_NAMES
2058319987 fi
2058619990 esac
2058719991
2058819992
20589 ltmain=$ac_aux_dir/ltmain.sh
19993 ltmain="$ac_aux_dir/ltmain.sh"
2059019994
2059119995
2059219996 # We use sed instead of cat because bash on DJGPP gets confused if
2059620000 sed '$q' "$ltmain" >> "$cfgfile" \
2059720001 || (rm -f "$cfgfile"; exit 1)
2059820002
20003 if test x"$xsi_shell" = xyes; then
20004 sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
20005 func_dirname ()\
20006 {\
20007 \ case ${1} in\
20008 \ */*) func_dirname_result="${1%/*}${2}" ;;\
20009 \ * ) func_dirname_result="${3}" ;;\
20010 \ esac\
20011 } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
20012 && mv -f "$cfgfile.tmp" "$cfgfile" \
20013 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20014 test 0 -eq $? || _lt_function_replace_fail=:
20015
20016
20017 sed -e '/^func_basename ()$/,/^} # func_basename /c\
20018 func_basename ()\
20019 {\
20020 \ func_basename_result="${1##*/}"\
20021 } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
20022 && mv -f "$cfgfile.tmp" "$cfgfile" \
20023 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20024 test 0 -eq $? || _lt_function_replace_fail=:
20025
20026
20027 sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
20028 func_dirname_and_basename ()\
20029 {\
20030 \ case ${1} in\
20031 \ */*) func_dirname_result="${1%/*}${2}" ;;\
20032 \ * ) func_dirname_result="${3}" ;;\
20033 \ esac\
20034 \ func_basename_result="${1##*/}"\
20035 } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
20036 && mv -f "$cfgfile.tmp" "$cfgfile" \
20037 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20038 test 0 -eq $? || _lt_function_replace_fail=:
20039
20040
20041 sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
20042 func_stripname ()\
20043 {\
20044 \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
20045 \ # positional parameters, so assign one to ordinary parameter first.\
20046 \ func_stripname_result=${3}\
20047 \ func_stripname_result=${func_stripname_result#"${1}"}\
20048 \ func_stripname_result=${func_stripname_result%"${2}"}\
20049 } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
20050 && mv -f "$cfgfile.tmp" "$cfgfile" \
20051 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20052 test 0 -eq $? || _lt_function_replace_fail=:
20053
20054
20055 sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
20056 func_split_long_opt ()\
20057 {\
20058 \ func_split_long_opt_name=${1%%=*}\
20059 \ func_split_long_opt_arg=${1#*=}\
20060 } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
20061 && mv -f "$cfgfile.tmp" "$cfgfile" \
20062 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20063 test 0 -eq $? || _lt_function_replace_fail=:
20064
20065
20066 sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
20067 func_split_short_opt ()\
20068 {\
20069 \ func_split_short_opt_arg=${1#??}\
20070 \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
20071 } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
20072 && mv -f "$cfgfile.tmp" "$cfgfile" \
20073 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20074 test 0 -eq $? || _lt_function_replace_fail=:
20075
20076
20077 sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
20078 func_lo2o ()\
20079 {\
20080 \ case ${1} in\
20081 \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
20082 \ *) func_lo2o_result=${1} ;;\
20083 \ esac\
20084 } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
20085 && mv -f "$cfgfile.tmp" "$cfgfile" \
20086 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20087 test 0 -eq $? || _lt_function_replace_fail=:
20088
20089
20090 sed -e '/^func_xform ()$/,/^} # func_xform /c\
20091 func_xform ()\
20092 {\
20093 func_xform_result=${1%.*}.lo\
20094 } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
20095 && mv -f "$cfgfile.tmp" "$cfgfile" \
20096 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20097 test 0 -eq $? || _lt_function_replace_fail=:
20098
20099
20100 sed -e '/^func_arith ()$/,/^} # func_arith /c\
20101 func_arith ()\
20102 {\
20103 func_arith_result=$(( $* ))\
20104 } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
20105 && mv -f "$cfgfile.tmp" "$cfgfile" \
20106 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20107 test 0 -eq $? || _lt_function_replace_fail=:
20108
20109
20110 sed -e '/^func_len ()$/,/^} # func_len /c\
20111 func_len ()\
20112 {\
20113 func_len_result=${#1}\
20114 } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
20115 && mv -f "$cfgfile.tmp" "$cfgfile" \
20116 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20117 test 0 -eq $? || _lt_function_replace_fail=:
20118
20119 fi
20120
20121 if test x"$lt_shell_append" = xyes; then
20122 sed -e '/^func_append ()$/,/^} # func_append /c\
20123 func_append ()\
20124 {\
20125 eval "${1}+=\\${2}"\
20126 } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
20127 && mv -f "$cfgfile.tmp" "$cfgfile" \
20128 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20129 test 0 -eq $? || _lt_function_replace_fail=:
20130
20131
20132 sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
20133 func_append_quoted ()\
20134 {\
20135 \ func_quote_for_eval "${2}"\
20136 \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
20137 } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
20138 && mv -f "$cfgfile.tmp" "$cfgfile" \
20139 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20140 test 0 -eq $? || _lt_function_replace_fail=:
20141
20142
20143 # Save a `func_append' function call where possible by direct use of '+='
20144 sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
20145 && mv -f "$cfgfile.tmp" "$cfgfile" \
20146 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20147 test 0 -eq $? || _lt_function_replace_fail=:
20148 else
20149 # Save a `func_append' function call even when '+=' is not available
20150 sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
20151 && mv -f "$cfgfile.tmp" "$cfgfile" \
20152 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
20153 test 0 -eq $? || _lt_function_replace_fail=:
20154 fi
20155
20156 if test x"$_lt_function_replace_fail" = x":"; then
20157 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
20158 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
20159 fi
20160
20161
2059920162 mv -f "$cfgfile" "$ofile" ||
2060020163 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
2060120164 chmod +x "$ofile"
2068220245 # Whether we need a single "-rpath" flag with a separated argument.
2068320246 hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
2068420247
20685 # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
20248 # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
2068620249 # DIR into the resulting binary.
2068720250 hardcode_direct=$hardcode_direct_CXX
2068820251
20689 # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
20252 # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
2069020253 # DIR into the resulting binary and the resulting library dependency is
20691 # "absolute",i.e impossible to change by setting \$shlibpath_var if the
20254 # "absolute",i.e impossible to change by setting \${shlibpath_var} if the
2069220255 # library is relocated.
2069320256 hardcode_direct_absolute=$hardcode_direct_absolute_CXX
2069420257
00 AC_PREREQ([2.68])
1 AC_INIT([libheif], [1.4.0], [opensource@struktur.de])
1 AC_INIT([libheif], [1.5.0], [opensource@struktur.de])
22 AC_CONFIG_SRCDIR([libheif/box.cc])
33 AC_CONFIG_HEADERS([config.h])
44
55 # Note: do not forget to set the version in the CMakeLists.txt file accordingly
6 NUMERIC_VERSION=0x01040000 # Numeric representation of the version (A.B.C[.D] = 0xAABBCCDD)
6 NUMERIC_VERSION=0x01050000 # Numeric representation of the version (A.B.C[.D] = 0xAABBCCDD)
77 AC_SUBST(NUMERIC_VERSION)
88
99 # From https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html:
1212 # If any interfaces have been added since the last public release, then increment age.
1313 # If any interfaces have been removed or changed since the last public release, then set age to 0.
1414
15 LIBHEIF_CURRENT=5
15 LIBHEIF_CURRENT=6
1616 LIBHEIF_REVISION=0
17 LIBHEIF_AGE=4
17 LIBHEIF_AGE=5
1818 AC_SUBST(LIBHEIF_CURRENT)
1919 AC_SUBST(LIBHEIF_REVISION)
2020 AC_SUBST(LIBHEIF_AGE)
4040 AM_CONDITIONAL([HAVE_GO], [test "x$GO" != "xno" && test "x$GO" != "x"])
4141 AC_SUBST(HAVE_GO)
4242
43 AC_ARG_ENABLE([examples], AS_HELP_STRING([--disable-examples],
44 [Disable building examples.]), [enable_examples=no], [enable_examples=yes])
45 AM_CONDITIONAL([WITH_EXAMPLES], [test "x$enable_examples" = "xyes"])
46 AC_SUBST(WITH_EXAMPLES)
47
4348 AM_CONDITIONAL(MINGW, expr $host : '.*-mingw' >/dev/null 2>&1)
4449
45 AM_INIT_AUTOMAKE([foreign])
50 AM_INIT_AUTOMAKE([1.13 foreign])
4651 AM_EXTRA_RECURSIVE_TARGETS([format test])
4752
4853 AX_CXX_COMPILE_STDCXX_11()
6671 [gl_VISIBILITY])
6772 AM_CONDITIONAL([HAVE_VISIBILITY], [test "x$HAVE_VISIBILITY" != "x0"])
6873 if eval "test x$enable_visibility = x" ; then enable_visibility=yes ; fi
74
75
76 AC_ARG_ENABLE([tests], AS_HELP_STRING([--enable-tests],
77 [Enable compiling tests ('visibility' must be disabled).]))
78 AS_IF([test "x$enable_tests" = "xyes"], [
79 HAVE_TESTS=1
80 ])
81 AM_CONDITIONAL([HAVE_TESTS], [test "x$HAVE_TESTS" == "x1"])
82
6983
7084 PKG_CHECK_MODULES([libde265], [libde265], [
7185 AC_DEFINE([HAVE_LIBDE265], [1], [Whether libde265 was found.])
158172 fi
159173
160174 AC_ARG_ENABLE([libfuzzer], AS_HELP_STRING([--enable-libfuzzer],
161 [Enable fuzzing with libFuzzer.]))
162 if eval "test x$enable_libfuzzer = xyes"; then
175 [Enable fuzzing with libFuzzer.]), [], [enable_libfuzzer=no])
176 if eval "test x$enable_libfuzzer != xno"; then
163177 AC_MSG_NOTICE([Enable libFuzzer])
164178 AC_DEFINE([HAVE_LIBFUZZER], [1], [Whether building with libFuzzer.])
165 LIBFUZZER_FLAGS="-fsanitize=fuzzer-no-link,address,shift,integer -fno-sanitize-recover=shift,integer"
166 CFLAGS="$CFLAGS $LIBFUZZER_FLAGS"
167 CXXFLAGS="$CXXFLAGS $LIBFUZZER_FLAGS"
168 fi
169 AM_CONDITIONAL([ENABLE_LIBFUZZER], [test "x$enable_libfuzzer" = "xyes"])
179
180 FUZZING_ENGINE="-lFuzzingEngine"
181 if eval "test x$enable_libfuzzer != xyes"; then
182 FUZZING_ENGINE="$enable_libfuzzer"
183 fi
184 AC_MSG_NOTICE([Fuzzing engine flags: $FUZZING_ENGINE])
185 AC_SUBST([FUZZING_ENGINE])
186 fi
187 AM_CONDITIONAL([ENABLE_LIBFUZZER], [test "x$enable_libfuzzer" != "xno"])
170188 AC_SUBST(ENABLE_LIBFUZZER)
171189
172190 AC_ARG_ENABLE([multithreading], AS_HELP_STRING([--disable-multithreading],
178196 fi
179197 AC_SUBST(ENABLE_PARALLEL_TILE_DECODING)
180198
181 CXXFLAGS="$CXXFLAGS -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter"
182 CFLAGS="$CFLAGS -Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter"
199 WARNING_FLAGS="-Wall -Werror -Wsign-compare -Wconversion -Wno-sign-conversion -Wno-error=conversion -Wno-error=unused-parameter -Wno-error=deprecated-declarations"
200
201 CXXFLAGS="$CXXFLAGS $WARNING_FLAGS"
202 CFLAGS="$CFLAGS $WARNING_FLAGS"
203
204 AC_C_CXX_COMPILE_FLAGS([-Wno-error=potentially-evaluated-expression])
183205
184206 AC_MSG_NOTICE([---------------------------------------])
185207 AC_MSG_NOTICE([Multithreading: $enable_multithreading])
189211 AC_MSG_NOTICE([JPEG output: $have_libjpeg])
190212 AC_MSG_NOTICE([PNG output: $have_libpng])
191213 AC_MSG_NOTICE([GdkPixbuf2 loader: $have_gdkpixbuf2])
214 AC_MSG_NOTICE([Examples: $enable_examples])
215 AC_MSG_NOTICE([Tests: $enable_tests (tests require that 'visibility' is turned off)])
192216 AC_MSG_NOTICE([---------------------------------------])
193217
194218 AC_CONFIG_FILES([Makefile])
199223 AC_CONFIG_FILES([go/Makefile])
200224 AC_CONFIG_FILES([gnome/Makefile])
201225 AC_CONFIG_FILES([scripts/Makefile])
226 AC_CONFIG_FILES([tests/Makefile])
202227 AC_CONFIG_FILES([libheif/Makefile])
203228 AC_CONFIG_FILES([libheif/heif_version.h])
204229 AC_CONFIG_FILES([libheif.pc])
00 #! /bin/sh
11 # depcomp - compile a program generating dependencies as side-effects
22
3 scriptversion=2016-01-11.22; # UTC
4
5 # Copyright (C) 1999-2017 Free Software Foundation, Inc.
3 scriptversion=2013-05-30.07; # UTC
4
5 # Copyright (C) 1999-2013 Free Software Foundation, Inc.
66
77 # This program is free software; you can redistribute it and/or modify
88 # it under the terms of the GNU General Public License as published by
785785 # eval: (add-hook 'write-file-hooks 'time-stamp)
786786 # time-stamp-start: "scriptversion="
787787 # time-stamp-format: "%:y-%02m-%02d.%02H"
788 # time-stamp-time-zone: "UTC0"
788 # time-stamp-time-zone: "UTC"
789789 # time-stamp-end: "; # UTC"
790790 # End:
00 AUTOMAKE_OPTIONS = subdir-objects
11
2 bin_PROGRAMS = \
2 examples = \
33 heif-convert \
44 heif-enc \
55 heif-info
66
7 noinst_PROGRAMS = \
7 examples_noinst = \
88 heif-test \
99 test-c-api
1010
1616
1717
1818 if HAVE_LIBPNG
19 bin_PROGRAMS += heif-thumbnailer
19 examples += heif-thumbnailer
2020 heif_thumbnailer_DEPENDENCIES = ../libheif/libheif.la
2121 heif_thumbnailer_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir) $(libpng_CFLAGS)
2222 heif_thumbnailer_LDFLAGS = $(libpng_LIBS)
7777 example.heic
7878
7979 if HAVE_GO
80 noinst_PROGRAMS += \
80 examples_noinst += \
8181 heif-test-go
8282
8383 heif_test_go_SOURCES = heif-test.go
9696 echo ""go" not present in "${PATH}", skipping formatting"
9797 endif
9898
99 if WITH_EXAMPLES
100 bin_PROGRAMS = $(examples)
101 noinst_PROGRAMS = $(examples_noinst)
102 endif
103
99104 format-local: format-go
0 # Makefile.in generated by automake 1.15.1 from Makefile.am.
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1414 @SET_MAKE@
1515
1616 VPATH = @srcdir@
17 am__is_gnu_make = { \
18 if test -z '$(MAKELEVEL)'; then \
19 false; \
20 elif test -n '$(MAKE_HOST)'; then \
21 true; \
22 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
23 true; \
24 else \
25 false; \
26 fi; \
27 }
17 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
2818 am__make_running_with_option = \
2919 case $${target_option-} in \
3020 ?) ;; \
8878 build_triplet = @build@
8979 host_triplet = @host@
9080 target_triplet = @target@
91 bin_PROGRAMS = heif-convert$(EXEEXT) heif-enc$(EXEEXT) \
92 heif-info$(EXEEXT) $(am__EXEEXT_1)
93 noinst_PROGRAMS = heif-test$(EXEEXT) test-c-api$(EXEEXT) \
94 $(am__EXEEXT_2)
9581 @HAVE_LIBPNG_TRUE@am__append_1 = heif-thumbnailer
9682 @HAVE_LIBJPEG_TRUE@am__append_2 = $(libjpeg_CFLAGS)
9783 @HAVE_LIBJPEG_TRUE@am__append_3 = $(libjpeg_LIBS)
10692 @HAVE_GO_TRUE@am__append_12 = \
10793 @HAVE_GO_TRUE@ heif-test-go
10894
95 @WITH_EXAMPLES_TRUE@bin_PROGRAMS = $(am__EXEEXT_2)
96 @WITH_EXAMPLES_TRUE@noinst_PROGRAMS = $(am__EXEEXT_4)
10997 subdir = examples
98 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
99 $(top_srcdir)/depcomp COPYING
110100 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
111 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
101 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
102 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
112103 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
113104 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
114105 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
115106 $(top_srcdir)/configure.ac
116107 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
117108 $(ACLOCAL_M4)
118 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
119109 mkinstalldirs = $(install_sh) -d
120110 CONFIG_HEADER = $(top_builddir)/config.h
121111 CONFIG_CLEAN_FILES =
122112 CONFIG_CLEAN_VPATH_FILES =
123113 @HAVE_LIBPNG_TRUE@am__EXEEXT_1 = heif-thumbnailer$(EXEEXT)
114 am__EXEEXT_2 = heif-convert$(EXEEXT) heif-enc$(EXEEXT) \
115 heif-info$(EXEEXT) $(am__EXEEXT_1)
124116 am__installdirs = "$(DESTDIR)$(bindir)"
125 @HAVE_GO_TRUE@am__EXEEXT_2 = heif-test-go$(EXEEXT)
117 @HAVE_GO_TRUE@am__EXEEXT_3 = heif-test-go$(EXEEXT)
118 am__EXEEXT_4 = heif-test$(EXEEXT) test-c-api$(EXEEXT) $(am__EXEEXT_3)
126119 PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
127120 am__heif_convert_SOURCES_DIST = encoder.cc encoder.h heif_convert.cc \
128121 encoder_y4m.cc encoder_y4m.h encoder_jpeg.cc encoder_jpeg.h \
265258 done | $(am__uniquify_input)`
266259 ETAGS = etags
267260 CTAGS = ctags
268 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp COPYING
269261 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
270262 ACLOCAL = @ACLOCAL@
271263 AMTAR = @AMTAR@
302294 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
303295 EXEEXT = @EXEEXT@
304296 FGREP = @FGREP@
297 FUZZING_ENGINE = @FUZZING_ENGINE@
305298 GO = @GO@
306299 GREP = @GREP@
307300 HAVE_CXX11 = @HAVE_CXX11@
323316 LIPO = @LIPO@
324317 LN_S = @LN_S@
325318 LTLIBOBJS = @LTLIBOBJS@
326 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
327319 MAKEINFO = @MAKEINFO@
328320 MANIFEST_TOOL = @MANIFEST_TOOL@
329321 MKDIR_P = @MKDIR_P@
351343 SHELL = @SHELL@
352344 STRIP = @STRIP@
353345 VERSION = @VERSION@
346 WITH_EXAMPLES = @WITH_EXAMPLES@
354347 abs_builddir = @abs_builddir@
355348 abs_srcdir = @abs_srcdir@
356349 abs_top_builddir = @abs_top_builddir@
410403 prefix = @prefix@
411404 program_transform_name = @program_transform_name@
412405 psdir = @psdir@
413 runstatedir = @runstatedir@
414406 sbindir = @sbindir@
415407 sharedstatedir = @sharedstatedir@
416408 srcdir = @srcdir@
426418 x265_CFLAGS = @x265_CFLAGS@
427419 x265_LIBS = @x265_LIBS@
428420 AUTOMAKE_OPTIONS = subdir-objects
421 examples = heif-convert heif-enc heif-info $(am__append_1)
422 examples_noinst = heif-test test-c-api $(am__append_12)
429423 heif_convert_DEPENDENCIES = ../libheif/libheif.la
430424 heif_convert_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)/. \
431425 $(am__append_2) $(am__append_5)
484478 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
485479 $(am__cd) $(top_srcdir) && \
486480 $(AUTOMAKE) --foreign examples/Makefile
481 .PRECIOUS: Makefile
487482 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
488483 @case '$?' in \
489484 *config.status*) \
10471042 tags tags-am test-am test-local uninstall uninstall-am \
10481043 uninstall-binPROGRAMS
10491044
1050 .PRECIOUS: Makefile
1051
10521045
10531046 @HAVE_GO_TRUE@gopath:
10541047 @HAVE_GO_TRUE@ mkdir -p ${CURDIR}/src/github.com/strukturag/libheif
8181 int height = heif_image_get_height(image, heif_channel_interleaved);
8282
8383 int bitDepth;
84 if (heif_image_get_bits_per_pixel(image, heif_channel_interleaved)>32) {
84 int input_bpp = heif_image_get_bits_per_pixel_range(image, heif_channel_interleaved);
85 if (input_bpp>8) {
8586 bitDepth = 16;
8687 }
8788 else {
119120 row_pointers[y] = const_cast<uint8_t*>(&row_rgb[y * stride_rgb]);
120121 }
121122
123 if (bitDepth==16) {
124 // shift image data to full 16bit range
125
126 int shift = 16-input_bpp;
127 if (shift>0) {
128 for (int y = 0; y < height; ++y) {
129 for (int x=0; x < stride_rgb; x+= 2) {
130 uint8_t* p = (&row_pointers[y][x]);
131 int v = (p[0]<<8) | p[1];
132 v = (v<<shift) | (v>>(16-shift));
133 p[0] = (uint8_t)(v>>8);
134 p[1] = (uint8_t)(v&0xFF);
135 }
136 }
137 }
138 }
139
140
122141 png_write_image(png_ptr, row_pointers);
123142 png_write_end(png_ptr, nullptr);
124143 png_destroy_write_struct(&png_ptr, &info_ptr);
2626
2727 #include <errno.h>
2828 #include <string.h>
29 #include <assert.h>
2930
3031
3132 Y4MEncoder::Y4MEncoder() {
5152 const uint8_t* cbp = heif_image_get_plane_readonly(image, heif_channel_Cb, &cb_stride);
5253 const uint8_t* crp = heif_image_get_plane_readonly(image, heif_channel_Cr, &cr_stride);
5354
55 assert(y_stride > 0);
56 assert(cb_stride > 0);
57 assert(cr_stride > 0);
58
5459 int yw = heif_image_get_width(image, heif_channel_Y);
5560 int yh = heif_image_get_height(image, heif_channel_Y);
5661 int cw = heif_image_get_width(image, heif_channel_Cb);
206206 encoder->UpdateDecodingOptions(handle, decode_options);
207207
208208 int bit_depth = heif_image_handle_get_luma_bits_per_pixel(handle);
209 if (bit_depth < 0) {
210 heif_decoding_options_free(decode_options);
211 heif_image_handle_release(handle);
212 std::cerr << "Input image has undefined bit-depth\n";
213 return 1;
214 }
209215
210216 struct heif_image* image;
211217 err = heif_decode_image(handle,
266266 // create destination image
267267
268268 struct heif_error err = heif_image_create(cinfo.output_width, cinfo.output_height,
269 heif_colorspace_YCbCr,
269 heif_colorspace_monochrome,
270270 heif_chroma_monochrome,
271271 &image);
272272 (void)err;
283283 while (cinfo.output_scanline < cinfo.output_height) {
284284 (void) jpeg_read_scanlines(&cinfo, buffer, 1);
285285
286 memcpy(py + (cinfo.output_scanline-1)*y_stride, buffer, cinfo.output_width);
287 }
288
286 memcpy(py + (cinfo.output_scanline-1)*y_stride, *buffer, cinfo.output_width);
287 }
289288 }
290289 else
291290 {
360359
361360 if (embeddedIccFlag && iccLen > 0){
362361 heif_image_set_raw_color_profile(image, "prof", iccBuffer, (size_t) iccLen);
363 free(iccBuffer);
364362 }
365363
366364 // cleanup
367
365 free(iccBuffer);
368366 jpeg_finish_decompress(&cinfo);
369367 jpeg_destroy_decompress(&cinfo);
370368
420418 #else
421419 png_bytep png_profile_data;
422420 #endif
423 uint8_t * profile_data;
421 uint8_t * profile_data = nullptr;
424422 png_uint_32 profile_length = 5;
425 bool color_profile_valid = false;
426423
427424 /* Create and initialize the png_struct with the desired error handler
428425 * functions. If you want to use the default stderr and longjump method,
466463
467464 if (png_get_valid(png_ptr, info_ptr, PNG_INFO_iCCP)) {
468465 if (PNG_INFO_iCCP == png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &png_profile_data, &profile_length) && profile_length > 0) {
469 color_profile_valid = 1;
470466 profile_data = (uint8_t*) malloc(profile_length);
471 memcpy(profile_data, png_profile_data, profile_length);
467 if (profile_data) {
468 memcpy(profile_data, png_profile_data, profile_length);
469 }
472470 }
473471 }
474472 /**** Set up the data transformations you want. Note that these are all
570568
571569 if (band==1) {
572570 err = heif_image_create((int)width, (int)height,
573 heif_colorspace_YCbCr,
571 heif_colorspace_monochrome,
574572 heif_chroma_monochrome,
575573 &image);
576574 (void)err;
630628 else {
631629 err = heif_image_create((int)width, (int)height,
632630 heif_colorspace_RGB,
633 heif_chroma_444,
631 has_alpha ?
632 heif_chroma_interleaved_RRGGBBAA_BE :
633 heif_chroma_interleaved_RRGGBB_BE,
634634 &image);
635635 (void)err;
636636
637637 int bdShift = 16 - output_bit_depth;
638638
639 heif_image_add_plane(image, heif_channel_R, (int)width, (int)height, output_bit_depth);
640 heif_image_add_plane(image, heif_channel_G, (int)width, (int)height, output_bit_depth);
641 heif_image_add_plane(image, heif_channel_B, (int)width, (int)height, output_bit_depth);
642
643 int stride_r, stride_g, stride_b, stride_a;
644 uint16_t* p_r = (uint16_t*)heif_image_get_plane(image, heif_channel_R, &stride_r);
645 uint16_t* p_g = (uint16_t*)heif_image_get_plane(image, heif_channel_G, &stride_g);
646 uint16_t* p_b = (uint16_t*)heif_image_get_plane(image, heif_channel_B, &stride_b);
647
648 uint16_t* p_a;
649 if (has_alpha) {
650 heif_image_add_plane(image, heif_channel_Alpha, (int)width, (int)height, output_bit_depth);
651 p_a = (uint16_t*)heif_image_get_plane(image, heif_channel_Alpha, &stride_a);
652 }
639 heif_image_add_plane(image, heif_channel_interleaved, (int)width, (int)height, output_bit_depth);
640
641 int stride;
642 uint8_t* p_out = (uint8_t*)heif_image_get_plane(image, heif_channel_interleaved, &stride);
653643
654644 for (uint32_t y = 0; y < height; y++) {
655645 uint8_t* p = row_pointers[y];
656646
657 if (has_alpha) {
658 for (uint32_t x = 0; x < width; x++) {
659 p_r[y*stride_r/2 + x] = (uint16_t)(((p[0]<<8) | p[1]) >> bdShift);
660 p_g[y*stride_g/2 + x] = (uint16_t)(((p[2]<<8) | p[3]) >> bdShift);
661 p_b[y*stride_b/2 + x] = (uint16_t)(((p[4]<<8) | p[5]) >> bdShift);
662 p_a[y*stride_a/2 + x] = (uint16_t)(((p[6]<<8) | p[7]) >> bdShift);
663 p+=8;
664 }
665 }
666 else {
667 for (uint32_t x = 0; x < width; x++) {
668 p_r[y*stride_r/2 + x] = (uint16_t)(((p[0]<<8) | p[1]) >> bdShift);
669 p_g[y*stride_g/2 + x] = (uint16_t)(((p[2]<<8) | p[3]) >> bdShift);
670 p_b[y*stride_b/2 + x] = (uint16_t)(((p[4]<<8) | p[5]) >> bdShift);
671 p+=6;
672 }
673 }
674 }
675 }
676
677 if (color_profile_valid && profile_length > 0){
647 uint32_t nVal = (has_alpha ? 4 : 3) * width;
648
649 for (uint32_t x = 0; x < nVal ; x++) {
650 uint16_t v = (uint16_t)(((p[0]<<8) | p[1]) >> bdShift);
651 p_out[2*x + y*stride + 0] = (v>>8);
652 p_out[2*x + y*stride + 1] = (v & 0xFF);
653 p += 2;
654 }
655 }
656 }
657
658 if (profile_data && profile_length > 0){
678659 heif_image_set_raw_color_profile(image, "prof", profile_data, (size_t) profile_length);
679 free(profile_data);
680 }
681
660 }
661
662 free(profile_data);
682663 for (uint32_t y = 0; y < height; y++) {
683664 free(row_pointers[y]);
684665 } // for
10941075 options,
10951076 &handle);
10961077 if (error.code != 0) {
1078 heif_encoding_options_free(options);
10971079 std::cerr << "Could not encode HEIF file: " << error.message << "\n";
10981080 return 1;
10991081 }
11151097 thumbnail_bbox_size,
11161098 &thumbnail_handle);
11171099 if (error.code) {
1100 heif_encoding_options_free(options);
11181101 std::cerr << "Could not generate thumbnail: " << error.message << "\n";
11191102 return 5;
11201103 }
11251108 }
11261109
11271110 heif_image_handle_release(handle);
1111 heif_encoding_options_free(options);
11281112 }
11291113
11301114 heif_encoder_release(encoder);
132132 const char* input_filename = argv[optind];
133133
134134 // ==============================================================================
135 // show MIME type
136
137 {
138 uint8_t buf[20];
139 FILE* fh = fopen(input_filename,"rb");
140 if (fh) {
141 std::cout << "MIME type: ";
142 int n = (int)fread(buf,1,20,fh);
143 const char* mime_type = heif_get_file_mime_type(buf,n);
144 if (*mime_type==0) {
145 std::cout << "unknown\n";
146 }
147 else {
148 std::cout << mime_type << "\n";
149 }
150
151 fclose(fh);
152 }
153 }
154
155 // ==============================================================================
135156
136157 std::shared_ptr<heif_context> ctx(heif_context_alloc(),
137158 [] (heif_context* c) { heif_context_free(c); });
180201 // --- thumbnails
181202
182203 int nThumbnails = heif_image_handle_get_number_of_thumbnails(handle);
183 heif_item_id* thumbnailIDs = (heif_item_id*)alloca(nThumbnails*sizeof(heif_item_id));
204 heif_item_id* thumbnailIDs = (heif_item_id*)calloc(nThumbnails,sizeof(heif_item_id));
184205
185206 nThumbnails = heif_image_handle_get_list_of_thumbnail_IDs(handle,thumbnailIDs, nThumbnails);
186207
189210 err = heif_image_handle_get_thumbnail(handle, thumbnailIDs[thumbnailIdx], &thumbnail_handle);
190211 if (err.code) {
191212 std::cerr << err.message << "\n";
213 free(thumbnailIDs);
192214 return 10;
193215 }
194216
199221
200222 heif_image_handle_release(thumbnail_handle);
201223 }
224
225 free(thumbnailIDs);
202226
203227
204228 // --- color profile
160160 fwrite(data.data(), data.size(),1, stdout);
161161 }
162162 }
163 catch (heif::Error err) {
163 catch (const heif::Error& err) {
164164 std::cerr << err.get_message() << "\n";
165165 }
166166
0 # Makefile.in generated by automake 1.15.1 from Makefile.am.
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1313
1414 @SET_MAKE@
1515 VPATH = @srcdir@
16 am__is_gnu_make = { \
17 if test -z '$(MAKELEVEL)'; then \
18 false; \
19 elif test -n '$(MAKE_HOST)'; then \
20 true; \
21 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
22 true; \
23 else \
24 false; \
25 fi; \
26 }
16 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
2717 am__make_running_with_option = \
2818 case $${target_option-} in \
2919 ?) ;; \
8878 host_triplet = @host@
8979 target_triplet = @target@
9080 subdir = extra
81 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
9182 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
92 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
83 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
84 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
9385 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
9486 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
9587 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
9688 $(top_srcdir)/configure.ac
9789 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
9890 $(ACLOCAL_M4)
99 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
10091 mkinstalldirs = $(install_sh) -d
10192 CONFIG_HEADER = $(top_builddir)/config.h
10293 CONFIG_CLEAN_FILES =
122113 esac
123114 am__extra_recursive_targets = format-recursive test-recursive
124115 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
125 am__DIST_COMMON = $(srcdir)/Makefile.in
126116 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
127117 ACLOCAL = @ACLOCAL@
128118 AMTAR = @AMTAR@
159149 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
160150 EXEEXT = @EXEEXT@
161151 FGREP = @FGREP@
152 FUZZING_ENGINE = @FUZZING_ENGINE@
162153 GO = @GO@
163154 GREP = @GREP@
164155 HAVE_CXX11 = @HAVE_CXX11@
180171 LIPO = @LIPO@
181172 LN_S = @LN_S@
182173 LTLIBOBJS = @LTLIBOBJS@
183 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
184174 MAKEINFO = @MAKEINFO@
185175 MANIFEST_TOOL = @MANIFEST_TOOL@
186176 MKDIR_P = @MKDIR_P@
208198 SHELL = @SHELL@
209199 STRIP = @STRIP@
210200 VERSION = @VERSION@
201 WITH_EXAMPLES = @WITH_EXAMPLES@
211202 abs_builddir = @abs_builddir@
212203 abs_srcdir = @abs_srcdir@
213204 abs_top_builddir = @abs_top_builddir@
267258 prefix = @prefix@
268259 program_transform_name = @program_transform_name@
269260 psdir = @psdir@
270 runstatedir = @runstatedir@
271261 sbindir = @sbindir@
272262 sharedstatedir = @sharedstatedir@
273263 srcdir = @srcdir@
302292 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign extra/Makefile'; \
303293 $(am__cd) $(top_srcdir) && \
304294 $(AUTOMAKE) --foreign extra/Makefile
295 .PRECIOUS: Makefile
305296 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
306297 @case '$?' in \
307298 *config.status*) \
487478 mostlyclean-libtool pdf pdf-am ps ps-am tags-am test-am \
488479 test-local uninstall uninstall-am
489480
490 .PRECIOUS: Makefile
491
492481
493482 # Tell versions [3.59,3.63) of GNU make to not export all variables.
494483 # Otherwise a system limit (for SysV at least) may be exceeded.
0 # Makefile.in generated by automake 1.15.1 from Makefile.am.
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1313
1414 @SET_MAKE@
1515 VPATH = @srcdir@
16 am__is_gnu_make = { \
17 if test -z '$(MAKELEVEL)'; then \
18 false; \
19 elif test -n '$(MAKE_HOST)'; then \
20 true; \
21 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
22 true; \
23 else \
24 false; \
25 fi; \
26 }
16 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
2717 am__make_running_with_option = \
2818 case $${target_option-} in \
2919 ?) ;; \
8878 host_triplet = @host@
8979 target_triplet = @target@
9080 subdir = fuzzing
81 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
9182 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
92 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
83 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
84 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
9385 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
9486 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
9587 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
9688 $(top_srcdir)/configure.ac
9789 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
9890 $(ACLOCAL_M4)
99 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
10091 mkinstalldirs = $(install_sh) -d
10192 CONFIG_HEADER = $(top_builddir)/config.h
10293 CONFIG_CLEAN_FILES =
122113 esac
123114 am__extra_recursive_targets = format-recursive test-recursive
124115 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
125 am__DIST_COMMON = $(srcdir)/Makefile.in
126116 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
127117 ACLOCAL = @ACLOCAL@
128118 AMTAR = @AMTAR@
159149 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
160150 EXEEXT = @EXEEXT@
161151 FGREP = @FGREP@
152 FUZZING_ENGINE = @FUZZING_ENGINE@
162153 GO = @GO@
163154 GREP = @GREP@
164155 HAVE_CXX11 = @HAVE_CXX11@
180171 LIPO = @LIPO@
181172 LN_S = @LN_S@
182173 LTLIBOBJS = @LTLIBOBJS@
183 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
184174 MAKEINFO = @MAKEINFO@
185175 MANIFEST_TOOL = @MANIFEST_TOOL@
186176 MKDIR_P = @MKDIR_P@
208198 SHELL = @SHELL@
209199 STRIP = @STRIP@
210200 VERSION = @VERSION@
201 WITH_EXAMPLES = @WITH_EXAMPLES@
211202 abs_builddir = @abs_builddir@
212203 abs_srcdir = @abs_srcdir@
213204 abs_top_builddir = @abs_top_builddir@
267258 prefix = @prefix@
268259 program_transform_name = @program_transform_name@
269260 psdir = @psdir@
270 runstatedir = @runstatedir@
271261 sbindir = @sbindir@
272262 sharedstatedir = @sharedstatedir@
273263 srcdir = @srcdir@
301291 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign fuzzing/Makefile'; \
302292 $(am__cd) $(top_srcdir) && \
303293 $(AUTOMAKE) --foreign fuzzing/Makefile
294 .PRECIOUS: Makefile
304295 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
305296 @case '$?' in \
306297 *config.status*) \
486477 mostlyclean-libtool pdf pdf-am ps ps-am tags-am test-am \
487478 test-local uninstall uninstall-am
488479
489 .PRECIOUS: Makefile
490
491480
492481 # Tell versions [3.59,3.63) of GNU make to not export all variables.
493482 # Otherwise a system limit (for SysV at least) may be exceeded.
66 libpixbufloader_heif_la_DEPENDENCIES = ../libheif/libheif.la
77 libpixbufloader_heif_la_CFLAGS = -I$(top_srcdir) -I$(top_builddir) $(gdkpixbuf_CFLAGS)
88 libpixbufloader_heif_la_LIBADD = ../libheif/libheif.la $(gdkpixbuf_LIBS)
9 libpixbufloader_heif_la_LDFLAGS = -avoid-version
910 libpixbufloader_heif_la_SOURCES = pixbufloader-heif.c
1011 endif
1112
0 # Makefile.in generated by automake 1.15.1 from Makefile.am.
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1414 @SET_MAKE@
1515
1616 VPATH = @srcdir@
17 am__is_gnu_make = { \
18 if test -z '$(MAKELEVEL)'; then \
19 false; \
20 elif test -n '$(MAKE_HOST)'; then \
21 true; \
22 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
23 true; \
24 else \
25 false; \
26 fi; \
27 }
17 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
2818 am__make_running_with_option = \
2919 case $${target_option-} in \
3020 ?) ;; \
9080 target_triplet = @target@
9181 @HAVE_GDKPIXBUF2_TRUE@am__append_1 = libpixbufloader-heif.la
9282 subdir = gdk-pixbuf
83 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
84 $(top_srcdir)/depcomp
9385 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
94 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
86 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
87 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
9588 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
9689 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
9790 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
9891 $(top_srcdir)/configure.ac
9992 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
10093 $(ACLOCAL_M4)
101 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
10294 mkinstalldirs = $(install_sh) -d
10395 CONFIG_HEADER = $(top_builddir)/config.h
10496 CONFIG_CLEAN_FILES =
143135 am__v_lt_1 =
144136 libpixbufloader_heif_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
145137 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
146 $(libpixbufloader_heif_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
147 $(LDFLAGS) -o $@
138 $(libpixbufloader_heif_la_CFLAGS) $(CFLAGS) \
139 $(libpixbufloader_heif_la_LDFLAGS) $(LDFLAGS) -o $@
148140 @HAVE_GDKPIXBUF2_TRUE@am_libpixbufloader_heif_la_rpath = -rpath \
149141 @HAVE_GDKPIXBUF2_TRUE@ $(gdk_pixbuf_moduledir)
150142 AM_V_P = $(am__v_P_@AM_V@)
208200 done | $(am__uniquify_input)`
209201 ETAGS = etags
210202 CTAGS = ctags
211 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
212203 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
213204 ACLOCAL = @ACLOCAL@
214205 AMTAR = @AMTAR@
245236 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
246237 EXEEXT = @EXEEXT@
247238 FGREP = @FGREP@
239 FUZZING_ENGINE = @FUZZING_ENGINE@
248240 GO = @GO@
249241 GREP = @GREP@
250242 HAVE_CXX11 = @HAVE_CXX11@
266258 LIPO = @LIPO@
267259 LN_S = @LN_S@
268260 LTLIBOBJS = @LTLIBOBJS@
269 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
270261 MAKEINFO = @MAKEINFO@
271262 MANIFEST_TOOL = @MANIFEST_TOOL@
272263 MKDIR_P = @MKDIR_P@
294285 SHELL = @SHELL@
295286 STRIP = @STRIP@
296287 VERSION = @VERSION@
288 WITH_EXAMPLES = @WITH_EXAMPLES@
297289 abs_builddir = @abs_builddir@
298290 abs_srcdir = @abs_srcdir@
299291 abs_top_builddir = @abs_top_builddir@
353345 prefix = @prefix@
354346 program_transform_name = @program_transform_name@
355347 psdir = @psdir@
356 runstatedir = @runstatedir@
357348 sbindir = @sbindir@
358349 sharedstatedir = @sharedstatedir@
359350 srcdir = @srcdir@
373364 @HAVE_GDKPIXBUF2_TRUE@libpixbufloader_heif_la_DEPENDENCIES = ../libheif/libheif.la
374365 @HAVE_GDKPIXBUF2_TRUE@libpixbufloader_heif_la_CFLAGS = -I$(top_srcdir) -I$(top_builddir) $(gdkpixbuf_CFLAGS)
375366 @HAVE_GDKPIXBUF2_TRUE@libpixbufloader_heif_la_LIBADD = ../libheif/libheif.la $(gdkpixbuf_LIBS)
367 @HAVE_GDKPIXBUF2_TRUE@libpixbufloader_heif_la_LDFLAGS = -avoid-version
376368 @HAVE_GDKPIXBUF2_TRUE@libpixbufloader_heif_la_SOURCES = pixbufloader-heif.c
377369 EXTRA_DIST = CMakeLists.txt
378370 all: all-am
391383 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gdk-pixbuf/Makefile'; \
392384 $(am__cd) $(top_srcdir) && \
393385 $(AUTOMAKE) --foreign gdk-pixbuf/Makefile
386 .PRECIOUS: Makefile
394387 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
395388 @case '$?' in \
396389 *config.status*) \
710703 pdf pdf-am ps ps-am tags tags-am test-am test-local uninstall \
711704 uninstall-am uninstall-gdk_pixbuf_moduleLTLIBRARIES
712705
713 .PRECIOUS: Makefile
714
715706
716707 # Tell versions [3.59,3.63) of GNU make to not export all variables.
717708 # Otherwise a system limit (for SysV at least) may be exceeded.
5656 HeifPixbufCtx* hpc;
5757 struct heif_error err;
5858 struct heif_context* hc;
59 struct heif_image_handle* hdl;
60 struct heif_image* img;
59 struct heif_image_handle* hdl = NULL;
60 struct heif_image* img = NULL;
6161 int width, height, stride;
6262 int requested_width, requested_height;
6363 const uint8_t* data;
117117 result = TRUE;
118118
119119 cleanup:
120 if(img)
121 heif_image_release(img);
122 if(hdl)
123 heif_image_handle_release(hdl);
120124 if(!result)
121125 heif_context_free(hc);
122126
0 # Makefile.in generated by automake 1.15.1 from Makefile.am.
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1414 @SET_MAKE@
1515
1616 VPATH = @srcdir@
17 am__is_gnu_make = { \
18 if test -z '$(MAKELEVEL)'; then \
19 false; \
20 elif test -n '$(MAKE_HOST)'; then \
21 true; \
22 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
23 true; \
24 else \
25 false; \
26 fi; \
27 }
17 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
2818 am__make_running_with_option = \
2919 case $${target_option-} in \
3020 ?) ;; \
8979 host_triplet = @host@
9080 target_triplet = @target@
9181 subdir = gnome
82 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
9283 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
93 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
84 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
85 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
9486 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
9587 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
9688 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
9789 $(top_srcdir)/configure.ac
9890 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
9991 $(ACLOCAL_M4)
100 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
10192 mkinstalldirs = $(install_sh) -d
10293 CONFIG_HEADER = $(top_builddir)/config.h
10394 CONFIG_CLEAN_FILES =
153144 DATA = $(mime__DATA) $(thumbnailer__DATA)
154145 am__extra_recursive_targets = format-recursive test-recursive
155146 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
156 am__DIST_COMMON = $(srcdir)/Makefile.in
157147 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
158148 ACLOCAL = @ACLOCAL@
159149 AMTAR = @AMTAR@
190180 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
191181 EXEEXT = @EXEEXT@
192182 FGREP = @FGREP@
183 FUZZING_ENGINE = @FUZZING_ENGINE@
193184 GO = @GO@
194185 GREP = @GREP@
195186 HAVE_CXX11 = @HAVE_CXX11@
211202 LIPO = @LIPO@
212203 LN_S = @LN_S@
213204 LTLIBOBJS = @LTLIBOBJS@
214 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
215205 MAKEINFO = @MAKEINFO@
216206 MANIFEST_TOOL = @MANIFEST_TOOL@
217207 MKDIR_P = @MKDIR_P@
239229 SHELL = @SHELL@
240230 STRIP = @STRIP@
241231 VERSION = @VERSION@
232 WITH_EXAMPLES = @WITH_EXAMPLES@
242233 abs_builddir = @abs_builddir@
243234 abs_srcdir = @abs_srcdir@
244235 abs_top_builddir = @abs_top_builddir@
298289 prefix = @prefix@
299290 program_transform_name = @program_transform_name@
300291 psdir = @psdir@
301 runstatedir = @runstatedir@
302292 sbindir = @sbindir@
303293 sharedstatedir = @sharedstatedir@
304294 srcdir = @srcdir@
336326 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gnome/Makefile'; \
337327 $(am__cd) $(top_srcdir) && \
338328 $(AUTOMAKE) --foreign gnome/Makefile
329 .PRECIOUS: Makefile
339330 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
340331 @case '$?' in \
341332 *config.status*) \
567558 ps ps-am tags-am test-am test-local uninstall uninstall-am \
568559 uninstall-mime_DATA uninstall-thumbnailer_DATA
569560
570 .PRECIOUS: Makefile
571
572561
573562 # Tell versions [3.59,3.63) of GNU make to not export all variables.
574563 # Otherwise a system limit (for SysV at least) may be exceeded.
0 # Makefile.in generated by automake 1.15.1 from Makefile.am.
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1313
1414 @SET_MAKE@
1515 VPATH = @srcdir@
16 am__is_gnu_make = { \
17 if test -z '$(MAKELEVEL)'; then \
18 false; \
19 elif test -n '$(MAKE_HOST)'; then \
20 true; \
21 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
22 true; \
23 else \
24 false; \
25 fi; \
26 }
16 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
2717 am__make_running_with_option = \
2818 case $${target_option-} in \
2919 ?) ;; \
8878 host_triplet = @host@
8979 target_triplet = @target@
9080 subdir = go
81 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
9182 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
92 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
83 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
84 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
9385 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
9486 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
9587 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
9688 $(top_srcdir)/configure.ac
9789 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
9890 $(ACLOCAL_M4)
99 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
10091 mkinstalldirs = $(install_sh) -d
10192 CONFIG_HEADER = $(top_builddir)/config.h
10293 CONFIG_CLEAN_FILES =
122113 esac
123114 am__extra_recursive_targets = format-recursive test-recursive
124115 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
125 am__DIST_COMMON = $(srcdir)/Makefile.in
126116 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
127117 ACLOCAL = @ACLOCAL@
128118 AMTAR = @AMTAR@
159149 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
160150 EXEEXT = @EXEEXT@
161151 FGREP = @FGREP@
152 FUZZING_ENGINE = @FUZZING_ENGINE@
162153 GO = @GO@
163154 GREP = @GREP@
164155 HAVE_CXX11 = @HAVE_CXX11@
180171 LIPO = @LIPO@
181172 LN_S = @LN_S@
182173 LTLIBOBJS = @LTLIBOBJS@
183 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
184174 MAKEINFO = @MAKEINFO@
185175 MANIFEST_TOOL = @MANIFEST_TOOL@
186176 MKDIR_P = @MKDIR_P@
208198 SHELL = @SHELL@
209199 STRIP = @STRIP@
210200 VERSION = @VERSION@
201 WITH_EXAMPLES = @WITH_EXAMPLES@
211202 abs_builddir = @abs_builddir@
212203 abs_srcdir = @abs_srcdir@
213204 abs_top_builddir = @abs_top_builddir@
267258 prefix = @prefix@
268259 program_transform_name = @program_transform_name@
269260 psdir = @psdir@
270 runstatedir = @runstatedir@
271261 sbindir = @sbindir@
272262 sharedstatedir = @sharedstatedir@
273263 srcdir = @srcdir@
302292 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign go/Makefile'; \
303293 $(am__cd) $(top_srcdir) && \
304294 $(AUTOMAKE) --foreign go/Makefile
295 .PRECIOUS: Makefile
305296 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
306297 @case '$?' in \
307298 *config.status*) \
487478 mostlyclean-libtool pdf pdf-am ps ps-am tags-am test-am \
488479 test-local uninstall uninstall-am
489480
490 .PRECIOUS: Makefile
491
492481
493482 gopath:
494483 ln -sf ${CURDIR} ${CURDIR}/src
222222 SuberrorUnknownColorProfileType = C.heif_suberror_Unknown_color_profile_type
223223
224224 SuberrorWrongTileImageChromaFormat = C.heif_suberror_Wrong_tile_image_chroma_format
225
226 SuberrorInvalidFractionalNumber = C.heif_suberror_Invalid_fractional_number
227
228 SuberrorInvalidImageSize = C.heif_suberror_Invalid_image_size
225229
226230 // --- Memory_allocation_error ---
227231
00 #!/bin/sh
11 # install - install a program, script, or datafile
22
3 scriptversion=2014-09-12.12; # UTC
3 scriptversion=2011-11-20.07; # UTC
44
55 # This originates from X11R5 (mit/util/scripts/install.sh), which was
66 # later released in X11R6 (xc/config/util/install.sh) with the
4040 # This script is compatible with the BSD install script, but was written
4141 # from scratch.
4242
43 tab=' '
4443 nl='
4544 '
46 IFS=" $tab$nl"
47
48 # Set DOITPROG to "echo" to test this script.
49
45 IFS=" "" $nl"
46
47 # set DOITPROG to echo to test this script
48
49 # Don't use :- since 4.3BSD and earlier shells don't like it.
5050 doit=${DOITPROG-}
51 doit_exec=${doit:-exec}
51 if test -z "$doit"; then
52 doit_exec=exec
53 else
54 doit_exec=$doit
55 fi
5256
5357 # Put in absolute file names if you don't have them in your path;
5458 # or use environment vars.
6367 rmprog=${RMPROG-rm}
6468 stripprog=${STRIPPROG-strip}
6569
70 posix_glob='?'
71 initialize_posix_glob='
72 test "$posix_glob" != "?" || {
73 if (set -f) 2>/dev/null; then
74 posix_glob=
75 else
76 posix_glob=:
77 fi
78 }
79 '
80
6681 posix_mkdir=
6782
6883 # Desired mode of installed file.
8196 dst_arg=
8297
8398 copy_on_change=false
84 is_target_a_directory=possibly
99 no_target_directory=
85100
86101 usage="\
87102 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
121136 -d) dir_arg=true;;
122137
123138 -g) chgrpcmd="$chgrpprog $2"
124 shift;;
139 shift;;
125140
126141 --help) echo "$usage"; exit $?;;
127142
128143 -m) mode=$2
129 case $mode in
130 *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
131 echo "$0: invalid mode: $mode" >&2
132 exit 1;;
133 esac
134 shift;;
144 case $mode in
145 *' '* | *' '* | *'
146 '* | *'*'* | *'?'* | *'['*)
147 echo "$0: invalid mode: $mode" >&2
148 exit 1;;
149 esac
150 shift;;
135151
136152 -o) chowncmd="$chownprog $2"
137 shift;;
153 shift;;
138154
139155 -s) stripcmd=$stripprog;;
140156
141 -t)
142 is_target_a_directory=always
143 dst_arg=$2
144 # Protect names problematic for 'test' and other utilities.
145 case $dst_arg in
146 -* | [=\(\)!]) dst_arg=./$dst_arg;;
147 esac
148 shift;;
149
150 -T) is_target_a_directory=never;;
157 -t) dst_arg=$2
158 # Protect names problematic for 'test' and other utilities.
159 case $dst_arg in
160 -* | [=\(\)!]) dst_arg=./$dst_arg;;
161 esac
162 shift;;
163
164 -T) no_target_directory=true;;
151165
152166 --version) echo "$0 $scriptversion"; exit $?;;
153167
154 --) shift
155 break;;
156
157 -*) echo "$0: invalid option: $1" >&2
158 exit 1;;
168 --) shift
169 break;;
170
171 -*) echo "$0: invalid option: $1" >&2
172 exit 1;;
159173
160174 *) break;;
161175 esac
162176 shift
163177 done
164
165 # We allow the use of options -d and -T together, by making -d
166 # take the precedence; this is for compatibility with GNU install.
167
168 if test -n "$dir_arg"; then
169 if test -n "$dst_arg"; then
170 echo "$0: target directory not allowed when installing a directory." >&2
171 exit 1
172 fi
173 fi
174178
175179 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
176180 # When -d is used, all remaining arguments are directories to create.
203207 fi
204208
205209 if test -z "$dir_arg"; then
206 if test $# -gt 1 || test "$is_target_a_directory" = always; then
207 if test ! -d "$dst_arg"; then
208 echo "$0: $dst_arg: Is not a directory." >&2
209 exit 1
210 fi
211 fi
212 fi
213
214 if test -z "$dir_arg"; then
215210 do_exit='(exit $ret); exit $ret'
216211 trap "ret=129; $do_exit" 1
217212 trap "ret=130; $do_exit" 2
227222
228223 *[0-7])
229224 if test -z "$stripcmd"; then
230 u_plus_rw=
225 u_plus_rw=
231226 else
232 u_plus_rw='% 200'
227 u_plus_rw='% 200'
233228 fi
234229 cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
235230 *)
236231 if test -z "$stripcmd"; then
237 u_plus_rw=
232 u_plus_rw=
238233 else
239 u_plus_rw=,u+rw
234 u_plus_rw=,u+rw
240235 fi
241236 cp_umask=$mode$u_plus_rw;;
242237 esac
273268 # If destination is a directory, append the input filename; won't work
274269 # if double slashes aren't ignored.
275270 if test -d "$dst"; then
276 if test "$is_target_a_directory" = never; then
277 echo "$0: $dst_arg: Is a directory" >&2
278 exit 1
271 if test -n "$no_target_directory"; then
272 echo "$0: $dst_arg: Is a directory" >&2
273 exit 1
279274 fi
280275 dstdir=$dst
281276 dst=$dstdir/`basename "$src"`
282277 dstdir_status=0
283278 else
284 dstdir=`dirname "$dst"`
279 # Prefer dirname, but fall back on a substitute if dirname fails.
280 dstdir=`
281 (dirname "$dst") 2>/dev/null ||
282 expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
283 X"$dst" : 'X\(//\)[^/]' \| \
284 X"$dst" : 'X\(//\)$' \| \
285 X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
286 echo X"$dst" |
287 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
288 s//\1/
289 q
290 }
291 /^X\(\/\/\)[^/].*/{
292 s//\1/
293 q
294 }
295 /^X\(\/\/\)$/{
296 s//\1/
297 q
298 }
299 /^X\(\/\).*/{
300 s//\1/
301 q
302 }
303 s/.*/./; q'
304 `
305
285306 test -d "$dstdir"
286307 dstdir_status=$?
287308 fi
292313 if test $dstdir_status != 0; then
293314 case $posix_mkdir in
294315 '')
295 # Create intermediate dirs using mode 755 as modified by the umask.
296 # This is like FreeBSD 'install' as of 1997-10-28.
297 umask=`umask`
298 case $stripcmd.$umask in
299 # Optimize common cases.
300 *[2367][2367]) mkdir_umask=$umask;;
301 .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
302
303 *[0-7])
304 mkdir_umask=`expr $umask + 22 \
305 - $umask % 100 % 40 + $umask % 20 \
306 - $umask % 10 % 4 + $umask % 2
307 `;;
308 *) mkdir_umask=$umask,go-w;;
309 esac
310
311 # With -d, create the new directory with the user-specified mode.
312 # Otherwise, rely on $mkdir_umask.
313 if test -n "$dir_arg"; then
314 mkdir_mode=-m$mode
315 else
316 mkdir_mode=
317 fi
318
319 posix_mkdir=false
320 case $umask in
321 *[123567][0-7][0-7])
322 # POSIX mkdir -p sets u+wx bits regardless of umask, which
323 # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
324 ;;
325 *)
326 # $RANDOM is not portable (e.g. dash); use it when possible to
327 # lower collision chance
328 tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
329 trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
330
331 # As "mkdir -p" follows symlinks and we work in /tmp possibly; so
332 # create the $tmpdir first (and fail if unsuccessful) to make sure
333 # that nobody tries to guess the $tmpdir name.
334 if (umask $mkdir_umask &&
335 $mkdirprog $mkdir_mode "$tmpdir" &&
336 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
337 then
338 if test -z "$dir_arg" || {
339 # Check for POSIX incompatibilities with -m.
340 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
341 # other-writable bit of parent directory when it shouldn't.
342 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
343 test_tmpdir="$tmpdir/a"
344 ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
345 case $ls_ld_tmpdir in
346 d????-?r-*) different_mode=700;;
347 d????-?--*) different_mode=755;;
348 *) false;;
349 esac &&
350 $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
351 ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
352 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
353 }
354 }
355 then posix_mkdir=:
356 fi
357 rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
358 else
359 # Remove any dirs left behind by ancient mkdir implementations.
360 rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
361 fi
362 trap '' 0;;
363 esac;;
316 # Create intermediate dirs using mode 755 as modified by the umask.
317 # This is like FreeBSD 'install' as of 1997-10-28.
318 umask=`umask`
319 case $stripcmd.$umask in
320 # Optimize common cases.
321 *[2367][2367]) mkdir_umask=$umask;;
322 .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
323
324 *[0-7])
325 mkdir_umask=`expr $umask + 22 \
326 - $umask % 100 % 40 + $umask % 20 \
327 - $umask % 10 % 4 + $umask % 2
328 `;;
329 *) mkdir_umask=$umask,go-w;;
330 esac
331
332 # With -d, create the new directory with the user-specified mode.
333 # Otherwise, rely on $mkdir_umask.
334 if test -n "$dir_arg"; then
335 mkdir_mode=-m$mode
336 else
337 mkdir_mode=
338 fi
339
340 posix_mkdir=false
341 case $umask in
342 *[123567][0-7][0-7])
343 # POSIX mkdir -p sets u+wx bits regardless of umask, which
344 # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
345 ;;
346 *)
347 tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
348 trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
349
350 if (umask $mkdir_umask &&
351 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
352 then
353 if test -z "$dir_arg" || {
354 # Check for POSIX incompatibilities with -m.
355 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
356 # other-writable bit of parent directory when it shouldn't.
357 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
358 ls_ld_tmpdir=`ls -ld "$tmpdir"`
359 case $ls_ld_tmpdir in
360 d????-?r-*) different_mode=700;;
361 d????-?--*) different_mode=755;;
362 *) false;;
363 esac &&
364 $mkdirprog -m$different_mode -p -- "$tmpdir" && {
365 ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
366 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
367 }
368 }
369 then posix_mkdir=:
370 fi
371 rmdir "$tmpdir/d" "$tmpdir"
372 else
373 # Remove any dirs left behind by ancient mkdir implementations.
374 rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
375 fi
376 trap '' 0;;
377 esac;;
364378 esac
365379
366380 if
367381 $posix_mkdir && (
368 umask $mkdir_umask &&
369 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
382 umask $mkdir_umask &&
383 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
370384 )
371385 then :
372386 else
376390 # directory the slow way, step by step, checking for races as we go.
377391
378392 case $dstdir in
379 /*) prefix='/';;
380 [-=\(\)!]*) prefix='./';;
381 *) prefix='';;
393 /*) prefix='/';;
394 [-=\(\)!]*) prefix='./';;
395 *) prefix='';;
382396 esac
397
398 eval "$initialize_posix_glob"
383399
384400 oIFS=$IFS
385401 IFS=/
386 set -f
402 $posix_glob set -f
387403 set fnord $dstdir
388404 shift
389 set +f
405 $posix_glob set +f
390406 IFS=$oIFS
391407
392408 prefixes=
393409
394410 for d
395411 do
396 test X"$d" = X && continue
397
398 prefix=$prefix$d
399 if test -d "$prefix"; then
400 prefixes=
401 else
402 if $posix_mkdir; then
403 (umask=$mkdir_umask &&
404 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
405 # Don't fail if two instances are running concurrently.
406 test -d "$prefix" || exit 1
407 else
408 case $prefix in
409 *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
410 *) qprefix=$prefix;;
411 esac
412 prefixes="$prefixes '$qprefix'"
413 fi
414 fi
415 prefix=$prefix/
412 test X"$d" = X && continue
413
414 prefix=$prefix$d
415 if test -d "$prefix"; then
416 prefixes=
417 else
418 if $posix_mkdir; then
419 (umask=$mkdir_umask &&
420 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
421 # Don't fail if two instances are running concurrently.
422 test -d "$prefix" || exit 1
423 else
424 case $prefix in
425 *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
426 *) qprefix=$prefix;;
427 esac
428 prefixes="$prefixes '$qprefix'"
429 fi
430 fi
431 prefix=$prefix/
416432 done
417433
418434 if test -n "$prefixes"; then
419 # Don't fail if two instances are running concurrently.
420 (umask $mkdir_umask &&
421 eval "\$doit_exec \$mkdirprog $prefixes") ||
422 test -d "$dstdir" || exit 1
423 obsolete_mkdir_used=true
435 # Don't fail if two instances are running concurrently.
436 (umask $mkdir_umask &&
437 eval "\$doit_exec \$mkdirprog $prefixes") ||
438 test -d "$dstdir" || exit 1
439 obsolete_mkdir_used=true
424440 fi
425441 fi
426442 fi
455471
456472 # If -C, don't bother to copy if it wouldn't change the file.
457473 if $copy_on_change &&
458 old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
459 new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
460 set -f &&
474 old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
475 new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
476
477 eval "$initialize_posix_glob" &&
478 $posix_glob set -f &&
461479 set X $old && old=:$2:$4:$5:$6 &&
462480 set X $new && new=:$2:$4:$5:$6 &&
463 set +f &&
481 $posix_glob set +f &&
482
464483 test "$old" = "$new" &&
465484 $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
466485 then
473492 # to itself, or perhaps because mv is so ancient that it does not
474493 # support -f.
475494 {
476 # Now remove or move aside any old file at destination location.
477 # We try this two ways since rm can't unlink itself on some
478 # systems and the destination file might be busy for other
479 # reasons. In this case, the final cleanup might fail but the new
480 # file should still install successfully.
481 {
482 test ! -f "$dst" ||
483 $doit $rmcmd -f "$dst" 2>/dev/null ||
484 { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
485 { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
486 } ||
487 { echo "$0: cannot unlink or rename $dst" >&2
488 (exit 1); exit 1
489 }
490 } &&
491
492 # Now rename the file to the real destination.
493 $doit $mvcmd "$dsttmp" "$dst"
495 # Now remove or move aside any old file at destination location.
496 # We try this two ways since rm can't unlink itself on some
497 # systems and the destination file might be busy for other
498 # reasons. In this case, the final cleanup might fail but the new
499 # file should still install successfully.
500 {
501 test ! -f "$dst" ||
502 $doit $rmcmd -f "$dst" 2>/dev/null ||
503 { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
504 { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
505 } ||
506 { echo "$0: cannot unlink or rename $dst" >&2
507 (exit 1); exit 1
508 }
509 } &&
510
511 # Now rename the file to the real destination.
512 $doit $mvcmd "$dsttmp" "$dst"
494513 }
495514 fi || exit 1
496515
1515 heif_image.h
1616 heif_hevc.h
1717 heif_hevc.cc
18 heif_colorconversion.h
19 heif_colorconversion.cc
1820 heif_plugin_registry.h
1921 heif_plugin_registry.cc
2022 heif_limits.h
5555 heif_plugin_registry.cc \
5656 heif_plugin.h \
5757 heif_plugin.cc \
58 heif_colorconversion.h \
59 heif_colorconversion.cc \
5860 logging.h
5961
6062 if HAVE_LIBDE265
102104
103105 box_fuzzer_DEPENDENCIES =
104106 box_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
105 box_fuzzer_LDFLAGS = -fsanitize=fuzzer
107 box_fuzzer_LDFLAGS = $(FUZZING_ENGINE)
106108 box_fuzzer_LDADD = $(ADDITIONAL_LIBS)
107109 box_fuzzer_SOURCES = $(libheif_la_SOURCES) box_fuzzer.cc
108110
109111 encoder_fuzzer_DEPENDENCIES =
110112 encoder_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
111 encoder_fuzzer_LDFLAGS = -fsanitize=fuzzer
113 encoder_fuzzer_LDFLAGS = $(FUZZING_ENGINE)
112114 encoder_fuzzer_LDADD = $(ADDITIONAL_LIBS)
113115 encoder_fuzzer_SOURCES = $(libheif_la_SOURCES) encoder_fuzzer.cc
114116
115117 file_fuzzer_DEPENDENCIES =
116118 file_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
117 file_fuzzer_LDFLAGS = -fsanitize=fuzzer
119 file_fuzzer_LDFLAGS = $(FUZZING_ENGINE)
118120 file_fuzzer_LDADD = $(ADDITIONAL_LIBS)
119121 file_fuzzer_SOURCES = $(libheif_la_SOURCES) file_fuzzer.cc
120122
0 # Makefile.in generated by automake 1.15.1 from Makefile.am.
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1717
1818
1919 VPATH = @srcdir@
20 am__is_gnu_make = { \
21 if test -z '$(MAKELEVEL)'; then \
22 false; \
23 elif test -n '$(MAKE_HOST)'; then \
24 true; \
25 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
26 true; \
27 else \
28 false; \
29 fi; \
30 }
20 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
3121 am__make_running_with_option = \
3222 case $${target_option-} in \
3323 ?) ;; \
10999 @ENABLE_LIBFUZZER_TRUE@@HAVE_LIBDE265_TRUE@am__append_9 = file-fuzzer
110100 @ENABLE_LIBFUZZER_TRUE@@HAVE_X265_TRUE@am__append_10 = encoder-fuzzer
111101 subdir = libheif
102 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
103 $(srcdir)/heif_version.h.in $(top_srcdir)/depcomp \
104 $(libheif_la_HEADERS) $(noinst_HEADERS)
112105 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
113 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
106 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
107 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
114108 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
115109 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
116110 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
117111 $(top_srcdir)/configure.ac
118112 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
119113 $(ACLOCAL_M4)
120 DIST_COMMON = $(srcdir)/Makefile.am $(libheif_la_HEADERS) \
121 $(noinst_HEADERS) $(am__DIST_COMMON)
122114 mkinstalldirs = $(install_sh) -d
123115 CONFIG_HEADER = $(top_builddir)/config.h
124116 CONFIG_CLEAN_FILES = heif_version.h
178170 heif_image.h heif_image.cc heif_limits.h heif.h heif.cc \
179171 heif_context.h heif_context.cc heif_hevc.h heif_hevc.cc \
180172 heif_plugin_registry.h heif_plugin_registry.cc heif_plugin.h \
181 heif_plugin.cc logging.h heif_decoder_libde265.cc \
182 heif_decoder_libde265.h heif_encoder_x265.cc \
183 heif_encoder_x265.h
173 heif_plugin.cc heif_colorconversion.h heif_colorconversion.cc \
174 logging.h heif_decoder_libde265.cc heif_decoder_libde265.h \
175 heif_encoder_x265.cc heif_encoder_x265.h
184176 @HAVE_LIBDE265_TRUE@am__objects_1 = \
185177 @HAVE_LIBDE265_TRUE@ libheif_la-heif_decoder_libde265.lo
186178 @HAVE_X265_TRUE@am__objects_2 = libheif_la-heif_encoder_x265.lo
189181 libheif_la-heif_image.lo libheif_la-heif.lo \
190182 libheif_la-heif_context.lo libheif_la-heif_hevc.lo \
191183 libheif_la-heif_plugin_registry.lo libheif_la-heif_plugin.lo \
192 $(am__objects_1) $(am__objects_2)
184 libheif_la-heif_colorconversion.lo $(am__objects_1) \
185 $(am__objects_2)
193186 libheif_la_OBJECTS = $(am_libheif_la_OBJECTS)
194187 AM_V_lt = $(am__v_lt_@AM_V@)
195188 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
207200 heif_image.h heif_image.cc heif_limits.h heif.h heif.cc \
208201 heif_context.h heif_context.cc heif_hevc.h heif_hevc.cc \
209202 heif_plugin_registry.h heif_plugin_registry.cc heif_plugin.h \
210 heif_plugin.cc logging.h heif_decoder_libde265.cc \
211 heif_decoder_libde265.h heif_encoder_x265.cc \
212 heif_encoder_x265.h box_fuzzer.cc
203 heif_plugin.cc heif_colorconversion.h heif_colorconversion.cc \
204 logging.h heif_decoder_libde265.cc heif_decoder_libde265.h \
205 heif_encoder_x265.cc heif_encoder_x265.h box_fuzzer.cc
213206 @HAVE_LIBDE265_TRUE@am__objects_3 = box_fuzzer-heif_decoder_libde265.$(OBJEXT)
214207 @HAVE_X265_TRUE@am__objects_4 = \
215208 @HAVE_X265_TRUE@ box_fuzzer-heif_encoder_x265.$(OBJEXT)
219212 box_fuzzer-heif.$(OBJEXT) box_fuzzer-heif_context.$(OBJEXT) \
220213 box_fuzzer-heif_hevc.$(OBJEXT) \
221214 box_fuzzer-heif_plugin_registry.$(OBJEXT) \
222 box_fuzzer-heif_plugin.$(OBJEXT) $(am__objects_3) \
215 box_fuzzer-heif_plugin.$(OBJEXT) \
216 box_fuzzer-heif_colorconversion.$(OBJEXT) $(am__objects_3) \
223217 $(am__objects_4)
224218 am_box_fuzzer_OBJECTS = $(am__objects_5) \
225219 box_fuzzer-box_fuzzer.$(OBJEXT)
232226 heif_file.cc heif_image.h heif_image.cc heif_limits.h heif.h \
233227 heif.cc heif_context.h heif_context.cc heif_hevc.h \
234228 heif_hevc.cc heif_plugin_registry.h heif_plugin_registry.cc \
235 heif_plugin.h heif_plugin.cc logging.h \
236 heif_decoder_libde265.cc heif_decoder_libde265.h \
237 heif_encoder_x265.cc heif_encoder_x265.h encoder_fuzzer.cc
229 heif_plugin.h heif_plugin.cc heif_colorconversion.h \
230 heif_colorconversion.cc logging.h heif_decoder_libde265.cc \
231 heif_decoder_libde265.h heif_encoder_x265.cc \
232 heif_encoder_x265.h encoder_fuzzer.cc
238233 @HAVE_LIBDE265_TRUE@am__objects_6 = encoder_fuzzer-heif_decoder_libde265.$(OBJEXT)
239234 @HAVE_X265_TRUE@am__objects_7 = \
240235 @HAVE_X265_TRUE@ encoder_fuzzer-heif_encoder_x265.$(OBJEXT)
246241 encoder_fuzzer-heif_context.$(OBJEXT) \
247242 encoder_fuzzer-heif_hevc.$(OBJEXT) \
248243 encoder_fuzzer-heif_plugin_registry.$(OBJEXT) \
249 encoder_fuzzer-heif_plugin.$(OBJEXT) $(am__objects_6) \
244 encoder_fuzzer-heif_plugin.$(OBJEXT) \
245 encoder_fuzzer-heif_colorconversion.$(OBJEXT) $(am__objects_6) \
250246 $(am__objects_7)
251247 am_encoder_fuzzer_OBJECTS = $(am__objects_8) \
252248 encoder_fuzzer-encoder_fuzzer.$(OBJEXT)
260256 heif_image.h heif_image.cc heif_limits.h heif.h heif.cc \
261257 heif_context.h heif_context.cc heif_hevc.h heif_hevc.cc \
262258 heif_plugin_registry.h heif_plugin_registry.cc heif_plugin.h \
263 heif_plugin.cc logging.h heif_decoder_libde265.cc \
264 heif_decoder_libde265.h heif_encoder_x265.cc \
265 heif_encoder_x265.h file_fuzzer.cc
259 heif_plugin.cc heif_colorconversion.h heif_colorconversion.cc \
260 logging.h heif_decoder_libde265.cc heif_decoder_libde265.h \
261 heif_encoder_x265.cc heif_encoder_x265.h file_fuzzer.cc
266262 @HAVE_LIBDE265_TRUE@am__objects_9 = file_fuzzer-heif_decoder_libde265.$(OBJEXT)
267263 @HAVE_X265_TRUE@am__objects_10 = \
268264 @HAVE_X265_TRUE@ file_fuzzer-heif_encoder_x265.$(OBJEXT)
273269 file_fuzzer-heif_context.$(OBJEXT) \
274270 file_fuzzer-heif_hevc.$(OBJEXT) \
275271 file_fuzzer-heif_plugin_registry.$(OBJEXT) \
276 file_fuzzer-heif_plugin.$(OBJEXT) $(am__objects_9) \
272 file_fuzzer-heif_plugin.$(OBJEXT) \
273 file_fuzzer-heif_colorconversion.$(OBJEXT) $(am__objects_9) \
277274 $(am__objects_10)
278275 am_file_fuzzer_OBJECTS = $(am__objects_11) \
279276 file_fuzzer-file_fuzzer.$(OBJEXT)
366363 done | $(am__uniquify_input)`
367364 ETAGS = etags
368365 CTAGS = ctags
369 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/heif_version.h.in \
370 $(top_srcdir)/depcomp
371366 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
372367 ACLOCAL = @ACLOCAL@
373368 AMTAR = @AMTAR@
404399 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
405400 EXEEXT = @EXEEXT@
406401 FGREP = @FGREP@
402 FUZZING_ENGINE = @FUZZING_ENGINE@
407403 GO = @GO@
408404 GREP = @GREP@
409405 HAVE_CXX11 = @HAVE_CXX11@
425421 LIPO = @LIPO@
426422 LN_S = @LN_S@
427423 LTLIBOBJS = @LTLIBOBJS@
428 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
429424 MAKEINFO = @MAKEINFO@
430425 MANIFEST_TOOL = @MANIFEST_TOOL@
431426 MKDIR_P = @MKDIR_P@
453448 SHELL = @SHELL@
454449 STRIP = @STRIP@
455450 VERSION = @VERSION@
451 WITH_EXAMPLES = @WITH_EXAMPLES@
456452 abs_builddir = @abs_builddir@
457453 abs_srcdir = @abs_srcdir@
458454 abs_top_builddir = @abs_top_builddir@
512508 prefix = @prefix@
513509 program_transform_name = @program_transform_name@
514510 psdir = @psdir@
515 runstatedir = @runstatedir@
516511 sbindir = @sbindir@
517512 sharedstatedir = @sharedstatedir@
518513 srcdir = @srcdir@
548543 heif_image.h heif_image.cc heif_limits.h heif.h heif.cc \
549544 heif_context.h heif_context.cc heif_hevc.h heif_hevc.cc \
550545 heif_plugin_registry.h heif_plugin_registry.cc heif_plugin.h \
551 heif_plugin.cc logging.h $(am__append_4) $(am__append_5)
546 heif_plugin.cc heif_colorconversion.h heif_colorconversion.cc \
547 logging.h $(am__append_4) $(am__append_5)
552548 libheif_la_HEADERS = \
553549 heif.h \
554550 heif_plugin.h \
566562
567563 box_fuzzer_DEPENDENCIES =
568564 box_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
569 box_fuzzer_LDFLAGS = -fsanitize=fuzzer
565 box_fuzzer_LDFLAGS = $(FUZZING_ENGINE)
570566 box_fuzzer_LDADD = $(ADDITIONAL_LIBS)
571567 box_fuzzer_SOURCES = $(libheif_la_SOURCES) box_fuzzer.cc
572568 encoder_fuzzer_DEPENDENCIES =
573569 encoder_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
574 encoder_fuzzer_LDFLAGS = -fsanitize=fuzzer
570 encoder_fuzzer_LDFLAGS = $(FUZZING_ENGINE)
575571 encoder_fuzzer_LDADD = $(ADDITIONAL_LIBS)
576572 encoder_fuzzer_SOURCES = $(libheif_la_SOURCES) encoder_fuzzer.cc
577573 file_fuzzer_DEPENDENCIES =
578574 file_fuzzer_CXXFLAGS = $(libde265_CFLAGS)
579 file_fuzzer_LDFLAGS = -fsanitize=fuzzer
575 file_fuzzer_LDFLAGS = $(FUZZING_ENGINE)
580576 file_fuzzer_LDADD = $(ADDITIONAL_LIBS)
581577 file_fuzzer_SOURCES = $(libheif_la_SOURCES) file_fuzzer.cc
582578 EXTRA_DIST = \
598594 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libheif/Makefile'; \
599595 $(am__cd) $(top_srcdir) && \
600596 $(AUTOMAKE) --foreign libheif/Makefile
597 .PRECIOUS: Makefile
601598 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
602599 @case '$?' in \
603600 *config.status*) \
736733 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-box_fuzzer.Po@am__quote@
737734 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-error.Po@am__quote@
738735 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif.Po@am__quote@
736 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif_colorconversion.Po@am__quote@
739737 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif_context.Po@am__quote@
740738 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif_decoder_libde265.Po@am__quote@
741739 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/box_fuzzer-heif_encoder_x265.Po@am__quote@
750748 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-encoder_fuzzer.Po@am__quote@
751749 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-error.Po@am__quote@
752750 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif.Po@am__quote@
751 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif_colorconversion.Po@am__quote@
753752 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif_context.Po@am__quote@
754753 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif_decoder_libde265.Po@am__quote@
755754 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoder_fuzzer-heif_encoder_x265.Po@am__quote@
764763 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-error.Po@am__quote@
765764 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-file_fuzzer.Po@am__quote@
766765 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif.Po@am__quote@
766 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif_colorconversion.Po@am__quote@
767767 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif_context.Po@am__quote@
768768 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif_decoder_libde265.Po@am__quote@
769769 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_fuzzer-heif_encoder_x265.Po@am__quote@
777777 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-box.Plo@am__quote@
778778 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-error.Plo@am__quote@
779779 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-heif.Plo@am__quote@
780 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-heif_colorconversion.Plo@am__quote@
780781 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-heif_context.Plo@am__quote@
781782 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-heif_decoder_libde265.Plo@am__quote@
782783 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libheif_la-heif_encoder_x265.Plo@am__quote@
880881 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
881882 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libheif_la_CPPFLAGS) $(CPPFLAGS) $(libheif_la_CXXFLAGS) $(CXXFLAGS) -c -o libheif_la-heif_plugin.lo `test -f 'heif_plugin.cc' || echo '$(srcdir)/'`heif_plugin.cc
882883
884 libheif_la-heif_colorconversion.lo: heif_colorconversion.cc
885 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libheif_la_CPPFLAGS) $(CPPFLAGS) $(libheif_la_CXXFLAGS) $(CXXFLAGS) -MT libheif_la-heif_colorconversion.lo -MD -MP -MF $(DEPDIR)/libheif_la-heif_colorconversion.Tpo -c -o libheif_la-heif_colorconversion.lo `test -f 'heif_colorconversion.cc' || echo '$(srcdir)/'`heif_colorconversion.cc
886 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libheif_la-heif_colorconversion.Tpo $(DEPDIR)/libheif_la-heif_colorconversion.Plo
887 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_colorconversion.cc' object='libheif_la-heif_colorconversion.lo' libtool=yes @AMDEPBACKSLASH@
888 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
889 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libheif_la_CPPFLAGS) $(CPPFLAGS) $(libheif_la_CXXFLAGS) $(CXXFLAGS) -c -o libheif_la-heif_colorconversion.lo `test -f 'heif_colorconversion.cc' || echo '$(srcdir)/'`heif_colorconversion.cc
890
883891 libheif_la-heif_decoder_libde265.lo: heif_decoder_libde265.cc
884892 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libheif_la_CPPFLAGS) $(CPPFLAGS) $(libheif_la_CXXFLAGS) $(CXXFLAGS) -MT libheif_la-heif_decoder_libde265.lo -MD -MP -MF $(DEPDIR)/libheif_la-heif_decoder_libde265.Tpo -c -o libheif_la-heif_decoder_libde265.lo `test -f 'heif_decoder_libde265.cc' || echo '$(srcdir)/'`heif_decoder_libde265.cc
885893 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libheif_la-heif_decoder_libde265.Tpo $(DEPDIR)/libheif_la-heif_decoder_libde265.Plo
10341042 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
10351043 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o box_fuzzer-heif_plugin.obj `if test -f 'heif_plugin.cc'; then $(CYGPATH_W) 'heif_plugin.cc'; else $(CYGPATH_W) '$(srcdir)/heif_plugin.cc'; fi`
10361044
1045 box_fuzzer-heif_colorconversion.o: heif_colorconversion.cc
1046 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT box_fuzzer-heif_colorconversion.o -MD -MP -MF $(DEPDIR)/box_fuzzer-heif_colorconversion.Tpo -c -o box_fuzzer-heif_colorconversion.o `test -f 'heif_colorconversion.cc' || echo '$(srcdir)/'`heif_colorconversion.cc
1047 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/box_fuzzer-heif_colorconversion.Tpo $(DEPDIR)/box_fuzzer-heif_colorconversion.Po
1048 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_colorconversion.cc' object='box_fuzzer-heif_colorconversion.o' libtool=no @AMDEPBACKSLASH@
1049 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1050 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o box_fuzzer-heif_colorconversion.o `test -f 'heif_colorconversion.cc' || echo '$(srcdir)/'`heif_colorconversion.cc
1051
1052 box_fuzzer-heif_colorconversion.obj: heif_colorconversion.cc
1053 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT box_fuzzer-heif_colorconversion.obj -MD -MP -MF $(DEPDIR)/box_fuzzer-heif_colorconversion.Tpo -c -o box_fuzzer-heif_colorconversion.obj `if test -f 'heif_colorconversion.cc'; then $(CYGPATH_W) 'heif_colorconversion.cc'; else $(CYGPATH_W) '$(srcdir)/heif_colorconversion.cc'; fi`
1054 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/box_fuzzer-heif_colorconversion.Tpo $(DEPDIR)/box_fuzzer-heif_colorconversion.Po
1055 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_colorconversion.cc' object='box_fuzzer-heif_colorconversion.obj' libtool=no @AMDEPBACKSLASH@
1056 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1057 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o box_fuzzer-heif_colorconversion.obj `if test -f 'heif_colorconversion.cc'; then $(CYGPATH_W) 'heif_colorconversion.cc'; else $(CYGPATH_W) '$(srcdir)/heif_colorconversion.cc'; fi`
1058
10371059 box_fuzzer-heif_decoder_libde265.o: heif_decoder_libde265.cc
10381060 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(box_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT box_fuzzer-heif_decoder_libde265.o -MD -MP -MF $(DEPDIR)/box_fuzzer-heif_decoder_libde265.Tpo -c -o box_fuzzer-heif_decoder_libde265.o `test -f 'heif_decoder_libde265.cc' || echo '$(srcdir)/'`heif_decoder_libde265.cc
10391061 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/box_fuzzer-heif_decoder_libde265.Tpo $(DEPDIR)/box_fuzzer-heif_decoder_libde265.Po
12161238 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
12171239 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o encoder_fuzzer-heif_plugin.obj `if test -f 'heif_plugin.cc'; then $(CYGPATH_W) 'heif_plugin.cc'; else $(CYGPATH_W) '$(srcdir)/heif_plugin.cc'; fi`
12181240
1241 encoder_fuzzer-heif_colorconversion.o: heif_colorconversion.cc
1242 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT encoder_fuzzer-heif_colorconversion.o -MD -MP -MF $(DEPDIR)/encoder_fuzzer-heif_colorconversion.Tpo -c -o encoder_fuzzer-heif_colorconversion.o `test -f 'heif_colorconversion.cc' || echo '$(srcdir)/'`heif_colorconversion.cc
1243 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encoder_fuzzer-heif_colorconversion.Tpo $(DEPDIR)/encoder_fuzzer-heif_colorconversion.Po
1244 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_colorconversion.cc' object='encoder_fuzzer-heif_colorconversion.o' libtool=no @AMDEPBACKSLASH@
1245 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1246 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o encoder_fuzzer-heif_colorconversion.o `test -f 'heif_colorconversion.cc' || echo '$(srcdir)/'`heif_colorconversion.cc
1247
1248 encoder_fuzzer-heif_colorconversion.obj: heif_colorconversion.cc
1249 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT encoder_fuzzer-heif_colorconversion.obj -MD -MP -MF $(DEPDIR)/encoder_fuzzer-heif_colorconversion.Tpo -c -o encoder_fuzzer-heif_colorconversion.obj `if test -f 'heif_colorconversion.cc'; then $(CYGPATH_W) 'heif_colorconversion.cc'; else $(CYGPATH_W) '$(srcdir)/heif_colorconversion.cc'; fi`
1250 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encoder_fuzzer-heif_colorconversion.Tpo $(DEPDIR)/encoder_fuzzer-heif_colorconversion.Po
1251 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_colorconversion.cc' object='encoder_fuzzer-heif_colorconversion.obj' libtool=no @AMDEPBACKSLASH@
1252 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1253 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o encoder_fuzzer-heif_colorconversion.obj `if test -f 'heif_colorconversion.cc'; then $(CYGPATH_W) 'heif_colorconversion.cc'; else $(CYGPATH_W) '$(srcdir)/heif_colorconversion.cc'; fi`
1254
12191255 encoder_fuzzer-heif_decoder_libde265.o: heif_decoder_libde265.cc
12201256 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(encoder_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT encoder_fuzzer-heif_decoder_libde265.o -MD -MP -MF $(DEPDIR)/encoder_fuzzer-heif_decoder_libde265.Tpo -c -o encoder_fuzzer-heif_decoder_libde265.o `test -f 'heif_decoder_libde265.cc' || echo '$(srcdir)/'`heif_decoder_libde265.cc
12211257 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encoder_fuzzer-heif_decoder_libde265.Tpo $(DEPDIR)/encoder_fuzzer-heif_decoder_libde265.Po
13971433 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_plugin.cc' object='file_fuzzer-heif_plugin.obj' libtool=no @AMDEPBACKSLASH@
13981434 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
13991435 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o file_fuzzer-heif_plugin.obj `if test -f 'heif_plugin.cc'; then $(CYGPATH_W) 'heif_plugin.cc'; else $(CYGPATH_W) '$(srcdir)/heif_plugin.cc'; fi`
1436
1437 file_fuzzer-heif_colorconversion.o: heif_colorconversion.cc
1438 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT file_fuzzer-heif_colorconversion.o -MD -MP -MF $(DEPDIR)/file_fuzzer-heif_colorconversion.Tpo -c -o file_fuzzer-heif_colorconversion.o `test -f 'heif_colorconversion.cc' || echo '$(srcdir)/'`heif_colorconversion.cc
1439 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/file_fuzzer-heif_colorconversion.Tpo $(DEPDIR)/file_fuzzer-heif_colorconversion.Po
1440 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_colorconversion.cc' object='file_fuzzer-heif_colorconversion.o' libtool=no @AMDEPBACKSLASH@
1441 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1442 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o file_fuzzer-heif_colorconversion.o `test -f 'heif_colorconversion.cc' || echo '$(srcdir)/'`heif_colorconversion.cc
1443
1444 file_fuzzer-heif_colorconversion.obj: heif_colorconversion.cc
1445 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT file_fuzzer-heif_colorconversion.obj -MD -MP -MF $(DEPDIR)/file_fuzzer-heif_colorconversion.Tpo -c -o file_fuzzer-heif_colorconversion.obj `if test -f 'heif_colorconversion.cc'; then $(CYGPATH_W) 'heif_colorconversion.cc'; else $(CYGPATH_W) '$(srcdir)/heif_colorconversion.cc'; fi`
1446 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/file_fuzzer-heif_colorconversion.Tpo $(DEPDIR)/file_fuzzer-heif_colorconversion.Po
1447 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='heif_colorconversion.cc' object='file_fuzzer-heif_colorconversion.obj' libtool=no @AMDEPBACKSLASH@
1448 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1449 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -c -o file_fuzzer-heif_colorconversion.obj `if test -f 'heif_colorconversion.cc'; then $(CYGPATH_W) 'heif_colorconversion.cc'; else $(CYGPATH_W) '$(srcdir)/heif_colorconversion.cc'; fi`
14001450
14011451 file_fuzzer-heif_decoder_libde265.o: heif_decoder_libde265.cc
14021452 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(file_fuzzer_CXXFLAGS) $(CXXFLAGS) -MT file_fuzzer-heif_decoder_libde265.o -MD -MP -MF $(DEPDIR)/file_fuzzer-heif_decoder_libde265.Tpo -c -o file_fuzzer-heif_decoder_libde265.o `test -f 'heif_decoder_libde265.cc' || echo '$(srcdir)/'`heif_decoder_libde265.cc
16901740 uninstall-am uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
16911741 uninstall-libheif_laHEADERS
16921742
1693 .PRECIOUS: Makefile
1694
16951743
16961744 # Tell versions [3.59,3.63) of GNU make to not export all variables.
16971745 # Otherwise a system limit (for SysV at least) may be exceeded.
3939
4040
4141
42 Fraction::Fraction(int32_t num,int32_t den)
43 {
44 // Reduce resolution of fraction until we are in a safe range.
45 // We need this as adding fractions may lead to very large denominators
46 // (e.g. 0x10000 * 0x10000 > 0x100000000 -> overflow, leading to integer 0)
47
48 while (denominator > MAX_FRACTION_VALUE || denominator < -MAX_FRACTION_VALUE) {
49 numerator /= 2;
50 denominator /= 2;
51 }
52
53 while (numerator > MAX_FRACTION_VALUE || numerator < -MAX_FRACTION_VALUE) {
54 numerator /= 2;
55 denominator /= 2;
56 }
57 }
58
4259 Fraction Fraction::operator+(const Fraction& b) const
4360 {
4461 if (denominator == b.denominator) {
86103 return (numerator + denominator/2)/denominator;
87104 }
88105
106 bool Fraction::is_valid() const
107 {
108 return denominator != 0;
109 }
89110
90111 uint32_t from_fourcc(const char* string)
91112 {
139160 sstr << std::setw(2);
140161
141162 for (int i=0;i<16;i++) {
142 if (i==8 || i==12 || i==16 || i==20) {
163 if (i==4 || i==6 || i==8 || i==10) {
143164 sstr << '-';
144165 }
145166
10471068
10481069 // --- make sure that all data is available
10491070
1071 if (extent.offset > MAX_FILE_POS ||
1072 item.base_offset > MAX_FILE_POS ||
1073 extent.length > MAX_FILE_POS) {
1074 return Error(heif_error_Invalid_input,
1075 heif_suberror_Security_limit_exceeded,
1076 "iloc data pointers out of allowed range");
1077 }
1078
10501079 StreamReader::grow_status status = istr->wait_for_file_size(extent.offset + item.base_offset + extent.length);
10511080 if (status == StreamReader::size_beyond_eof) {
10521081 // Out-of-bounds
21392168 m_horizontal_offset.denominator = range.read32();
21402169 m_vertical_offset.numerator = range.read32();
21412170 m_vertical_offset.denominator = range.read32();
2171 if (!m_clean_aperture_width.is_valid() || !m_clean_aperture_height.is_valid() ||
2172 !m_horizontal_offset.is_valid() || !m_vertical_offset.is_valid()) {
2173 return Error(heif_error_Invalid_input,
2174 heif_suberror_Invalid_fractional_number);
2175 }
21422176
21432177 return range.get_error();
21442178 }
26862720
26872721
26882722 // move to start of data
2723 if (start > (uint64_t)m_data_start_pos + get_box_size()) {
2724 return Error(heif_error_Invalid_input,
2725 heif_suberror_End_of_data);
2726 } else if (length > get_box_size() || start + length > get_box_size()) {
2727 return Error(heif_error_Invalid_input,
2728 heif_suberror_End_of_data);
2729 }
26892730
26902731 StreamReader::grow_status status = istr->wait_for_file_size((int64_t)m_data_start_pos + start + length);
26912732 if (status == StreamReader::size_beyond_eof ||
6565 class Fraction {
6666 public:
6767 Fraction() { }
68 Fraction(int num,int den) : numerator(num), denominator(den) { }
68 Fraction(int32_t num,int32_t den);
6969
7070 Fraction operator+(const Fraction&) const;
7171 Fraction operator-(const Fraction&) const;
7272 Fraction operator-(int) const;
7373 Fraction operator/(int) const;
7474
75 int round_down() const;
76 int round_up() const;
77 int round() const;
78
79 int numerator = 0;
80 int denominator = 1;
75 int32_t round_down() const;
76 int32_t round_up() const;
77 int32_t round() const;
78
79 bool is_valid() const;
80
81 int32_t numerator = 0;
82 int32_t denominator = 1;
8183 };
8284
8385
8486 class BoxHeader {
8587 public:
8688 BoxHeader();
87 ~BoxHeader() { }
89 virtual ~BoxHeader() { }
8890
8991 constexpr static uint64_t size_until_end_of_file = 0;
9092
147149 class Box : public BoxHeader {
148150 public:
149151 Box() { }
150 Box(const BoxHeader& hdr) : BoxHeader(hdr) { }
151 virtual ~Box() { }
152 Box(const BoxHeader& hdr) : BoxHeader(hdr) { }
152153
153154 static Error read(BitstreamRange& range, std::shared_ptr<heif::Box>* box);
154155
289290 };
290291
291292 struct Item {
292 heif_item_id item_ID;
293 heif_item_id item_ID = 0;
293294 uint8_t construction_method = 0; // >= version 1
294295 uint16_t data_reference_index = 0;
295296 uint64_t base_offset = 0;
1919
2020 #include <assert.h>
2121 #include <string.h>
22 #include <stdlib.h>
2223
2324 #include <memory>
2425
9797 case heif_suberror_No_or_invalid_primary_item: return "No or invalid primary item";
9898 case heif_suberror_Unknown_color_profile_type: return "Unknown color profile type";
9999 case heif_suberror_Wrong_tile_image_chroma_format: return "Wrong tile image chroma format";
100 case heif_suberror_Invalid_fractional_number: return "Invalid fractional number";
101 case heif_suberror_Invalid_image_size: return "Invalid image size";
100102
101103 // --- Memory_allocation_error ---
102104
5151 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
5252 struct heif_context* ctx;
5353 struct heif_error err;
54 struct heif_image_handle* handle;
54 struct heif_image_handle* primary_handle;
5555 int images_count;
5656 heif_item_id* image_IDs = NULL;
5757
6363 goto quit;
6464 }
6565
66 err = heif_context_get_primary_image_handle(ctx, &handle);
66 err = heif_context_get_primary_image_handle(ctx, &primary_handle);
6767 if (err.code == heif_error_Ok) {
68 assert(heif_image_handle_is_primary_image(handle));
69 TestDecodeImage(ctx, handle);
70 heif_image_handle_release(handle);
68 assert(heif_image_handle_is_primary_image(primary_handle));
69 TestDecodeImage(ctx, primary_handle);
70 heif_image_handle_release(primary_handle);
7171 }
7272
7373 images_count = heif_context_get_number_of_top_level_images(ctx);
8585 }
8686
8787 for (int i = 0; i < images_count; ++i) {
88 err = heif_context_get_image_handle(ctx, image_IDs[i], &handle);
88 struct heif_image_handle* image_handle;
89 err = heif_context_get_image_handle(ctx, image_IDs[i], &image_handle);
8990 if (err.code != heif_error_Ok) {
9091 // Ignore, we are only interested in crashes here.
9192 continue;
9293 }
9394
94 TestDecodeImage(ctx, handle);
95 TestDecodeImage(ctx, image_handle);
9596
96 int num_thumbnails = heif_image_handle_get_number_of_thumbnails(handle);
97 int num_thumbnails = heif_image_handle_get_number_of_thumbnails(image_handle);
9798 for (int t = 0; t < num_thumbnails; ++t) {
9899 struct heif_image_handle* thumbnail_handle = nullptr;
99 heif_image_handle_get_thumbnail(handle, t, &thumbnail_handle);
100 heif_image_handle_get_thumbnail(image_handle, t, &thumbnail_handle);
100101 if (thumbnail_handle) {
101102 TestDecodeImage(ctx, thumbnail_handle);
102103 heif_image_handle_release(thumbnail_handle);
103104 }
104105 }
105106
106 heif_image_handle_release(handle);
107 heif_image_handle_release(image_handle);
107108 }
108109
109110 quit:
158158 else if (strcmp(brand, "mif1")==0) {
159159 return heif_mif1;
160160 }
161 else if (strcmp(brand, "msf1")==0) {
162 return heif_msf1;
163 }
161164 else {
162165 return heif_unknown_brand;
166 }
167 }
168
169
170 enum class TriBool {
171 No, Yes, Unknown
172 };
173
174 TriBool is_jpeg(const uint8_t* data, int len) {
175 if (len < 12) {
176 return TriBool::Unknown;
177 }
178
179 if (data[0] == 0xFF && data[1] == 0xD8 && data[2] == 0xFF && data[3] == 0xE0 &&
180 data[4] == 0x00 && data[5] == 0x10 && data[6] == 0x4A && data[7] == 0x46 &&
181 data[8] == 0x49 && data[9] == 0x46 && data[10] == 0x00 && data[11] == 0x01) {
182 return TriBool::Yes;
183 }
184 if (data[0] == 0xFF && data[1] == 0xD8 && data[2] == 0xFF && data[3] == 0xE1 &&
185 data[6] == 0x45 && data[7] == 0x78 && data[8] == 0x69 && data[9] == 0x66 &&
186 data[10] == 0x00 && data[11] == 0x00) {
187 return TriBool::Yes;
188 }
189 else {
190 return TriBool::No;
191 }
192 }
193
194
195 TriBool is_png(const uint8_t* data, int len) {
196 if (len < 8) {
197 return TriBool::Unknown;
198 }
199
200 if (data[0] == 0x89 && data[1]==0x50 && data[2]==0x4E && data[3]==0x47 &&
201 data[4] == 0x0D && data[5]==0x0A && data[6]==0x1A && data[7]==0x0A) {
202 return TriBool::Yes;
203 }
204 else {
205 return TriBool::No;
206 }
207 }
208
209
210 const char* heif_get_file_mime_type(const uint8_t* data, int len)
211 {
212 heif_brand mainBrand = heif_main_brand(data,len);
213
214 if (mainBrand == heif_heic ||
215 mainBrand == heif_heix ||
216 mainBrand == heif_heim ||
217 mainBrand == heif_heis) {
218 return "image/heic";
219 }
220 else if (mainBrand == heif_mif1) {
221 return "image/heif";
222 }
223 if (mainBrand == heif_hevc ||
224 mainBrand == heif_hevx ||
225 mainBrand == heif_hevm ||
226 mainBrand == heif_hevs) {
227 return "image/heic-sequence";
228 }
229 else if (mainBrand == heif_msf1) {
230 return "image/heif-sequence";
231 }
232 else if (is_jpeg(data,len)==TriBool::Yes) {
233 return "image/jpeg";
234 }
235 else if (is_png(data,len)==TriBool::Yes) {
236 return "image/png";
237 }
238 else {
239 return "";
163240 }
164241 }
165242
314391
315392 struct heif_error heif_context_get_image_handle(struct heif_context* ctx,
316393 heif_item_id id,
317 struct heif_image_handle** img)
318 {
319 if (!img) {
394 struct heif_image_handle** imgHdl)
395 {
396 if (!imgHdl) {
320397 Error err(heif_error_Usage_error,
321398 heif_suberror_Null_pointer_argument);
322399 return err.error_struct(ctx->context.get());
337414 return err.error_struct(ctx->context.get());
338415 }
339416
340 *img = new heif_image_handle();
341 (*img)->image = image;
342 // (*img)->context = ctx->context;
417 *imgHdl = new heif_image_handle();
418 (*imgHdl)->image = image;
419 // (*imgHdl)->context = ctx->context;
343420
344421 return Error::Ok.error_struct(ctx->context.get());
345422 }
529606 {
530607 auto depth_image = handle->image->get_depth_channel();
531608
609 if (depth_image->get_id() != depth_id) {
610 *out_depth_handle = nullptr;
611
612 Error err(heif_error_Usage_error, heif_suberror_Nonexisting_item_referenced);
613 return err.error_struct(handle->image.get());
614 }
615
532616 *out_depth_handle = new heif_image_handle();
533617 (*out_depth_handle)->image = depth_image;
534
535 if (depth_image->get_id() != depth_id) {
536 Error err(heif_error_Usage_error, heif_suberror_Nonexisting_item_referenced);
537 return err.error_struct(handle->image.get());
538 }
539618
540619 return Error::Ok.error_struct(handle->image.get());
541620 }
638717
639718 int heif_image_get_bits_per_pixel(const struct heif_image* img,enum heif_channel channel)
640719 {
720 return img->image->get_storage_bits_per_pixel(channel);
721 }
722
723
724 int heif_image_get_bits_per_pixel_range(const struct heif_image* img,enum heif_channel channel)
725 {
641726 return img->image->get_bits_per_pixel(channel);
642727 }
643728
651736 struct heif_error heif_image_add_plane(struct heif_image* image,
652737 heif_channel channel, int width, int height, int bit_depth)
653738 {
654 image->image->add_plane(channel, width, height, bit_depth);
655
656 struct heif_error err = { heif_error_Ok, heif_suberror_Unspecified, Error::kSuccess };
657 return err;
739 if (!image->image->add_plane(channel, width, height, bit_depth)) {
740 struct heif_error err = { heif_error_Memory_allocation_error,
741 heif_suberror_Unspecified,
742 "Cannot allocate memory for image plane" };
743 return err;
744 }
745 else {
746 struct heif_error err = { heif_error_Ok, heif_suberror_Unspecified, Error::kSuccess };
747 return err;
748 }
658749 }
659750
660751
745836
746837 return error_Ok;
747838 }
839
840
841 /*
842 void heif_image_remove_color_profile(struct heif_image* image)
843 {
844 image->image->set_color_profile(nullptr);
845 }
846 */
748847
749848
750849 int heif_image_handle_get_number_of_metadata_blocks(const struct heif_image_handle* handle,
896995 { -1 }
897996 };
898997
899 struct heif_error heif_image_handle_get_nclx_color_profile(const struct heif_image_handle* handle,
900 struct heif_color_profile_nclx** out_data)
901 {
902 auto profile = handle->image->get_color_profile();
903 auto nclx_profile = std::dynamic_pointer_cast<const color_profile_nclx>(profile);
998
999 static Error get_nclx_color_profile(std::shared_ptr<const color_profile_nclx> nclx_profile,
1000 struct heif_color_profile_nclx** out_data)
1001 {
9041002 if (nclx_profile) {
905 if (!out_data) {
906 Error err(heif_error_Usage_error,
907 heif_suberror_Null_pointer_argument);
908 return err.error_struct(handle->image.get());
909 }
910
9111003 *out_data = (struct heif_color_profile_nclx*)malloc(sizeof(struct heif_color_profile_nclx));
9121004
9131005 struct heif_color_profile_nclx* nclx = *out_data;
9391031 nclx->color_primary_white_x = c.wx;
9401032 nclx->color_primary_white_y = c.wy;
9411033
942 return error_Ok;
943 }
944 else {
1034 return Error::Ok;
1035 }
1036 else {
1037 return Error(heif_error_Usage_error,
1038 heif_suberror_Unspecified);
1039 }
1040 }
1041
1042 struct heif_error heif_image_handle_get_nclx_color_profile(const struct heif_image_handle* handle,
1043 struct heif_color_profile_nclx** out_data)
1044 {
1045 if (!out_data) {
9451046 Error err(heif_error_Usage_error,
946 heif_suberror_Unspecified);
1047 heif_suberror_Null_pointer_argument);
9471048 return err.error_struct(handle->image.get());
9481049 }
949 }
1050
1051 auto profile = handle->image->get_color_profile();
1052 auto nclx_profile = std::dynamic_pointer_cast<const color_profile_nclx>(profile);
1053 Error err = get_nclx_color_profile(nclx_profile, out_data);
1054
1055 return err.error_struct(handle->image.get());
1056 }
1057
9501058
9511059 struct heif_error heif_image_handle_get_raw_color_profile(const struct heif_image_handle* handle,
9521060 void* out_data)
9671075
9681076 return Error::Ok.error_struct(handle->image.get());
9691077 }
1078
1079
1080
1081 enum heif_color_profile_type heif_image_get_color_profile_type(const struct heif_image* image)
1082 {
1083 auto profile = image->image->get_color_profile();
1084 if (!profile) {
1085 return heif_color_profile_type_not_present;
1086 }
1087 else {
1088 return (heif_color_profile_type)profile->get_type();
1089 }
1090 }
1091
1092
1093 size_t heif_image_get_raw_color_profile_size(const struct heif_image* image)
1094 {
1095 auto profile = image->image->get_color_profile();
1096 auto raw_profile = std::dynamic_pointer_cast<const color_profile_raw>(profile);
1097 if (raw_profile) {
1098 return raw_profile->get_data().size();
1099 }
1100 else {
1101 return 0;
1102 }
1103 }
1104
1105
1106 struct heif_error heif_image_get_raw_color_profile(const struct heif_image* image,
1107 void* out_data)
1108 {
1109 if (out_data==nullptr) {
1110 Error err(heif_error_Usage_error,
1111 heif_suberror_Null_pointer_argument);
1112 return err.error_struct(image->image.get());
1113 }
1114
1115 auto profile = image->image->get_color_profile();
1116 auto raw_profile = std::dynamic_pointer_cast<const color_profile_raw>(profile);
1117 if (raw_profile) {
1118 memcpy(out_data,
1119 raw_profile->get_data().data(),
1120 raw_profile->get_data().size());
1121 }
1122
1123 return Error::Ok.error_struct(image->image.get());
1124 }
1125
1126
1127 struct heif_error heif_image_get_nclx_color_profile(const struct heif_image* image,
1128 struct heif_color_profile_nclx** out_data)
1129 {
1130 if (!out_data) {
1131 Error err(heif_error_Usage_error,
1132 heif_suberror_Null_pointer_argument);
1133 return err.error_struct(image->image.get());
1134 }
1135
1136 auto profile = image->image->get_color_profile();
1137 auto nclx_profile = std::dynamic_pointer_cast<const color_profile_nclx>(profile);
1138 Error err = get_nclx_color_profile(nclx_profile, out_data);
1139
1140 return err.error_struct(image->image.get());
1141 }
1142
1143
1144
1145
9701146
9711147 // DEPRECATED
9721148 struct heif_error heif_register_decoder(heif_context* heif, const heif_decoder_plugin* decoder_plugin)
16131789 thumbnail_image);
16141790 if (error != Error::Ok) {
16151791 return error.error_struct(ctx->context.get());
1616 }
1617
1792 } else if (!thumbnail_image) {
1793 Error err(heif_error_Usage_error,
1794 heif_suberror_Invalid_parameter_value,
1795 "Thumbnail images must be smaller than the original image.");
1796 return err.error_struct(ctx->context.get());
1797 }
16181798
16191799 error = ctx->context->assign_thumbnail(image_handle->image, thumbnail_image);
16201800 if (error != Error::Ok) {
187187
188188 heif_suberror_Wrong_tile_image_chroma_format = 127,
189189
190 heif_suberror_Invalid_fractional_number = 128,
191
192 heif_suberror_Invalid_image_size = 129,
190193
191194 // --- Memory_allocation_error ---
192195
288291 heif_heis, // scalable
289292 heif_hevm, // multiview sequence
290293 heif_hevs, // scalable sequence
291 heif_mif1
294 heif_mif1, // image, any coding algorithm
295 heif_msf1 // sequence, any coding algorithm
292296 };
293297
294298 // input data should be at least 12 bytes
295299 LIBHEIF_API
296300 enum heif_brand heif_main_brand(const uint8_t* data, int len);
301
302
303 // Returns one of these MIME types:
304 // - image/heic HEIF file using h265 compression
305 // - image/heif HEIF file using any other compression
306 // - image/heic-sequence HEIF image sequence using h265 compression
307 // - image/heif-sequence HEIF image sequence using any other compression
308 // - image/jpeg JPEG image
309 // - image/png PNG image
310 // If the format could not be detected, an empty string is returned.
311 //
312 // Provide at least 12 bytes of input. With less input, its format might not
313 // be detected. You may also provide more input to increase detection accuracy.
314 //
315 // Note that JPEG and PNG images cannot be decoded by libheif even though the
316 // formats are detected by this function.
317 LIBHEIF_API
318 const char* heif_get_file_mime_type(const uint8_t* data, int len);
297319
298320
299321
650672 LIBHEIF_API
651673 struct heif_error heif_image_handle_get_nclx_color_profile(const struct heif_image_handle* handle,
652674 struct heif_color_profile_nclx** out_data);
675
676
677 LIBHEIF_API
678 enum heif_color_profile_type heif_image_get_color_profile_type(const struct heif_image* image);
679
680 LIBHEIF_API
681 size_t heif_image_get_raw_color_profile_size(const struct heif_image* image);
682
683 LIBHEIF_API
684 struct heif_error heif_image_get_raw_color_profile(const struct heif_image* image,
685 void* out_data);
686
687 LIBHEIF_API
688 struct heif_error heif_image_get_nclx_color_profile(const struct heif_image* image,
689 struct heif_color_profile_nclx** out_data);
690
653691
654692
655693 // ========================= heif_image =========================
773811 // Get the number of bits per pixel in the given image channel. Returns -1 if
774812 // a non-existing channel was given.
775813 // Note that the number of bits per pixel may be different for each color channel.
814 // This function returns the number of bits used for storage of each pixel.
815 // Especially for HDR images, this is probably not what you want. Have a look at
816 // heif_image_get_bits_per_pixel_range() instead.
776817 LIBHEIF_API
777818 int heif_image_get_bits_per_pixel(const struct heif_image*,enum heif_channel channel);
819
820
821 // Get the number of bits per pixel in the given image channel. This function returns
822 // the number of bits used for representing the pixel value, which might be smaller
823 // than the number of bits used in memory.
824 // For example, in 12bit HDR images, this function returns '12', while still 16 bits
825 // are reserved for storage. For interleaved RGBA with 12 bit, this function also returns
826 // '12', not '48' or '64' (heif_image_get_bits_per_pixel returns 64 in this case).
827 LIBHEIF_API
828 int heif_image_get_bits_per_pixel_range(const struct heif_image*,enum heif_channel channel);
778829
779830 LIBHEIF_API
780831 int heif_image_has_channel(const struct heif_image*, enum heif_channel channel);
814865 LIBHEIF_API
815866 struct heif_error heif_image_set_nclx_color_profile(struct heif_image* image,
816867 const struct heif_color_profile_nclx* color_profile);
868
869
870 // TODO: this function does not make any sense yet, since we currently cannot modify existing HEIF files.
871 //LIBHEIF_API
872 //void heif_image_remove_color_profile(struct heif_image* image);
817873
818874 // Release heif_image.
819875 LIBHEIF_API
11251181 enum heif_chroma chroma,
11261182 struct heif_image** out_image);
11271183
1184 // The indicated bit_depth corresponds to the bit depth per channel.
1185 // I.e. for interleaved formats like RRGGBB, the bit_depth would be, e.g., 10 bit instead
1186 // of 30 bits or 3*16=48 bits.
1187 // For backward compatibility, one can also specify 24bits for RGB and 32bits for RGBA,
1188 // instead of the preferred 8 bits.
11281189 LIBHEIF_API
11291190 struct heif_error heif_image_add_plane(struct heif_image* image,
11301191 enum heif_channel channel,
0 /*
1 * HEIF codec.
2 * Copyright (c) 2017 struktur AG, Dirk Farin <farin@struktur.de>
3 *
4 * This file is part of libheif.
5 *
6 * libheif is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of
9 * the License, or (at your option) any later version.
10 *
11 * libheif is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with libheif. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21 #include "heif_colorconversion.h"
22 #include <typeinfo>
23 #include <algorithm>
24 #include <string.h>
25 #include <assert.h>
26 #include <iostream>
27
28 using namespace heif;
29
30 #define DEBUG_ME 0
31
32
33 bool ColorState::operator==(const ColorState& b) const
34 {
35 return (colorspace == b.colorspace &&
36 chroma == b.chroma &&
37 has_alpha == b.has_alpha &&
38 bits_per_pixel == b.bits_per_pixel);
39 }
40
41
42 class Op_RGB_to_RGB24_32 : public ColorConversionOperation
43 {
44 public:
45 std::vector<ColorStateWithCost>
46 state_after_conversion(ColorState input_state,
47 ColorState target_state,
48 ColorConversionOptions options) override;
49
50 std::shared_ptr<HeifPixelImage>
51 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
52 ColorState target_state,
53 ColorConversionOptions options) override;
54 };
55
56
57
58 std::vector<ColorStateWithCost>
59 Op_RGB_to_RGB24_32::state_after_conversion(ColorState input_state,
60 ColorState target_state,
61 ColorConversionOptions options)
62 {
63 if (input_state.colorspace != heif_colorspace_RGB ||
64 input_state.chroma != heif_chroma_444 ||
65 input_state.bits_per_pixel != 8) {
66 return { };
67 }
68
69 std::vector<ColorStateWithCost> states;
70
71 ColorState output_state;
72 ColorConversionCosts costs;
73
74 // --- convert to RGBA (with alpha)
75
76 output_state.colorspace = heif_colorspace_RGB;
77 output_state.chroma = heif_chroma_interleaved_RGBA;
78 output_state.has_alpha = true;
79 output_state.bits_per_pixel = 8;
80
81 if (input_state.has_alpha == false &&
82 target_state.has_alpha == false) {
83 costs = ColorConversionCosts(0.1f, 0.0f, 0.25f);
84 }
85 else {
86 costs = ColorConversionCosts(0.1f, 0.0f, 0.0f);
87 }
88
89 states.push_back({ output_state, costs });
90
91
92 // --- convert to RGB (without alpha)
93
94 output_state.colorspace = heif_colorspace_RGB;
95 output_state.chroma = heif_chroma_interleaved_RGB;
96 output_state.has_alpha = false;
97 output_state.bits_per_pixel = 8;
98
99 if (input_state.has_alpha == true &&
100 target_state.has_alpha == true) {
101 // do not use this conversion because we would lose the alpha channel
102 }
103 else {
104 costs = ColorConversionCosts(0.2f, 0.0f, 0.0f);
105 }
106
107 states.push_back({ output_state, costs });
108
109 return states;
110 }
111
112
113 std::shared_ptr<HeifPixelImage>
114 Op_RGB_to_RGB24_32::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
115 ColorState target_state,
116 ColorConversionOptions options)
117 {
118 bool has_alpha = input->has_channel(heif_channel_Alpha);
119
120 if (input->get_bits_per_pixel(heif_channel_R) != 8 ||
121 input->get_bits_per_pixel(heif_channel_G) != 8 ||
122 input->get_bits_per_pixel(heif_channel_B) != 8) {
123 return nullptr;
124 }
125
126 if (has_alpha && input->get_bits_per_pixel(heif_channel_Alpha) != 8) {
127 return nullptr;
128 }
129
130 auto outimg = std::make_shared<HeifPixelImage>();
131
132 int width = input->get_width();
133 int height = input->get_height();
134
135 outimg->create(width, height, heif_colorspace_RGB,
136 has_alpha ? heif_chroma_interleaved_32bit : heif_chroma_interleaved_24bit);
137
138 outimg->add_plane(heif_channel_interleaved, width, height, 8);
139
140 const uint8_t *in_r,*in_g,*in_b,*in_a=nullptr;
141 int in_r_stride=0, in_g_stride=0, in_b_stride=0, in_a_stride=0;
142
143 uint8_t *out_p;
144 int out_p_stride=0;
145
146 in_r = input->get_plane(heif_channel_R, &in_r_stride);
147 in_g = input->get_plane(heif_channel_G, &in_g_stride);
148 in_b = input->get_plane(heif_channel_B, &in_b_stride);
149 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
150
151 if (has_alpha) {
152 in_a = input->get_plane(heif_channel_Alpha, &in_a_stride);
153 }
154
155 int x,y;
156 for (y=0;y<height;y++) {
157
158 if (has_alpha) {
159 for (x=0;x<width;x++) {
160 out_p[y*out_p_stride + 4*x + 0] = in_r[x + y*in_r_stride];
161 out_p[y*out_p_stride + 4*x + 1] = in_g[x + y*in_g_stride];
162 out_p[y*out_p_stride + 4*x + 2] = in_b[x + y*in_b_stride];
163 out_p[y*out_p_stride + 4*x + 3] = in_a[x + y*in_a_stride];
164 }
165 }
166 else {
167 for (x=0;x<width;x++) {
168 out_p[y*out_p_stride + 3*x + 0] = in_r[x + y*in_r_stride];
169 out_p[y*out_p_stride + 3*x + 1] = in_g[x + y*in_g_stride];
170 out_p[y*out_p_stride + 3*x + 2] = in_b[x + y*in_b_stride];
171 }
172 }
173 }
174
175 return outimg;
176 }
177
178
179
180
181
182 class Op_YCbCr420_to_RGB_8bit : public ColorConversionOperation
183 {
184 public:
185 std::vector<ColorStateWithCost>
186 state_after_conversion(ColorState input_state,
187 ColorState target_state,
188 ColorConversionOptions options) override;
189
190 std::shared_ptr<HeifPixelImage>
191 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
192 ColorState target_state,
193 ColorConversionOptions options) override;
194 };
195
196
197
198 std::vector<ColorStateWithCost>
199 Op_YCbCr420_to_RGB_8bit::state_after_conversion(ColorState input_state,
200 ColorState target_state,
201 ColorConversionOptions options)
202 {
203 if (input_state.colorspace != heif_colorspace_YCbCr ||
204 input_state.chroma != heif_chroma_420 ||
205 input_state.bits_per_pixel != 8) {
206 return { };
207 }
208
209 std::vector<ColorStateWithCost> states;
210
211 ColorState output_state;
212 ColorConversionCosts costs;
213
214 // --- convert to RGB
215
216 output_state.colorspace = heif_colorspace_RGB;
217 output_state.chroma = heif_chroma_444;
218 output_state.has_alpha = input_state.has_alpha; // we simply keep the old alpha plane
219 output_state.bits_per_pixel = 8;
220
221 costs = { 0.5f, 0.0f, 0.0f };
222
223 states.push_back({ output_state, costs });
224
225 return states;
226 }
227
228
229 static inline uint8_t clip(int x)
230 {
231 if (x<0) return 0;
232 if (x>255) return 255;
233 return static_cast<uint8_t>(x);
234 }
235
236
237 std::shared_ptr<HeifPixelImage>
238 Op_YCbCr420_to_RGB_8bit::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
239 ColorState target_state,
240 ColorConversionOptions options)
241 {
242 if (input->get_bits_per_pixel(heif_channel_Y) != 8 ||
243 input->get_bits_per_pixel(heif_channel_Cb) != 8 ||
244 input->get_bits_per_pixel(heif_channel_Cr) != 8) {
245 return nullptr;
246 }
247
248 auto outimg = std::make_shared<HeifPixelImage>();
249
250 int bpp = 8; // TODO: how do we specify the output BPPs ?
251
252 int width = input->get_width();
253 int height = input->get_height();
254
255 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_444);
256
257 outimg->add_plane(heif_channel_R, width, height, bpp);
258 outimg->add_plane(heif_channel_G, width, height, bpp);
259 outimg->add_plane(heif_channel_B, width, height, bpp);
260
261 bool has_alpha = input->has_channel(heif_channel_Alpha);
262 if (has_alpha) {
263 outimg->add_plane(heif_channel_Alpha, width, height, bpp);
264 }
265
266 const uint8_t *in_y,*in_cb,*in_cr,*in_a;
267 int in_y_stride=0, in_cb_stride=0, in_cr_stride=0, in_a_stride=0;
268
269 uint8_t *out_r,*out_g,*out_b,*out_a;
270 int out_r_stride=0, out_g_stride=0, out_b_stride=0, out_a_stride=0;
271
272 in_y = input->get_plane(heif_channel_Y, &in_y_stride);
273 in_cb = input->get_plane(heif_channel_Cb, &in_cb_stride);
274 in_cr = input->get_plane(heif_channel_Cr, &in_cr_stride);
275 out_r = outimg->get_plane(heif_channel_R, &out_r_stride);
276 out_g = outimg->get_plane(heif_channel_G, &out_g_stride);
277 out_b = outimg->get_plane(heif_channel_B, &out_b_stride);
278
279 if (has_alpha) {
280 in_a = input->get_plane(heif_channel_Alpha, &in_a_stride);
281 out_a = outimg->get_plane(heif_channel_Alpha, &out_a_stride);
282 }
283 else {
284 in_a = nullptr;
285 out_a = nullptr;
286 }
287
288 int x,y;
289 for (y=0;y<height;y++) {
290 for (x=0;x<width;x++) {
291 int yv = (in_y [y *in_y_stride + x] );
292 int cb = (in_cb[y/2*in_cb_stride + x/2]-128);
293 int cr = (in_cr[y/2*in_cr_stride + x/2]-128);
294
295 out_r[y*out_r_stride + x] = clip(yv + ((359*cr)>>8));
296 out_g[y*out_g_stride + x] = clip(yv - ((88*cb + 183*cr)>>8));
297 out_b[y*out_b_stride + x] = clip(yv + ((454*cb)>>8));
298 }
299
300 if (has_alpha) {
301 memcpy(&out_a[y*out_a_stride], &in_a[y*in_a_stride], width);
302 }
303 }
304
305 return outimg;
306 }
307
308
309 class Op_YCbCr420_to_RGB_16bit : public ColorConversionOperation
310 {
311 public:
312 std::vector<ColorStateWithCost>
313 state_after_conversion(ColorState input_state,
314 ColorState target_state,
315 ColorConversionOptions options) override;
316
317 std::shared_ptr<HeifPixelImage>
318 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
319 ColorState target_state,
320 ColorConversionOptions options) override;
321 };
322
323
324 std::vector<ColorStateWithCost>
325 Op_YCbCr420_to_RGB_16bit::state_after_conversion(ColorState input_state,
326 ColorState target_state,
327 ColorConversionOptions options)
328 {
329 if (input_state.colorspace != heif_colorspace_YCbCr ||
330 input_state.chroma != heif_chroma_420 ||
331 input_state.bits_per_pixel == 8) {
332 return { };
333 }
334
335 std::vector<ColorStateWithCost> states;
336
337 ColorState output_state;
338 ColorConversionCosts costs;
339
340 // --- convert to RGB
341
342 output_state.colorspace = heif_colorspace_RGB;
343 output_state.chroma = heif_chroma_444;
344 output_state.has_alpha = input_state.has_alpha; // we simply keep the old alpha plane
345 output_state.bits_per_pixel = input_state.bits_per_pixel;
346
347 costs = { 0.5f, 0.0f, 0.0f };
348
349 states.push_back({ output_state, costs });
350
351 return states;
352 }
353
354
355 static inline uint16_t clip(float fx,int32_t maxi)
356 {
357 int x = static_cast<int>(fx);
358 if (x<0) return 0;
359 if (x>maxi) return (uint16_t)maxi;
360 return static_cast<uint16_t>(x);
361 }
362
363
364 static inline uint16_t clip(int32_t x,int32_t maxi)
365 {
366 if (x<0) return 0;
367 if (x>maxi) return (uint16_t)maxi;
368 return static_cast<uint16_t>(x);
369 }
370
371
372 std::shared_ptr<HeifPixelImage>
373 Op_YCbCr420_to_RGB_16bit::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
374 ColorState target_state,
375 ColorConversionOptions options)
376 {
377 if (input->get_bits_per_pixel(heif_channel_Y) == 8 ||
378 input->get_bits_per_pixel(heif_channel_Cb) == 8 ||
379 input->get_bits_per_pixel(heif_channel_Cr) == 8) {
380 return nullptr;
381 }
382
383 if (input->get_bits_per_pixel(heif_channel_Y) != input->get_bits_per_pixel(heif_channel_Cb) ||
384 input->get_bits_per_pixel(heif_channel_Y) != input->get_bits_per_pixel(heif_channel_Cr)) {
385 return nullptr;
386 }
387
388
389 int width = input->get_width();
390 int height = input->get_height();
391
392 int bpp = input->get_bits_per_pixel(heif_channel_Y);
393
394 bool has_alpha = input->has_channel(heif_channel_Alpha);
395
396 if (has_alpha && input->get_bits_per_pixel(heif_channel_Alpha) != bpp) {
397 return nullptr;
398 }
399
400 auto outimg = std::make_shared<HeifPixelImage>();
401
402 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_444);
403
404 outimg->add_plane(heif_channel_R, width, height, bpp);
405 outimg->add_plane(heif_channel_G, width, height, bpp);
406 outimg->add_plane(heif_channel_B, width, height, bpp);
407
408 if (has_alpha) {
409 outimg->add_plane(heif_channel_Alpha, width, height, bpp);
410 }
411
412 const uint16_t *in_y,*in_cb,*in_cr,*in_a;
413 int in_y_stride=0, in_cb_stride=0, in_cr_stride=0, in_a_stride=0;
414
415 uint16_t *out_r,*out_g,*out_b,*out_a;
416 int out_r_stride=0, out_g_stride=0, out_b_stride=0, out_a_stride=0;
417
418 in_y = (const uint16_t*)input->get_plane(heif_channel_Y, &in_y_stride);
419 in_cb = (const uint16_t*)input->get_plane(heif_channel_Cb, &in_cb_stride);
420 in_cr = (const uint16_t*)input->get_plane(heif_channel_Cr, &in_cr_stride);
421 out_r = (uint16_t*)outimg->get_plane(heif_channel_R, &out_r_stride);
422 out_g = (uint16_t*)outimg->get_plane(heif_channel_G, &out_g_stride);
423 out_b = (uint16_t*)outimg->get_plane(heif_channel_B, &out_b_stride);
424
425 if (has_alpha) {
426 in_a = (const uint16_t*)input->get_plane(heif_channel_Alpha, &in_a_stride);
427 out_a = (uint16_t*)outimg->get_plane(heif_channel_Alpha, &out_a_stride);
428 }
429 else {
430 in_a = nullptr;
431 out_a = nullptr;
432 }
433
434 in_y_stride /= 2;
435 in_cb_stride /= 2;
436 in_cr_stride /= 2;
437 in_a_stride /= 2;
438 out_r_stride /= 2;
439 out_g_stride /= 2;
440 out_b_stride /= 2;
441 out_a_stride /= 2;
442
443 uint16_t halfRange = (uint16_t)(1<<(bpp-1));
444 int32_t fullRange = (1<<bpp)-1;
445
446 int x,y;
447 for (y=0;y<height;y++) {
448 for (x=0;x<width;x++) {
449 float yv = static_cast<float>(in_y [y *in_y_stride + x] );
450 float cb = static_cast<float>(in_cb[y/2*in_cb_stride + x/2]-halfRange);
451 float cr = static_cast<float>(in_cr[y/2*in_cr_stride + x/2]-halfRange);
452
453 out_r[y*out_r_stride + x] = (uint16_t)(clip(yv + 1.402f*cr, fullRange)); // << bdShift);
454 out_g[y*out_g_stride + x] = (uint16_t)(clip(yv - 0.344136f*cb - 0.714136f*cr, fullRange)); // << bdShift);
455 out_b[y*out_b_stride + x] = (uint16_t)(clip(yv + 1.772f*cb, fullRange)); // << bdShift);
456 }
457
458 if (has_alpha) {
459 memcpy(&out_a[y*out_a_stride], &in_a[y*in_a_stride], width *2);
460 }
461 }
462
463 return outimg;
464 }
465
466
467
468
469
470
471 class Op_RGB_HDR_to_YCbCr420 : public ColorConversionOperation
472 {
473 public:
474 std::vector<ColorStateWithCost>
475 state_after_conversion(ColorState input_state,
476 ColorState target_state,
477 ColorConversionOptions options) override;
478
479 std::shared_ptr<HeifPixelImage>
480 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
481 ColorState target_state,
482 ColorConversionOptions options) override;
483 };
484
485
486 std::vector<ColorStateWithCost>
487 Op_RGB_HDR_to_YCbCr420::state_after_conversion(ColorState input_state,
488 ColorState target_state,
489 ColorConversionOptions options)
490 {
491 if (input_state.colorspace != heif_colorspace_RGB ||
492 input_state.chroma != heif_chroma_444 ||
493 input_state.bits_per_pixel == 8) {
494 return { };
495 }
496
497 std::vector<ColorStateWithCost> states;
498
499 ColorState output_state;
500 ColorConversionCosts costs;
501
502 // --- convert to YCbCr
503
504 output_state.colorspace = heif_colorspace_YCbCr;
505 output_state.chroma = heif_chroma_420;
506 output_state.has_alpha = input_state.has_alpha; // we simply keep the old alpha plane
507 output_state.bits_per_pixel = input_state.bits_per_pixel;
508
509 costs = { 0.75f, 0.5f, 0.0f };
510
511 states.push_back({ output_state, costs });
512
513 return states;
514 }
515
516
517 std::shared_ptr<HeifPixelImage>
518 Op_RGB_HDR_to_YCbCr420::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
519 ColorState target_state,
520 ColorConversionOptions options)
521 {
522 int width = input->get_width();
523 int height = input->get_height();
524
525 int bpp = input->get_bits_per_pixel(heif_channel_R);
526
527 bool has_alpha = input->has_channel(heif_channel_Alpha);
528
529 if (has_alpha && input->get_bits_per_pixel(heif_channel_Alpha) != bpp) {
530 return nullptr;
531 }
532
533 auto outimg = std::make_shared<HeifPixelImage>();
534
535 outimg->create(width, height, heif_colorspace_YCbCr, heif_chroma_420);
536
537 int cwidth = (width+1)/2;
538 int cheight = (height+1)/2;
539
540 outimg->add_plane(heif_channel_Y, width, height, bpp);
541 outimg->add_plane(heif_channel_Cb, cwidth, cheight, bpp);
542 outimg->add_plane(heif_channel_Cr, cwidth, cheight, bpp);
543
544 if (has_alpha) {
545 outimg->add_plane(heif_channel_Alpha, width, height, bpp);
546 }
547
548 const uint16_t *in_r,*in_g,*in_b,*in_a;
549 int in_r_stride=0, in_g_stride=0, in_b_stride=0, in_a_stride=0;
550
551 uint16_t *out_y,*out_cb,*out_cr,*out_a;
552 int out_y_stride=0, out_cb_stride=0, out_cr_stride=0, out_a_stride=0;
553
554 in_r = (const uint16_t*)input->get_plane(heif_channel_R, &in_r_stride);
555 in_g = (const uint16_t*)input->get_plane(heif_channel_G, &in_g_stride);
556 in_b = (const uint16_t*)input->get_plane(heif_channel_B, &in_b_stride);
557 out_y = (uint16_t*)outimg->get_plane(heif_channel_Y, &out_y_stride);
558 out_cb = (uint16_t*)outimg->get_plane(heif_channel_Cb, &out_cb_stride);
559 out_cr = (uint16_t*)outimg->get_plane(heif_channel_Cr, &out_cr_stride);
560
561 if (has_alpha) {
562 in_a = (const uint16_t*)input->get_plane(heif_channel_Alpha, &in_a_stride);
563 out_a = (uint16_t*)outimg->get_plane(heif_channel_Alpha, &out_a_stride);
564 }
565 else {
566 in_a = nullptr;
567 out_a = nullptr;
568 }
569
570 in_r_stride /= 2;
571 in_g_stride /= 2;
572 in_b_stride /= 2;
573 in_a_stride /= 2;
574 out_y_stride /= 2;
575 out_cb_stride /= 2;
576 out_cr_stride /= 2;
577 out_a_stride /= 2;
578
579 uint16_t halfRange = (uint16_t)(1<<(bpp-1));
580 int32_t fullRange = (1<<bpp)-1;
581
582 int x,y;
583
584 for (y=0;y<height;y++) {
585 for (x=0;x<width;x++) {
586 float r = in_r[y*in_r_stride + x];
587 float g = in_g[y*in_g_stride + x];
588 float b = in_b[y*in_b_stride + x];
589
590 out_y[y*out_y_stride + x] = clip((int32_t)(r*0.299f + g*0.587f + b*0.114f), fullRange);
591 }
592 }
593
594 for (y=0;y<height;y+=2) {
595 for (x=0;x<width;x+=2) {
596 float r = in_r[y*in_r_stride + x];
597 float g = in_g[y*in_g_stride + x];
598 float b = in_b[y*in_b_stride + x];
599
600 out_cb[(y/2)*out_cb_stride + (x/2)] = clip(halfRange + (int32_t)(-r*0.168736f - g*0.331264f + b*0.5f), fullRange);
601 out_cr[(y/2)*out_cr_stride + (x/2)] = clip(halfRange + (int32_t)(r*0.5f - g*0.418688f - b*0.081312f), fullRange);
602 }
603 }
604
605 if (has_alpha) {
606 for (y=0;y<height;y++) {
607 memcpy(&out_a[y*out_a_stride], &in_a[y*in_a_stride], width*2);
608 }
609 }
610
611 return outimg;
612 }
613
614
615
616
617
618
619 class Op_YCbCr420_to_RGB24 : public ColorConversionOperation
620 {
621 public:
622 std::vector<ColorStateWithCost>
623 state_after_conversion(ColorState input_state,
624 ColorState target_state,
625 ColorConversionOptions options) override;
626
627 std::shared_ptr<HeifPixelImage>
628 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
629 ColorState target_state,
630 ColorConversionOptions options) override;
631 };
632
633
634 std::vector<ColorStateWithCost>
635 Op_YCbCr420_to_RGB24::state_after_conversion(ColorState input_state,
636 ColorState target_state,
637 ColorConversionOptions options)
638 {
639 if (input_state.colorspace != heif_colorspace_YCbCr ||
640 input_state.chroma != heif_chroma_420 ||
641 input_state.bits_per_pixel != 8 ||
642 input_state.has_alpha == true) {
643 return { };
644 }
645
646 std::vector<ColorStateWithCost> states;
647
648 ColorState output_state;
649 ColorConversionCosts costs;
650
651 // --- convert to RGB
652
653 output_state.colorspace = heif_colorspace_RGB;
654 output_state.chroma = heif_chroma_interleaved_RGB;
655 output_state.has_alpha = false;
656 output_state.bits_per_pixel = 8;
657
658 costs = { 0.5f, 0.0f, 0.0f };
659
660 states.push_back({ output_state, costs });
661
662 return states;
663 }
664
665
666 std::shared_ptr<HeifPixelImage>
667 Op_YCbCr420_to_RGB24::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
668 ColorState target_state,
669 ColorConversionOptions options)
670 {
671 if (input->get_bits_per_pixel(heif_channel_Y) != 8 ||
672 input->get_bits_per_pixel(heif_channel_Cb) != 8 ||
673 input->get_bits_per_pixel(heif_channel_Cr) != 8) {
674 return nullptr;
675 }
676
677 auto outimg = std::make_shared<HeifPixelImage>();
678
679 int width = input->get_width();
680 int height = input->get_height();
681
682 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_24bit);
683
684 outimg->add_plane(heif_channel_interleaved, width, height, 8);
685
686 const uint8_t *in_y,*in_cb,*in_cr;
687 int in_y_stride=0, in_cb_stride=0, in_cr_stride=0;
688
689 uint8_t *out_p;
690 int out_p_stride=0;
691
692 in_y = input->get_plane(heif_channel_Y, &in_y_stride);
693 in_cb = input->get_plane(heif_channel_Cb, &in_cb_stride);
694 in_cr = input->get_plane(heif_channel_Cr, &in_cr_stride);
695 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
696
697 int x,y;
698 for (y=0;y<height;y++) {
699 for (x=0;x<width;x++) {
700 int yv = (in_y [y *in_y_stride + x] );
701 int cb = (in_cb[y/2*in_cb_stride + x/2]-128);
702 int cr = (in_cr[y/2*in_cr_stride + x/2]-128);
703
704 out_p[y*out_p_stride + 3*x + 0] = clip(yv + ((359*cr)>>8));
705 out_p[y*out_p_stride + 3*x + 1] = clip(yv - ((88*cb + 183*cr)>>8));
706 out_p[y*out_p_stride + 3*x + 2] = clip(yv + ((454*cb)>>8));
707 }
708 }
709
710 return outimg;
711 }
712
713
714
715
716
717
718 class Op_YCbCr420_to_RGB32 : public ColorConversionOperation
719 {
720 public:
721 std::vector<ColorStateWithCost>
722 state_after_conversion(ColorState input_state,
723 ColorState target_state,
724 ColorConversionOptions options) override;
725
726 std::shared_ptr<HeifPixelImage>
727 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
728 ColorState target_state,
729 ColorConversionOptions options) override;
730 };
731
732
733 std::vector<ColorStateWithCost>
734 Op_YCbCr420_to_RGB32::state_after_conversion(ColorState input_state,
735 ColorState target_state,
736 ColorConversionOptions options)
737 {
738 // Note: no input alpha channel required. It will be filled up with 0xFF.
739
740 if (input_state.colorspace != heif_colorspace_YCbCr ||
741 input_state.chroma != heif_chroma_420 ||
742 input_state.bits_per_pixel != 8) {
743 return { };
744 }
745
746 std::vector<ColorStateWithCost> states;
747
748 ColorState output_state;
749 ColorConversionCosts costs;
750
751 // --- convert to RGB
752
753 output_state.colorspace = heif_colorspace_RGB;
754 output_state.chroma = heif_chroma_interleaved_RGBA;
755 output_state.has_alpha = true;
756 output_state.bits_per_pixel = 8;
757
758 costs = { 0.5f, 0.0f, 0.0f };
759
760 states.push_back({ output_state, costs });
761
762 return states;
763 }
764
765
766 std::shared_ptr<HeifPixelImage>
767 Op_YCbCr420_to_RGB32::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
768 ColorState target_state,
769 ColorConversionOptions options)
770 {
771 if (input->get_bits_per_pixel(heif_channel_Y) != 8 ||
772 input->get_bits_per_pixel(heif_channel_Cb) != 8 ||
773 input->get_bits_per_pixel(heif_channel_Cr) != 8) {
774 return nullptr;
775 }
776
777 auto outimg = std::make_shared<HeifPixelImage>();
778
779 int width = input->get_width();
780 int height = input->get_height();
781
782 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_32bit);
783
784 outimg->add_plane(heif_channel_interleaved, width, height, 8);
785
786 const bool with_alpha = input->has_channel(heif_channel_Alpha);
787
788 const uint8_t *in_y,*in_cb,*in_cr,*in_a = nullptr;
789 int in_y_stride=0, in_cb_stride=0, in_cr_stride=0, in_a_stride=0;
790
791 uint8_t *out_p;
792 int out_p_stride=0;
793
794 in_y = input->get_plane(heif_channel_Y, &in_y_stride);
795 in_cb = input->get_plane(heif_channel_Cb, &in_cb_stride);
796 in_cr = input->get_plane(heif_channel_Cr, &in_cr_stride);
797 if (with_alpha) {
798 in_a = input->get_plane(heif_channel_Alpha, &in_a_stride);
799 }
800
801 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
802
803 int x,y;
804 for (y=0;y<height;y++) {
805 for (x=0;x<width;x++) {
806
807 int yv = (in_y [y *in_y_stride + x] );
808 int cb = (in_cb[y/2*in_cb_stride + x/2]-128);
809 int cr = (in_cr[y/2*in_cr_stride + x/2]-128);
810
811 out_p[y*out_p_stride + 4*x + 0] = clip(yv + ((359*cr)>>8));
812 out_p[y*out_p_stride + 4*x + 1] = clip(yv - ((88*cb + 183*cr)>>8));
813 out_p[y*out_p_stride + 4*x + 2] = clip(yv + ((454*cb)>>8));
814
815
816 if (with_alpha) {
817 out_p[y*out_p_stride + 4*x + 3] = in_a[y*in_a_stride + x];
818 }
819 else {
820 out_p[y*out_p_stride + 4*x + 3] = 0xFF;
821 }
822 }
823 }
824
825 return outimg;
826 }
827
828
829
830
831
832 class Op_RGB_HDR_to_RRGGBBaa_BE : public ColorConversionOperation
833 {
834 public:
835 std::vector<ColorStateWithCost>
836 state_after_conversion(ColorState input_state,
837 ColorState target_state,
838 ColorConversionOptions options) override;
839
840 std::shared_ptr<HeifPixelImage>
841 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
842 ColorState target_state,
843 ColorConversionOptions options) override;
844 };
845
846
847 std::vector<ColorStateWithCost>
848 Op_RGB_HDR_to_RRGGBBaa_BE::state_after_conversion(ColorState input_state,
849 ColorState target_state,
850 ColorConversionOptions options)
851 {
852 // Note: no input alpha channel required. It will be filled up with 0xFF.
853
854 if (input_state.colorspace != heif_colorspace_RGB ||
855 input_state.chroma != heif_chroma_444 ||
856 input_state.bits_per_pixel == 8) {
857 return { };
858 }
859
860 std::vector<ColorStateWithCost> states;
861
862 ColorState output_state;
863 ColorConversionCosts costs;
864
865 // --- convert to RRGGBB_BE
866
867 if (input_state.has_alpha == false) {
868 output_state.colorspace = heif_colorspace_RGB;
869 output_state.chroma = heif_chroma_interleaved_RRGGBB_BE;
870 output_state.has_alpha = false;
871 output_state.bits_per_pixel = input_state.bits_per_pixel;
872
873 costs = { 0.5f, 0.0f, 0.0f };
874
875 states.push_back({ output_state, costs });
876 }
877
878
879 // --- convert to RRGGBBAA_BE
880
881 output_state.colorspace = heif_colorspace_RGB;
882 output_state.chroma = heif_chroma_interleaved_RRGGBBAA_BE;
883 output_state.has_alpha = true;
884 output_state.bits_per_pixel = input_state.bits_per_pixel;
885
886 costs = { 0.5f, 0.0f, 0.0f };
887
888 states.push_back({ output_state, costs });
889
890
891 return states;
892 }
893
894
895 std::shared_ptr<HeifPixelImage>
896 Op_RGB_HDR_to_RRGGBBaa_BE::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
897 ColorState target_state,
898 ColorConversionOptions options)
899 {
900 if (input->get_bits_per_pixel(heif_channel_R) == 8 ||
901 input->get_bits_per_pixel(heif_channel_G) == 8 ||
902 input->get_bits_per_pixel(heif_channel_B) == 8) {
903 return nullptr;
904 }
905
906 //int bpp = input->get_bits_per_pixel(heif_channel_R);
907
908 bool has_alpha = input->has_channel(heif_channel_Alpha);
909
910 if (has_alpha && input->get_bits_per_pixel(heif_channel_Alpha) == 8) {
911 return nullptr;
912 }
913
914 auto outimg = std::make_shared<HeifPixelImage>();
915
916 int width = input->get_width();
917 int height = input->get_height();
918
919 outimg->create(width, height, heif_colorspace_RGB,
920 target_state.has_alpha ? heif_chroma_interleaved_RRGGBBAA_BE : heif_chroma_interleaved_RRGGBB_BE);
921
922 outimg->add_plane(heif_channel_interleaved, width, height, input->get_bits_per_pixel(heif_channel_R));
923
924 const uint16_t *in_r,*in_g,*in_b,*in_a=nullptr;
925 int in_r_stride=0, in_g_stride=0, in_b_stride=0, in_a_stride=0;
926
927 uint8_t *out_p;
928 int out_p_stride=0;
929
930 in_r = (uint16_t*)input->get_plane(heif_channel_R, &in_r_stride);
931 in_g = (uint16_t*)input->get_plane(heif_channel_G, &in_g_stride);
932 in_b = (uint16_t*)input->get_plane(heif_channel_B, &in_b_stride);
933 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
934
935 if (has_alpha) {
936 in_a = (uint16_t*)input->get_plane(heif_channel_Alpha, &in_a_stride);
937 }
938
939 in_r_stride /= 2;
940 in_g_stride /= 2;
941 in_b_stride /= 2;
942 in_a_stride /= 2;
943
944 int x,y;
945 for (y=0;y<height;y++) {
946
947 if (has_alpha) {
948 for (x=0;x<width;x++) {
949 uint16_t r = in_r[x + y*in_r_stride];
950 uint16_t g = in_g[x + y*in_g_stride];
951 uint16_t b = in_b[x + y*in_b_stride];
952 uint16_t a = in_a[x + y*in_a_stride];
953 out_p[y*out_p_stride + 8*x + 0] = (uint8_t)(r>>8);
954 out_p[y*out_p_stride + 8*x + 1] = (uint8_t)(r & 0xFF);
955 out_p[y*out_p_stride + 8*x + 2] = (uint8_t)(g>>8);
956 out_p[y*out_p_stride + 8*x + 3] = (uint8_t)(g & 0xFF);
957 out_p[y*out_p_stride + 8*x + 4] = (uint8_t)(b>>8);
958 out_p[y*out_p_stride + 8*x + 5] = (uint8_t)(b & 0xFF);
959 out_p[y*out_p_stride + 8*x + 6] = (uint8_t)(a>>8);
960 out_p[y*out_p_stride + 8*x + 7] = (uint8_t)(a & 0xFF);
961 }
962 }
963 else {
964 for (x=0;x<width;x++) {
965 uint16_t r = in_r[x + y*in_r_stride];
966 uint16_t g = in_g[x + y*in_g_stride];
967 uint16_t b = in_b[x + y*in_b_stride];
968 out_p[y*out_p_stride + 6*x + 0] = (uint8_t)(r>>8);
969 out_p[y*out_p_stride + 6*x + 1] = (uint8_t)(r & 0xFF);
970 out_p[y*out_p_stride + 6*x + 2] = (uint8_t)(g>>8);
971 out_p[y*out_p_stride + 6*x + 3] = (uint8_t)(g & 0xFF);
972 out_p[y*out_p_stride + 6*x + 4] = (uint8_t)(b>>8);
973 out_p[y*out_p_stride + 6*x + 5] = (uint8_t)(b & 0xFF);
974 }
975 }
976 }
977
978 return outimg;
979 }
980
981
982
983
984 class Op_RRGGBBaa_BE_to_RGB_HDR : public ColorConversionOperation
985 {
986 public:
987 std::vector<ColorStateWithCost>
988 state_after_conversion(ColorState input_state,
989 ColorState target_state,
990 ColorConversionOptions options) override;
991
992 std::shared_ptr<HeifPixelImage>
993 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
994 ColorState target_state,
995 ColorConversionOptions options) override;
996 };
997
998
999 std::vector<ColorStateWithCost>
1000 Op_RRGGBBaa_BE_to_RGB_HDR::state_after_conversion(ColorState input_state,
1001 ColorState target_state,
1002 ColorConversionOptions options)
1003 {
1004 // Note: no input alpha channel required. It will be filled up with 0xFF.
1005
1006 if (input_state.colorspace != heif_colorspace_RGB ||
1007 (input_state.chroma != heif_chroma_interleaved_RRGGBB_BE &&
1008 input_state.chroma != heif_chroma_interleaved_RRGGBBAA_BE) ||
1009 input_state.bits_per_pixel == 8) {
1010 return { };
1011 }
1012
1013 std::vector<ColorStateWithCost> states;
1014
1015 ColorState output_state;
1016 ColorConversionCosts costs;
1017
1018 // --- convert to RRGGBB_BE
1019
1020 output_state.colorspace = heif_colorspace_RGB;
1021 output_state.chroma = heif_chroma_444;
1022 output_state.has_alpha = (input_state.chroma == heif_chroma_interleaved_RRGGBBAA_LE ||
1023 input_state.chroma == heif_chroma_interleaved_RRGGBBAA_BE);
1024 output_state.bits_per_pixel = input_state.bits_per_pixel;
1025
1026 costs = { 0.2f, 0.0f, 0.0f };
1027
1028 states.push_back({ output_state, costs });
1029
1030
1031 return states;
1032 }
1033
1034
1035 std::shared_ptr<HeifPixelImage>
1036 Op_RRGGBBaa_BE_to_RGB_HDR::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1037 ColorState target_state,
1038 ColorConversionOptions options)
1039 {
1040 bool has_alpha = (input->get_chroma_format() == heif_chroma_interleaved_RRGGBBAA_LE ||
1041 input->get_chroma_format() == heif_chroma_interleaved_RRGGBBAA_BE);
1042
1043 auto outimg = std::make_shared<HeifPixelImage>();
1044
1045 int width = input->get_width();
1046 int height = input->get_height();
1047
1048 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_444);
1049
1050 outimg->add_plane(heif_channel_R, width, height, input->get_bits_per_pixel(heif_channel_interleaved));
1051 outimg->add_plane(heif_channel_G, width, height, input->get_bits_per_pixel(heif_channel_interleaved));
1052 outimg->add_plane(heif_channel_B, width, height, input->get_bits_per_pixel(heif_channel_interleaved));
1053
1054 if (has_alpha) {
1055 outimg->add_plane(heif_channel_Alpha, width, height, input->get_bits_per_pixel(heif_channel_interleaved));
1056 }
1057
1058 const uint8_t *in_p;
1059 int in_p_stride=0;
1060
1061 uint16_t *out_r,*out_g,*out_b,*out_a=nullptr;
1062 int out_r_stride=0, out_g_stride=0, out_b_stride=0, out_a_stride=0;
1063
1064 in_p = input->get_plane(heif_channel_interleaved, &in_p_stride);
1065
1066 out_r = (uint16_t*)outimg->get_plane(heif_channel_R, &out_r_stride);
1067 out_g = (uint16_t*)outimg->get_plane(heif_channel_G, &out_g_stride);
1068 out_b = (uint16_t*)outimg->get_plane(heif_channel_B, &out_b_stride);
1069
1070 if (has_alpha) {
1071 out_a = (uint16_t*)outimg->get_plane(heif_channel_Alpha, &out_a_stride);
1072 }
1073
1074 out_r_stride /= 2;
1075 out_g_stride /= 2;
1076 out_b_stride /= 2;
1077 out_a_stride /= 2;
1078
1079 int x,y;
1080 for (y=0;y<height;y++) {
1081
1082 for (x=0;x<width;x++) {
1083 uint16_t r = (uint16_t)((in_p[y*in_p_stride + 8*x + 0] << 8) |
1084 in_p[y*in_p_stride + 8*x + 1]);
1085 uint16_t g = (uint16_t)((in_p[y*in_p_stride + 8*x + 2] << 8) |
1086 in_p[y*in_p_stride + 8*x + 3]);
1087 uint16_t b = (uint16_t)((in_p[y*in_p_stride + 8*x + 4] << 8) |
1088 in_p[y*in_p_stride + 8*x + 5]);
1089
1090 out_r[x + y*out_r_stride] = r;
1091 out_g[x + y*out_g_stride] = g;
1092 out_b[x + y*out_b_stride] = b;
1093
1094 if (has_alpha) {
1095 uint16_t a = (uint16_t)((in_p[y*in_p_stride + 8*x + 6] << 8) |
1096 in_p[y*in_p_stride + 8*x + 7]);
1097
1098 out_a[x + y*out_a_stride] = a;
1099 }
1100 }
1101 }
1102
1103 return outimg;
1104 }
1105
1106
1107
1108
1109 class Op_RRGGBBaa_swap_endianness : public ColorConversionOperation
1110 {
1111 public:
1112 std::vector<ColorStateWithCost>
1113 state_after_conversion(ColorState input_state,
1114 ColorState target_state,
1115 ColorConversionOptions options) override;
1116
1117 std::shared_ptr<HeifPixelImage>
1118 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1119 ColorState target_state,
1120 ColorConversionOptions options) override;
1121 };
1122
1123
1124 std::vector<ColorStateWithCost>
1125 Op_RRGGBBaa_swap_endianness::state_after_conversion(ColorState input_state,
1126 ColorState target_state,
1127 ColorConversionOptions options)
1128 {
1129 // Note: no input alpha channel required. It will be filled up with 0xFF.
1130
1131 if (input_state.colorspace != heif_colorspace_RGB ||
1132 (input_state.chroma != heif_chroma_interleaved_RRGGBB_LE &&
1133 input_state.chroma != heif_chroma_interleaved_RRGGBB_BE &&
1134 input_state.chroma != heif_chroma_interleaved_RRGGBBAA_LE &&
1135 input_state.chroma != heif_chroma_interleaved_RRGGBBAA_BE) ||
1136 input_state.bits_per_pixel == 8) {
1137 return { };
1138 }
1139
1140 std::vector<ColorStateWithCost> states;
1141
1142 ColorState output_state;
1143 ColorConversionCosts costs;
1144
1145 // --- swap RRGGBB
1146
1147 if (input_state.chroma == heif_chroma_interleaved_RRGGBB_LE ||
1148 input_state.chroma == heif_chroma_interleaved_RRGGBB_BE) {
1149 output_state.colorspace = heif_colorspace_RGB;
1150
1151 if (input_state.chroma == heif_chroma_interleaved_RRGGBB_LE) {
1152 output_state.chroma = heif_chroma_interleaved_RRGGBB_BE;
1153 }
1154 else {
1155 output_state.chroma = heif_chroma_interleaved_RRGGBB_LE;
1156 }
1157
1158 output_state.has_alpha = false;
1159 output_state.bits_per_pixel = input_state.bits_per_pixel;
1160
1161 costs = { 0.1f, 0.0f, 0.0f };
1162
1163 states.push_back({ output_state, costs });
1164 }
1165
1166
1167 // --- swap RRGGBBAA
1168
1169 if (input_state.chroma == heif_chroma_interleaved_RRGGBBAA_LE ||
1170 input_state.chroma == heif_chroma_interleaved_RRGGBBAA_BE) {
1171 output_state.colorspace = heif_colorspace_RGB;
1172
1173 if (input_state.chroma == heif_chroma_interleaved_RRGGBBAA_LE) {
1174 output_state.chroma = heif_chroma_interleaved_RRGGBBAA_BE;
1175 }
1176 else {
1177 output_state.chroma = heif_chroma_interleaved_RRGGBBAA_LE;
1178 }
1179
1180 output_state.has_alpha = true;
1181 output_state.bits_per_pixel = input_state.bits_per_pixel;
1182
1183 costs = { 0.1f, 0.0f, 0.0f };
1184
1185 states.push_back({ output_state, costs });
1186 }
1187
1188
1189 return states;
1190 }
1191
1192
1193 std::shared_ptr<HeifPixelImage>
1194 Op_RRGGBBaa_swap_endianness::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1195 ColorState target_state,
1196 ColorConversionOptions options)
1197 {
1198 auto outimg = std::make_shared<HeifPixelImage>();
1199
1200 int width = input->get_width();
1201 int height = input->get_height();
1202
1203 switch (input->get_chroma_format()) {
1204 case heif_chroma_interleaved_RRGGBB_LE:
1205 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_RRGGBB_BE);
1206 break;
1207 case heif_chroma_interleaved_RRGGBB_BE:
1208 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_RRGGBB_LE);
1209 break;
1210 case heif_chroma_interleaved_RRGGBBAA_LE:
1211 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_RRGGBBAA_BE);
1212 break;
1213 case heif_chroma_interleaved_RRGGBBAA_BE:
1214 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_RRGGBBAA_LE);
1215 break;
1216 default:
1217 return nullptr;
1218 }
1219
1220 outimg->add_plane(heif_channel_interleaved, width, height,
1221 input->get_bits_per_pixel(heif_channel_interleaved));
1222
1223 const uint8_t *in_p=nullptr;
1224 int in_p_stride=0;
1225
1226 uint8_t *out_p;
1227 int out_p_stride=0;
1228
1229 in_p = input->get_plane(heif_channel_interleaved, &in_p_stride);
1230 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
1231
1232 int n_bytes = std::min(in_p_stride, out_p_stride);
1233
1234 int x,y;
1235 for (y=0;y<height;y++) {
1236 for (x=0;x<n_bytes;x+=2) {
1237 out_p[y*out_p_stride + x + 0] = in_p[y*in_p_stride + x + 1];
1238 out_p[y*out_p_stride + x + 1] = in_p[y*in_p_stride + x + 0];
1239 }
1240 }
1241
1242 return outimg;
1243 }
1244
1245
1246
1247
1248 class Op_mono_to_YCbCr420 : public ColorConversionOperation
1249 {
1250 public:
1251 std::vector<ColorStateWithCost>
1252 state_after_conversion(ColorState input_state,
1253 ColorState target_state,
1254 ColorConversionOptions options) override;
1255
1256 std::shared_ptr<HeifPixelImage>
1257 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1258 ColorState target_state,
1259 ColorConversionOptions options) override;
1260 };
1261
1262
1263 std::vector<ColorStateWithCost>
1264 Op_mono_to_YCbCr420::state_after_conversion(ColorState input_state,
1265 ColorState target_state,
1266 ColorConversionOptions options)
1267 {
1268 // Note: no input alpha channel required. It will be filled up with 0xFF.
1269
1270 if (input_state.colorspace != heif_colorspace_monochrome ||
1271 input_state.chroma != heif_chroma_monochrome ||
1272 input_state.bits_per_pixel != 8) {
1273 return { };
1274 }
1275
1276 std::vector<ColorStateWithCost> states;
1277
1278 ColorState output_state;
1279 ColorConversionCosts costs;
1280
1281 // --- convert to YCbCr420
1282
1283 output_state.colorspace = heif_colorspace_YCbCr;
1284 output_state.chroma = heif_chroma_420;
1285 output_state.has_alpha = input_state.has_alpha;
1286 output_state.bits_per_pixel = 8;
1287
1288 costs = { 0.1f, 0.0f, 0.0f };
1289
1290 states.push_back({ output_state, costs });
1291
1292 return states;
1293 }
1294
1295
1296 std::shared_ptr<HeifPixelImage>
1297 Op_mono_to_YCbCr420::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1298 ColorState target_state,
1299 ColorConversionOptions options)
1300 {
1301 auto outimg = std::make_shared<HeifPixelImage>();
1302
1303 int width = input->get_width();
1304 int height = input->get_height();
1305
1306 outimg->create(width, height, heif_colorspace_YCbCr, heif_chroma_420);
1307
1308 int chroma_width = (width+1)/2;
1309 int chroma_height = (height+1)/2;
1310
1311 outimg->add_plane(heif_channel_Y, width, height, 8);
1312 outimg->add_plane(heif_channel_Cb, chroma_width, chroma_height, 8);
1313 outimg->add_plane(heif_channel_Cr, chroma_width, chroma_height, 8);
1314
1315 bool has_alpha = input->has_channel(heif_channel_Alpha);
1316 if (has_alpha) {
1317 outimg->add_plane(heif_channel_Alpha, width, height, 8);
1318 }
1319
1320
1321 uint8_t *out_cb,*out_cr,*out_y;
1322 int out_cb_stride=0, out_cr_stride=0, out_y_stride=0;
1323
1324 const uint8_t *in_y;
1325 int in_y_stride=0;
1326
1327 in_y = input->get_plane(heif_channel_Y, &in_y_stride);
1328
1329 out_y = outimg->get_plane(heif_channel_Y, &out_y_stride);
1330 out_cb = outimg->get_plane(heif_channel_Cb, &out_cb_stride);
1331 out_cr = outimg->get_plane(heif_channel_Cr, &out_cr_stride);
1332
1333 memset(out_cb, 128, out_cb_stride*chroma_height);
1334 memset(out_cr, 128, out_cr_stride*chroma_height);
1335
1336 for (int y=0;y<height;y++) {
1337 memcpy(out_y + y*out_y_stride,
1338 in_y + y*in_y_stride,
1339 width);
1340 }
1341
1342 if (has_alpha) {
1343 const uint8_t *in_a;
1344 uint8_t *out_a;
1345 int in_a_stride=0;
1346 int out_a_stride=0;
1347
1348 in_a = input->get_plane(heif_channel_Alpha, &in_a_stride);
1349 out_a = outimg->get_plane(heif_channel_Alpha, &out_a_stride);
1350
1351 for (int y=0;y<height;y++) {
1352 memcpy(&out_a[y*out_a_stride], &in_a[y*in_a_stride], width);
1353 }
1354 }
1355
1356 return outimg;
1357 }
1358
1359
1360
1361
1362 class Op_mono_to_RGB24_32 : public ColorConversionOperation
1363 {
1364 public:
1365 std::vector<ColorStateWithCost>
1366 state_after_conversion(ColorState input_state,
1367 ColorState target_state,
1368 ColorConversionOptions options) override;
1369
1370 std::shared_ptr<HeifPixelImage>
1371 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1372 ColorState target_state,
1373 ColorConversionOptions options) override;
1374 };
1375
1376
1377 std::vector<ColorStateWithCost>
1378 Op_mono_to_RGB24_32::state_after_conversion(ColorState input_state,
1379 ColorState target_state,
1380 ColorConversionOptions options)
1381 {
1382 // Note: no input alpha channel required. It will be filled up with 0xFF.
1383
1384 if (input_state.colorspace != heif_colorspace_monochrome ||
1385 input_state.chroma != heif_chroma_monochrome ||
1386 input_state.bits_per_pixel != 8) {
1387 return { };
1388 }
1389
1390 std::vector<ColorStateWithCost> states;
1391
1392 ColorState output_state;
1393 ColorConversionCosts costs;
1394
1395 // --- convert to RGB24
1396
1397 if (input_state.has_alpha == false) {
1398 output_state.colorspace = heif_colorspace_RGB;
1399 output_state.chroma = heif_chroma_interleaved_RGB;
1400 output_state.has_alpha = false;
1401 output_state.bits_per_pixel = 8;
1402
1403 costs = { 0.1f, 0.0f, 0.0f };
1404
1405 states.push_back({ output_state, costs });
1406 }
1407
1408
1409 // --- convert to RGB32
1410
1411 output_state.colorspace = heif_colorspace_RGB;
1412 output_state.chroma = heif_chroma_interleaved_RGBA;
1413 output_state.has_alpha = true;
1414 output_state.bits_per_pixel = 8;
1415
1416 costs = { 0.15f, 0.0f, 0.0f };
1417
1418 states.push_back({ output_state, costs });
1419
1420 return states;
1421 }
1422
1423
1424 std::shared_ptr<HeifPixelImage>
1425 Op_mono_to_RGB24_32::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1426 ColorState target_state,
1427 ColorConversionOptions options)
1428 {
1429 int width = input->get_width();
1430 int height = input->get_height();
1431
1432 if (input->get_bits_per_pixel(heif_channel_Y) != 8) {
1433 return nullptr;
1434 }
1435
1436 auto outimg = std::make_shared<HeifPixelImage>();
1437
1438 bool has_alpha = input->has_channel(heif_channel_Alpha);
1439
1440 if (target_state.has_alpha) {
1441 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_32bit);
1442 } else {
1443 outimg->create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_24bit);
1444 }
1445
1446 outimg->add_plane(heif_channel_interleaved, width, height, 8);
1447
1448 const uint8_t *in_y, *in_a;
1449 int in_y_stride=0, in_a_stride;
1450
1451 uint8_t *out_p;
1452 int out_p_stride=0;
1453
1454 in_y = input->get_plane(heif_channel_Y, &in_y_stride);
1455 if (has_alpha) {
1456 in_a = input->get_plane(heif_channel_Alpha, &in_a_stride);
1457 }
1458
1459 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
1460
1461 int x,y;
1462 for (y=0;y<height;y++) {
1463 if (target_state.has_alpha==false) {
1464 for (x=0;x<width;x++) {
1465 uint8_t v = in_y[x + y*in_y_stride];
1466 out_p[y*out_p_stride + 3*x + 0] = v;
1467 out_p[y*out_p_stride + 3*x + 1] = v;
1468 out_p[y*out_p_stride + 3*x + 2] = v;
1469 }
1470 }
1471 else if (has_alpha) {
1472 for (x=0;x<width;x++) {
1473 uint8_t v = in_y[x + y*in_y_stride];
1474 out_p[y*out_p_stride + 4*x + 0] = v;
1475 out_p[y*out_p_stride + 4*x + 1] = v;
1476 out_p[y*out_p_stride + 4*x + 2] = v;
1477 out_p[y*out_p_stride + 4*x + 3] = in_a[x + y*in_a_stride];
1478 }
1479 }
1480 else {
1481 for (x=0;x<width;x++) {
1482 uint8_t v = in_y[x + y*in_y_stride];
1483 out_p[y*out_p_stride + 4*x + 0] = v;
1484 out_p[y*out_p_stride + 4*x + 1] = v;
1485 out_p[y*out_p_stride + 4*x + 2] = v;
1486 out_p[y*out_p_stride + 4*x + 3] = 0xFF;
1487 }
1488 }
1489 }
1490
1491 return outimg;
1492 }
1493
1494
1495
1496
1497 class Op_RGB24_32_to_YCbCr420 : public ColorConversionOperation
1498 {
1499 public:
1500 std::vector<ColorStateWithCost>
1501 state_after_conversion(ColorState input_state,
1502 ColorState target_state,
1503 ColorConversionOptions options) override;
1504
1505 std::shared_ptr<HeifPixelImage>
1506 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1507 ColorState target_state,
1508 ColorConversionOptions options) override;
1509 };
1510
1511
1512 std::vector<ColorStateWithCost>
1513 Op_RGB24_32_to_YCbCr420::state_after_conversion(ColorState input_state,
1514 ColorState target_state,
1515 ColorConversionOptions options)
1516 {
1517 // Note: no input alpha channel required. It will be filled up with 0xFF.
1518
1519 if (input_state.colorspace != heif_colorspace_RGB ||
1520 (input_state.chroma != heif_chroma_interleaved_RGB &&
1521 input_state.chroma != heif_chroma_interleaved_RGBA)) {
1522 return { };
1523 }
1524
1525 std::vector<ColorStateWithCost> states;
1526
1527 ColorState output_state;
1528 ColorConversionCosts costs;
1529
1530 // --- convert RGB24
1531
1532 if (input_state.chroma == heif_chroma_interleaved_RGB) {
1533 output_state.colorspace = heif_colorspace_YCbCr;
1534 output_state.chroma = heif_chroma_420;
1535 output_state.has_alpha = false;
1536 output_state.bits_per_pixel = 8;
1537
1538 costs = { 0.75f, 0.5f, 0.0f }; // quality not good since we subsample chroma without filtering
1539
1540 states.push_back({ output_state, costs });
1541 }
1542
1543
1544 // --- convert RGB32
1545
1546 if (input_state.chroma == heif_chroma_interleaved_RGBA) {
1547 output_state.colorspace = heif_colorspace_YCbCr;
1548 output_state.chroma = heif_chroma_420;
1549 output_state.has_alpha = true;
1550 output_state.bits_per_pixel = 8;
1551
1552 costs = { 0.75f, 0.5f, 0.0f }; // quality not good since we subsample chroma without filtering
1553
1554 states.push_back({ output_state, costs });
1555 }
1556
1557 return states;
1558 }
1559
1560
1561 static inline uint8_t clip(float fx)
1562 {
1563 int x = static_cast<int>(fx);
1564 if (x<0) return 0;
1565 if (x>255) return 255;
1566 return static_cast<uint8_t>(x);
1567 }
1568
1569
1570 std::shared_ptr<HeifPixelImage>
1571 Op_RGB24_32_to_YCbCr420::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1572 ColorState target_state,
1573 ColorConversionOptions options)
1574 {
1575 int width = input->get_width();
1576 int height = input->get_height();
1577
1578 auto outimg = std::make_shared<HeifPixelImage>();
1579
1580 outimg->create(width, height, heif_colorspace_YCbCr, heif_chroma_420);
1581
1582 int chroma_width = (width+1)/2;
1583 int chroma_height = (height+1)/2;
1584
1585 const bool has_alpha = (input->get_chroma_format() == heif_chroma_interleaved_32bit);
1586
1587 outimg->add_plane(heif_channel_Y, width, height, 8);
1588 outimg->add_plane(heif_channel_Cb, chroma_width, chroma_height, 8);
1589 outimg->add_plane(heif_channel_Cr, chroma_width, chroma_height, 8);
1590
1591 if (has_alpha) {
1592 outimg->add_plane(heif_channel_Alpha, width, height, 8);
1593 }
1594
1595 uint8_t *out_cb,*out_cr,*out_y, *out_a;
1596 int out_cb_stride=0, out_cr_stride=0, out_y_stride=0, out_a_stride=0;
1597
1598 const uint8_t *in_p;
1599 int in_stride=0;
1600
1601 in_p = input->get_plane(heif_channel_interleaved, &in_stride);
1602
1603 out_y = outimg->get_plane(heif_channel_Y, &out_y_stride);
1604 out_cb = outimg->get_plane(heif_channel_Cb, &out_cb_stride);
1605 out_cr = outimg->get_plane(heif_channel_Cr, &out_cr_stride);
1606
1607 if (has_alpha) {
1608 out_a = outimg->get_plane(heif_channel_Alpha, &out_a_stride);
1609 }
1610
1611
1612 if (!has_alpha) {
1613 for (int y=0;y<height;y++) {
1614 for (int x=0;x<width;x++) {
1615 uint8_t r = in_p[y*in_stride + x*3 +0];
1616 uint8_t g = in_p[y*in_stride + x*3 +1];
1617 uint8_t b = in_p[y*in_stride + x*3 +2];
1618 out_y[y*out_y_stride + x] = clip(r*0.299f + g*0.587f + b*0.114f);
1619 }
1620 }
1621
1622 for (int y=0;y<height;y+=2) {
1623 for (int x=0;x<width;x+=2) {
1624 uint8_t r = in_p[y*in_stride + x*3 +0];
1625 uint8_t g = in_p[y*in_stride + x*3 +1];
1626 uint8_t b = in_p[y*in_stride + x*3 +2];
1627 out_cb[(y/2)*out_cb_stride + (x/2)] = clip(128 - r*0.168736f - g*0.331264f + b*0.5f);
1628 out_cr[(y/2)*out_cb_stride + (x/2)] = clip(128 + r*0.5f - g*0.418688f - b*0.081312f);
1629 }
1630 }
1631 }
1632 else {
1633 for (int y=0;y<height;y++) {
1634 for (int x=0;x<width;x++) {
1635 uint8_t r = in_p[y*in_stride + x*4 +0];
1636 uint8_t g = in_p[y*in_stride + x*4 +1];
1637 uint8_t b = in_p[y*in_stride + x*4 +2];
1638 uint8_t a = in_p[y*in_stride + x*4 +3];
1639 out_y[y*out_y_stride + x] = clip(r*0.299f + g*0.587f + b*0.114f);
1640
1641 // alpha
1642 out_a[y*out_a_stride + x] = a;
1643 }
1644 }
1645
1646 for (int y=0;y<height;y+=2) {
1647 for (int x=0;x<width;x+=2) {
1648 uint8_t r = in_p[y*in_stride + x*4 +0];
1649 uint8_t g = in_p[y*in_stride + x*4 +1];
1650 uint8_t b = in_p[y*in_stride + x*4 +2];
1651 out_cb[(y/2)*out_cb_stride + (x/2)] = clip(128 - r*0.168736f - g*0.331264f + b*0.5f);
1652 out_cr[(y/2)*out_cb_stride + (x/2)] = clip(128 + r*0.5f - g*0.418688f - b*0.081312f);
1653 }
1654 }
1655 }
1656
1657 return outimg;
1658 }
1659
1660
1661
1662
1663 class Op_drop_alpha_plane : public ColorConversionOperation
1664 {
1665 public:
1666 std::vector<ColorStateWithCost>
1667 state_after_conversion(ColorState input_state,
1668 ColorState target_state,
1669 ColorConversionOptions options) override;
1670
1671 std::shared_ptr<HeifPixelImage>
1672 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1673 ColorState target_state,
1674 ColorConversionOptions options) override;
1675 };
1676
1677
1678 std::vector<ColorStateWithCost>
1679 Op_drop_alpha_plane::state_after_conversion(ColorState input_state,
1680 ColorState target_state,
1681 ColorConversionOptions options)
1682 {
1683 // only drop alpha plane if it is not needed in output
1684
1685 if ((input_state.chroma != heif_chroma_monochrome &&
1686 input_state.chroma != heif_chroma_420 &&
1687 input_state.chroma != heif_chroma_422 &&
1688 input_state.chroma != heif_chroma_444) ||
1689 input_state.has_alpha == false ||
1690 target_state.has_alpha == true) {
1691 return { };
1692 }
1693
1694 std::vector<ColorStateWithCost> states;
1695
1696 ColorState output_state;
1697 ColorConversionCosts costs;
1698
1699 // --- drop alpha plane
1700
1701 output_state = input_state;
1702 output_state.has_alpha = false;
1703
1704 costs = { 0.1f, 0.0f, 0.0f };
1705
1706 states.push_back({ output_state, costs });
1707
1708 return states;
1709 }
1710
1711
1712 std::shared_ptr<HeifPixelImage>
1713 Op_drop_alpha_plane::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1714 ColorState target_state,
1715 ColorConversionOptions options)
1716 {
1717 int width = input->get_width();
1718 int height = input->get_height();
1719
1720 auto outimg = std::make_shared<HeifPixelImage>();
1721
1722 outimg->create(width, height,
1723 input->get_colorspace(),
1724 input->get_chroma_format());
1725
1726 for (heif_channel channel : { heif_channel_Y,
1727 heif_channel_Cb,
1728 heif_channel_Cr,
1729 heif_channel_R,
1730 heif_channel_G,
1731 heif_channel_B }) {
1732 if (input->has_channel(channel)) {
1733 outimg->copy_new_plane_from(input, channel, channel);
1734 }
1735 }
1736
1737 return outimg;
1738 }
1739
1740
1741 class Op_to_hdr_planes : public ColorConversionOperation
1742 {
1743 public:
1744 std::vector<ColorStateWithCost>
1745 state_after_conversion(ColorState input_state,
1746 ColorState target_state,
1747 ColorConversionOptions options) override;
1748
1749 std::shared_ptr<HeifPixelImage>
1750 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1751 ColorState target_state,
1752 ColorConversionOptions options) override;
1753 };
1754
1755
1756 std::vector<ColorStateWithCost>
1757 Op_to_hdr_planes::state_after_conversion(ColorState input_state,
1758 ColorState target_state,
1759 ColorConversionOptions options)
1760 {
1761 if ((input_state.chroma != heif_chroma_monochrome &&
1762 input_state.chroma != heif_chroma_420 &&
1763 input_state.chroma != heif_chroma_422 &&
1764 input_state.chroma != heif_chroma_444) ||
1765 input_state.bits_per_pixel != 8) {
1766 return { };
1767 }
1768
1769 std::vector<ColorStateWithCost> states;
1770
1771 ColorState output_state;
1772 ColorConversionCosts costs;
1773
1774 // --- increase bit depth
1775
1776 output_state = input_state;
1777 output_state.bits_per_pixel = target_state.bits_per_pixel;
1778
1779 costs = { 0.2f, 0.0f, 0.5f };
1780
1781 states.push_back({ output_state, costs });
1782
1783 return states;
1784 }
1785
1786
1787 std::shared_ptr<HeifPixelImage>
1788 Op_to_hdr_planes::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1789 ColorState target_state,
1790 ColorConversionOptions options)
1791 {
1792 int width = input->get_width();
1793 int height = input->get_height();
1794
1795 auto outimg = std::make_shared<HeifPixelImage>();
1796
1797 outimg->create(width, height,
1798 input->get_colorspace(),
1799 input->get_chroma_format());
1800
1801 for (heif_channel channel : { heif_channel_Y,
1802 heif_channel_Cb,
1803 heif_channel_Cr,
1804 heif_channel_R,
1805 heif_channel_G,
1806 heif_channel_B,
1807 heif_channel_Alpha }) {
1808 if (input->has_channel(channel)) {
1809 int width = input->get_width(channel);
1810 int height = input->get_height(channel);
1811 outimg->add_plane(channel, width, height, target_state.bits_per_pixel);
1812
1813 int input_bits = input->get_bits_per_pixel(channel);
1814 int output_bits = target_state.bits_per_pixel;
1815
1816 int shift1 = output_bits - input_bits;
1817 int shift2 = 8-shift1;
1818
1819 const uint8_t* p_in;
1820 int stride_in;
1821 p_in = input->get_plane(channel, &stride_in);
1822
1823 uint16_t* p_out;
1824 int stride_out;
1825 p_out = (uint16_t*)outimg->get_plane(channel, &stride_out);
1826
1827 for (int y=0;y<height;y++)
1828 for (int x=0;x<width;x++) {
1829 int in = p_in[y*stride_in+x];
1830 p_out[y*stride_out+x] = (uint16_t)((in<<shift1) | (in>>shift2));
1831 }
1832 }
1833 }
1834
1835 return outimg;
1836 }
1837
1838
1839
1840
1841
1842
1843
1844
1845 class Op_RRGGBBxx_HDR_to_YCbCr420 : public ColorConversionOperation
1846 {
1847 public:
1848 std::vector<ColorStateWithCost>
1849 state_after_conversion(ColorState input_state,
1850 ColorState target_state,
1851 ColorConversionOptions options) override;
1852
1853 std::shared_ptr<HeifPixelImage>
1854 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1855 ColorState target_state,
1856 ColorConversionOptions options) override;
1857 };
1858
1859
1860 std::vector<ColorStateWithCost>
1861 Op_RRGGBBxx_HDR_to_YCbCr420::state_after_conversion(ColorState input_state,
1862 ColorState target_state,
1863 ColorConversionOptions options)
1864 {
1865 if (input_state.colorspace != heif_colorspace_RGB ||
1866 !(input_state.chroma == heif_chroma_interleaved_RRGGBB_BE ||
1867 input_state.chroma == heif_chroma_interleaved_RRGGBB_LE ||
1868 input_state.chroma == heif_chroma_interleaved_RRGGBBAA_BE ||
1869 input_state.chroma == heif_chroma_interleaved_RRGGBBAA_LE) ||
1870 input_state.bits_per_pixel == 8) {
1871 return { };
1872 }
1873
1874 std::vector<ColorStateWithCost> states;
1875
1876 ColorState output_state;
1877 ColorConversionCosts costs;
1878
1879 // --- convert to YCbCr
1880
1881 output_state.colorspace = heif_colorspace_YCbCr;
1882 output_state.chroma = heif_chroma_420;
1883 output_state.has_alpha = input_state.has_alpha; // we generate an alpha plane if the source contains data
1884 output_state.bits_per_pixel = input_state.bits_per_pixel;
1885
1886 costs = { 0.5f, 0.0f, 0.0f };
1887
1888 states.push_back({ output_state, costs });
1889
1890 return states;
1891 }
1892
1893
1894 std::shared_ptr<HeifPixelImage>
1895 Op_RRGGBBxx_HDR_to_YCbCr420::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1896 ColorState target_state,
1897 ColorConversionOptions options)
1898 {
1899 int width = input->get_width();
1900 int height = input->get_height();
1901
1902 int bpp = input->get_bits_per_pixel(heif_channel_interleaved);
1903
1904 bool has_alpha = (input->get_chroma_format() == heif_chroma_interleaved_RRGGBBAA_BE ||
1905 input->get_chroma_format() == heif_chroma_interleaved_RRGGBBAA_LE);
1906
1907 auto outimg = std::make_shared<HeifPixelImage>();
1908
1909 outimg->create(width, height, heif_colorspace_YCbCr, heif_chroma_420);
1910
1911 int bytesPerPixel = has_alpha ? 8 : 6;
1912
1913 int cwidth = (width+1)/2;
1914 int cheight = (height+1)/2;
1915
1916 outimg->add_plane(heif_channel_Y, width, height, bpp);
1917 outimg->add_plane(heif_channel_Cb, cwidth, cheight, bpp);
1918 outimg->add_plane(heif_channel_Cr, cwidth, cheight, bpp);
1919
1920 if (has_alpha) {
1921 outimg->add_plane(heif_channel_Alpha, width, height, bpp);
1922 }
1923
1924 const uint8_t *in_p;
1925 int in_p_stride=0;
1926
1927 uint16_t *out_y,*out_cb,*out_cr,*out_a = nullptr;
1928 int out_y_stride=0, out_cb_stride=0, out_cr_stride=0, out_a_stride=0;
1929
1930 in_p = input->get_plane(heif_channel_interleaved, &in_p_stride);
1931 out_y = (uint16_t*)outimg->get_plane(heif_channel_Y, &out_y_stride);
1932 out_cb = (uint16_t*)outimg->get_plane(heif_channel_Cb, &out_cb_stride);
1933 out_cr = (uint16_t*)outimg->get_plane(heif_channel_Cr, &out_cr_stride);
1934
1935 if (has_alpha) {
1936 out_a = (uint16_t*)outimg->get_plane(heif_channel_Alpha, &out_a_stride);
1937 }
1938
1939
1940 // adapt stride as we are pointing to 16bit integers
1941 out_y_stride /= 2;
1942 out_cb_stride /= 2;
1943 out_cr_stride /= 2;
1944 out_a_stride /= 2;
1945
1946 uint16_t halfRange = (uint16_t)(1<<(bpp-1));
1947 int32_t fullRange = (1<<bpp)-1;
1948
1949 // le=1 for little endian, le=0 for big endian
1950 int le = (input->get_chroma_format() == heif_chroma_interleaved_RRGGBBAA_LE ||
1951 input->get_chroma_format() == heif_chroma_interleaved_RRGGBB_LE) ? 1 : 0;
1952
1953 for (int y=0;y<height;y++) {
1954 for (int x=0;x<width;x++) {
1955
1956 const uint8_t* in = &in_p[y*in_p_stride + bytesPerPixel*x];
1957
1958 int r = (in[0+le]<<8) | in[1-le];
1959 int g = (in[2+le]<<8) | in[3-le];
1960 int b = (in[4+le]<<8) | in[5-le];
1961
1962 out_y[y * out_y_stride + x] = clip((r*4899 + g*9617 + b*1868)>>14, fullRange);
1963
1964 if (has_alpha) {
1965 uint16_t a = (uint16_t)((in[6+le]<<8) | in[7-le]);
1966 out_a[y*out_a_stride + x] = a;
1967 }
1968 }
1969 }
1970
1971 for (int y=0;y<height;y+=2) {
1972 for (int x=0;x<width;x+=2) {
1973 const uint8_t* in = &in_p[y*in_p_stride + bytesPerPixel*x];
1974
1975 int r = (in[0+le]<<8) | in[1-le];
1976 int g = (in[2+le]<<8) | in[3-le];
1977 int b = (in[4+le]<<8) | in[5-le];
1978
1979 out_cb[(y/2)*out_cb_stride + (x/2)] = clip(halfRange + ((-r*2765 - g*5427 + (b<<13))>>14), fullRange);
1980 out_cr[(y/2)*out_cr_stride + (x/2)] = clip(halfRange + (((r<<13) - g*6860 - b*1332)>>14), fullRange);
1981 }
1982 }
1983
1984
1985 return outimg;
1986 }
1987
1988
1989 class Op_YCbCr420_to_RRGGBBaa : public ColorConversionOperation
1990 {
1991 public:
1992 std::vector<ColorStateWithCost>
1993 state_after_conversion(ColorState input_state,
1994 ColorState target_state,
1995 ColorConversionOptions options) override;
1996
1997 std::shared_ptr<HeifPixelImage>
1998 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
1999 ColorState target_state,
2000 ColorConversionOptions options) override;
2001 };
2002
2003
2004 std::vector<ColorStateWithCost>
2005 Op_YCbCr420_to_RRGGBBaa::state_after_conversion(ColorState input_state,
2006 ColorState target_state,
2007 ColorConversionOptions options)
2008 {
2009 if (input_state.colorspace != heif_colorspace_YCbCr ||
2010 input_state.chroma != heif_chroma_420 ||
2011 input_state.bits_per_pixel == 8) {
2012 return { };
2013 }
2014
2015 std::vector<ColorStateWithCost> states;
2016
2017 ColorState output_state;
2018 ColorConversionCosts costs;
2019
2020 // --- convert to YCbCr
2021
2022 output_state.colorspace = heif_colorspace_RGB;
2023 output_state.chroma = (input_state.has_alpha ?
2024 heif_chroma_interleaved_RRGGBBAA_LE : heif_chroma_interleaved_RRGGBB_LE);
2025 output_state.has_alpha = input_state.has_alpha;
2026 output_state.bits_per_pixel = input_state.bits_per_pixel;
2027
2028 costs = { 0.5f, 0.0f, 0.0f };
2029
2030 states.push_back({ output_state, costs });
2031
2032
2033 output_state.colorspace = heif_colorspace_RGB;
2034 output_state.chroma = (input_state.has_alpha ?
2035 heif_chroma_interleaved_RRGGBBAA_BE : heif_chroma_interleaved_RRGGBB_BE);
2036 output_state.has_alpha = input_state.has_alpha;
2037 output_state.bits_per_pixel = input_state.bits_per_pixel;
2038
2039 costs = {0.5f, 0.0f, 0.0f};
2040
2041 states.push_back({output_state, costs});
2042
2043 return states;
2044 }
2045
2046
2047 std::shared_ptr<HeifPixelImage>
2048 Op_YCbCr420_to_RRGGBBaa::convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
2049 ColorState target_state,
2050 ColorConversionOptions options)
2051 {
2052 int width = input->get_width();
2053 int height = input->get_height();
2054
2055 int bpp = input->get_bits_per_pixel(heif_channel_Y);
2056 bool has_alpha = input->has_channel(heif_channel_Alpha);
2057
2058 int le = (target_state.chroma == heif_chroma_interleaved_RRGGBB_LE ||
2059 target_state.chroma == heif_chroma_interleaved_RRGGBBAA_LE) ? 1 : 0;
2060
2061 auto outimg = std::make_shared<HeifPixelImage>();
2062 outimg->create(width, height, heif_colorspace_RGB, target_state.chroma);
2063
2064 int bytesPerPixel = has_alpha ? 8 : 6;
2065
2066 outimg->add_plane(heif_channel_interleaved, width, height, bpp);
2067
2068 if (has_alpha) {
2069 outimg->add_plane(heif_channel_Alpha, width, height, bpp);
2070 }
2071
2072 uint8_t *out_p;
2073 int out_p_stride=0;
2074
2075 const uint16_t *in_y,*in_cb,*in_cr,*in_a = nullptr;
2076 int in_y_stride=0, in_cb_stride=0, in_cr_stride=0, in_a_stride=0;
2077
2078 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
2079 in_y = (uint16_t*)input->get_plane(heif_channel_Y, &in_y_stride);
2080 in_cb = (uint16_t*)input->get_plane(heif_channel_Cb, &in_cb_stride);
2081 in_cr = (uint16_t*)input->get_plane(heif_channel_Cr, &in_cr_stride);
2082
2083 if (has_alpha) {
2084 in_a = (uint16_t*)input->get_plane(heif_channel_Alpha, &in_a_stride);
2085 }
2086
2087 int maxval = (1<<bpp)-1;
2088
2089 for (int y=0;y<height;y++) {
2090 for (int x=0;x<width;x++) {
2091
2092 int y_ = in_y[y*in_y_stride/2 + x];
2093 int cb = in_cb[y/2*in_cb_stride/2 + x/2] - (1<<(bpp-1));
2094 int cr = in_cr[y/2*in_cr_stride/2 + x/2] - (1<<(bpp-1));
2095
2096 int r = clip((int16_t)(y_ + 1.40200 * cr), maxval);
2097 int g = clip((int16_t) (y_ - 0.34414 * cb - 0.71414*cr), maxval);
2098 int b = clip(int16_t(y_ + 1.77200 * cb), maxval);
2099
2100
2101 out_p[y*out_p_stride + bytesPerPixel*x + 0+le] = (uint8_t)(r >> 8);
2102 out_p[y*out_p_stride + bytesPerPixel*x + 2+le] = (uint8_t)(g >> 8);
2103 out_p[y*out_p_stride + bytesPerPixel*x + 4+le] = (uint8_t)(b >> 8);
2104
2105 out_p[y*out_p_stride + bytesPerPixel*x + 1-le] = (uint8_t)(r & 0xff);
2106 out_p[y*out_p_stride + bytesPerPixel*x + 3-le] = (uint8_t)(g & 0xff);
2107 out_p[y*out_p_stride + bytesPerPixel*x + 5-le] = (uint8_t)(b & 0xff);
2108
2109 if(has_alpha) {
2110 out_p[y*out_p_stride + 8*x + 6+le] = (uint8_t)(in_a[y*in_a_stride/2+x] >> 8);
2111 out_p[y*out_p_stride + 8*x + 7-le] = (uint8_t)(in_a[y*in_a_stride/2+x] & 0xff);
2112 }
2113 }
2114 }
2115
2116
2117 return outimg;
2118 }
2119
2120
2121
2122
2123 struct Node {
2124 Node() = default;
2125 Node(int prev, const std::shared_ptr<ColorConversionOperation>& _op, ColorStateWithCost state) {
2126 prev_processed_idx = prev;
2127 op = _op;
2128 color_state = state;
2129 }
2130
2131 int prev_processed_idx = -1;
2132 std::shared_ptr<ColorConversionOperation> op;
2133 ColorStateWithCost color_state;
2134 };
2135
2136
2137 bool ColorConversionPipeline::construct_pipeline(ColorState input_state,
2138 ColorState target_state,
2139 ColorConversionOptions options)
2140 {
2141 m_operations.clear();
2142
2143 m_target_state = target_state;
2144 m_options = options;
2145
2146 if (input_state == target_state) {
2147 return true;
2148 }
2149
2150 std::vector<std::shared_ptr<ColorConversionOperation>> ops;
2151 ops.push_back(std::make_shared<Op_RGB_to_RGB24_32>());
2152 ops.push_back(std::make_shared<Op_YCbCr420_to_RGB_8bit>());
2153 ops.push_back(std::make_shared<Op_YCbCr420_to_RGB_16bit>());
2154 ops.push_back(std::make_shared<Op_YCbCr420_to_RGB24>());
2155 ops.push_back(std::make_shared<Op_YCbCr420_to_RGB32>());
2156 ops.push_back(std::make_shared<Op_RGB_HDR_to_RRGGBBaa_BE>());
2157 ops.push_back(std::make_shared<Op_mono_to_YCbCr420>());
2158 ops.push_back(std::make_shared<Op_mono_to_RGB24_32>());
2159 ops.push_back(std::make_shared<Op_RRGGBBaa_swap_endianness>());
2160 ops.push_back(std::make_shared<Op_RRGGBBaa_BE_to_RGB_HDR>());
2161 ops.push_back(std::make_shared<Op_RGB24_32_to_YCbCr420>());
2162 ops.push_back(std::make_shared<Op_RGB_HDR_to_YCbCr420>());
2163 ops.push_back(std::make_shared<Op_drop_alpha_plane>());
2164 ops.push_back(std::make_shared<Op_to_hdr_planes>());
2165 ops.push_back(std::make_shared<Op_RRGGBBxx_HDR_to_YCbCr420>());
2166 ops.push_back(std::make_shared<Op_YCbCr420_to_RRGGBBaa>());
2167
2168
2169 // --- Dijkstra search for the minimum-cost conversion pipeline
2170
2171 std::vector<Node> processed_states;
2172 std::vector<Node> border_states;
2173 border_states.push_back({ -1, nullptr, { input_state, ColorConversionCosts() }});
2174
2175 while (!border_states.empty()) {
2176 size_t minIdx;
2177 float minCost;
2178 for (size_t i=0;i<border_states.size();i++) {
2179 float cost = border_states[i].color_state.costs.total(options.criterion);
2180 if (i==0 || cost<minCost) {
2181 minIdx = i;
2182 minCost = cost;
2183 }
2184 }
2185
2186
2187 // move minimum-cost border_state into processed_states
2188
2189 processed_states.push_back(border_states[minIdx]);
2190
2191 border_states[minIdx] = border_states.back();
2192 border_states.pop_back();
2193
2194 if (processed_states.back().color_state.color_state == target_state) {
2195 // end-state found, backtrack path to find conversion pipeline
2196
2197 size_t idx = processed_states.size()-1;
2198 int len = 0;
2199 while (idx>0) {
2200 idx = processed_states[idx].prev_processed_idx;
2201 len++;
2202 }
2203
2204 m_operations.resize(len);
2205
2206 idx = processed_states.size()-1;
2207 int step = 0;
2208 while (idx>0) {
2209 m_operations[len-1-step] = processed_states[idx].op;
2210 //printf("cost: %f\n",processed_states[idx].color_state.costs.total(options.criterion));
2211 idx = processed_states[idx].prev_processed_idx;
2212 step++;
2213 }
2214
2215 #if DEBUG_ME
2216 debug_dump_pipeline();
2217 #endif
2218
2219 return true;
2220 }
2221
2222
2223 // expand the node with minimum cost
2224
2225 for (size_t i=0;i<ops.size();i++) {
2226 auto out_states = ops[i]->state_after_conversion(processed_states.back().color_state.color_state,
2227 target_state,
2228 options);
2229 for (const auto& out_state : out_states) {
2230 bool state_exists = false;
2231 for (const auto& s : processed_states) {
2232 if (s.color_state.color_state==out_state.color_state) {
2233 state_exists = true;
2234 break;
2235 }
2236 }
2237
2238 if (!state_exists) {
2239 for (auto& s : border_states) {
2240 if (s.color_state.color_state==out_state.color_state) {
2241 state_exists = true;
2242
2243 // if we reached the same border node with a lower cost, replace the border node
2244
2245 ColorConversionCosts new_op_costs = out_state.costs + processed_states.back().color_state.costs;
2246
2247 if (s.color_state.costs.total(options.criterion) > new_op_costs.total(options.criterion)) {
2248 s = { (int)(processed_states.size()-1),
2249 ops[i],
2250 out_state };
2251
2252 s.color_state.costs = new_op_costs;
2253 }
2254 break;
2255 }
2256 }
2257 }
2258
2259
2260 // enter the new output state into the list of border states
2261
2262 if (!state_exists) {
2263 ColorStateWithCost s = out_state;
2264 s.costs = s.costs + processed_states.back().color_state.costs;
2265
2266 border_states.push_back({ (int)(processed_states.size()-1), ops[i], s });
2267 }
2268 }
2269 }
2270 }
2271
2272 return false;
2273 }
2274
2275
2276 void ColorConversionPipeline::debug_dump_pipeline() const
2277 {
2278 for (const auto& op : m_operations) {
2279 std::cerr << "> " << typeid(*op).name() << "\n";
2280 }
2281 }
2282
2283
2284 std::shared_ptr<HeifPixelImage> ColorConversionPipeline::convert_image(const std::shared_ptr<HeifPixelImage>& input)
2285 {
2286 std::shared_ptr<HeifPixelImage> in = input;
2287 std::shared_ptr<HeifPixelImage> out = in;
2288
2289 for (const auto& op : m_operations) {
2290 out = op->convert_colorspace(in, m_target_state, m_options);
2291 assert(out);
2292
2293 in = out;
2294 }
2295
2296 return out;
2297 }
0 /*
1 * HEIF codec.
2 * Copyright (c) 2017 struktur AG, Dirk Farin <farin@struktur.de>
3 *
4 * This file is part of libheif.
5 *
6 * libheif is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of
9 * the License, or (at your option) any later version.
10 *
11 * libheif is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with libheif. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21 #include "heif_image.h"
22 #include <memory>
23 #include <vector>
24
25
26 namespace heif {
27
28 struct ColorState
29 {
30 heif_colorspace colorspace = heif_colorspace_undefined;
31 heif_chroma chroma = heif_chroma_undefined;
32 bool has_alpha = false;
33 int bits_per_pixel = 8;
34
35 bool operator==(const ColorState&) const;
36 };
37
38
39 enum class ColorConversionCriterion {
40 Speed,
41 Quality,
42 Memory,
43 Balanced
44 };
45
46
47 struct ColorConversionCosts {
48 ColorConversionCosts() = default;
49
50 ColorConversionCosts(float _speed, float _quality, float _memory) {
51 speed = _speed;
52 quality = _quality;
53 memory = _memory;
54 }
55
56 float speed = 0;
57 float quality = 0;
58 float memory = 0;
59
60 ColorConversionCosts operator+(const ColorConversionCosts& b) const {
61 return { speed + b.speed,
62 quality + b.quality,
63 memory + b.memory };
64 }
65
66 float total(ColorConversionCriterion) const {
67 return speed * 0.3f + quality * 0.6f + memory * 0.1f;
68 }
69 };
70
71
72 struct ColorConversionOptions
73 {
74 ColorConversionCriterion criterion = ColorConversionCriterion::Balanced;
75 };
76
77
78 struct ColorStateWithCost
79 {
80 ColorState color_state;
81 ColorConversionCosts costs;
82 };
83
84
85 class ColorConversionOperation
86 {
87 public:
88 virtual ~ColorConversionOperation() = default;
89
90 // We specify the target state to control the conversion into a direction that is most
91 // suitable for reaching the target state. That allows one conversion operation to
92 // provide a range of conversion options.
93 // Also returns the cost for this conversion.
94 virtual std::vector<ColorStateWithCost>
95 state_after_conversion(ColorState input_state,
96 ColorState target_state,
97 ColorConversionOptions options = ColorConversionOptions()) = 0;
98
99 virtual std::shared_ptr<HeifPixelImage>
100 convert_colorspace(const std::shared_ptr<const HeifPixelImage>& input,
101 ColorState target_state,
102 ColorConversionOptions options = ColorConversionOptions()) = 0;
103 };
104
105
106 class ColorConversionPipeline
107 {
108 public:
109 bool construct_pipeline(ColorState input_state,
110 ColorState target_state,
111 ColorConversionOptions options = ColorConversionOptions());
112
113 std::shared_ptr<HeifPixelImage>
114 convert_image(const std::shared_ptr<HeifPixelImage>& input);
115
116 void debug_dump_pipeline() const;
117
118 private:
119 std::vector<std::shared_ptr<ColorConversionOperation>> m_operations;
120 ColorState m_target_state;
121 ColorConversionOptions m_options;
122 };
123
124 }
127127
128128 uint32_t get_width() const { return m_output_width; }
129129 uint32_t get_height() const { return m_output_height; }
130 uint16_t get_rows() const { return m_rows; }
131 uint16_t get_columns() const { return m_columns; }
130 uint16_t get_rows() const { assert(m_rows<=256); return m_rows; }
131 uint16_t get_columns() const { assert(m_columns<=256); return m_columns; }
132132
133133 private:
134134 uint16_t m_rows;
308308
309309 void ImageOverlay::get_offset(size_t image_index, int32_t* x, int32_t* y) const
310310 {
311 assert(image_index>=0 && image_index<m_offsets.size());
311 assert(image_index<m_offsets.size());
312312 assert(x && y);
313313
314314 *x = m_offsets[image_index].x;
326326
327327 HeifContext::~HeifContext()
328328 {
329 // Break circular references
330 for (auto& it : m_all_images) {
331 std::shared_ptr<Image> image = it.second;
332 image->get_thumbnails().clear();
333 image->set_alpha_channel(nullptr);
334 image->set_depth_channel(nullptr);
335 }
329336 }
330337
331338 Error HeifContext::read(std::shared_ptr<StreamReader> reader)
524531 "Thumbnail references another thumbnail");
525532 }
526533
534 if (image.get() == master_iter->second.get()) {
535 return Error(heif_error_Invalid_input,
536 heif_suberror_Nonexisting_item_referenced,
537 "Recursive thumbnail image detected");
538 }
527539 master_iter->second->add_thumbnail(image);
528540
529541 remove_top_level_image(image);
570582 image->set_is_alpha_channel_of(refs[0]);
571583
572584 auto master_iter = m_all_images.find(refs[0]);
585 if (master_iter == m_all_images.end()) {
586 return Error(heif_error_Invalid_input,
587 heif_suberror_Nonexisting_item_referenced,
588 "Non-existing alpha image referenced");
589 }
590 if (image.get() == master_iter->second.get()) {
591 return Error(heif_error_Invalid_input,
592 heif_suberror_Nonexisting_item_referenced,
593 "Recursive alpha image detected");
594 }
573595 master_iter->second->set_alpha_channel(image);
574596 }
575597
580602 image->set_is_depth_channel_of(refs[0]);
581603
582604 auto master_iter = m_all_images.find(refs[0]);
605 if (master_iter == m_all_images.end()) {
606 return Error(heif_error_Invalid_input,
607 heif_suberror_Nonexisting_item_referenced,
608 "Non-existing depth image referenced");
609 }
610 if (image.get() == master_iter->second.get()) {
611 return Error(heif_error_Invalid_input,
612 heif_suberror_Nonexisting_item_referenced,
613 "Recursive depth image detected");
614 }
583615 master_iter->second->set_depth_channel(image);
584616
585617 auto subtypes = auxC_property->get_subtypes();
780812 }
781813
782814
783 heif_item_id HeifContext::get_id_of_non_virtual_child_image(heif_item_id id) const
815 Error HeifContext::get_id_of_non_virtual_child_image(heif_item_id id, heif_item_id& out) const
784816 {
785817 std::string image_type = m_heif_file->get_item_type(id);
786818 if (image_type=="grid" ||
787819 image_type=="iden" ||
788820 image_type=="iovl") {
789821 auto iref_box = m_heif_file->get_iref_box();
822 if (!iref_box) {
823 return Error(heif_error_Invalid_input,
824 heif_suberror_No_item_data,
825 "Derived image does not reference any other image items");
826 }
827
790828 std::vector<heif_item_id> image_references = iref_box->get_references(id, fourcc("dimg"));
791829
792830 // TODO: check whether this really can be recursive (e.g. overlay of grid images)
793 return get_id_of_non_virtual_child_image(image_references[0]);
831
832 if (image_references.empty()) {
833 return Error(heif_error_Invalid_input,
834 heif_suberror_No_item_data,
835 "Derived image does not reference any other image items");
836 }
837 else {
838 return get_id_of_non_virtual_child_image(image_references[0], out);
839 }
794840 }
795841 else {
796 return id;
842 out = id;
843 return Error::Ok;
797844 }
798845 }
799846
800847
801848 int HeifContext::Image::get_luma_bits_per_pixel() const
802849 {
803 heif_item_id id = m_heif_context->get_id_of_non_virtual_child_image(m_id);
850 heif_item_id id;
851 Error err = m_heif_context->get_id_of_non_virtual_child_image(m_id, id);
852 if (err) {
853 return -1;
854 }
855
804856 return m_heif_context->m_heif_file->get_luma_bits_per_pixel_from_configuration(id);
805857 }
806858
807859
808860 int HeifContext::Image::get_chroma_bits_per_pixel() const
809861 {
810 heif_item_id id = m_heif_context->get_id_of_non_virtual_child_image(m_id);
862 heif_item_id id;
863 Error err = m_heif_context->get_id_of_non_virtual_child_image(m_id, id);
864 if (err) {
865 return -1;
866 }
867
811868 return m_heif_context->m_heif_file->get_chroma_bits_per_pixel_from_configuration(id);
812869 }
813870
833890 bool different_colorspace = (target_colorspace != img->get_colorspace());
834891
835892 if (different_chroma || different_colorspace) {
836 img = img->convert_colorspace(target_colorspace, target_chroma);
893 img = convert_colorspace(img, target_colorspace, target_chroma);
837894 if (!img) {
838895 return Error(heif_error_Unsupported_feature, heif_suberror_Unsupported_color_conversion);
839896 }
13711428 "Number of image offsets does not match the number of image references");
13721429 }
13731430
1374 int w = overlay.get_canvas_width();
1375 int h = overlay.get_canvas_height();
1431 uint32_t w = overlay.get_canvas_width();
1432 uint32_t h = overlay.get_canvas_height();
13761433
13771434 if (w >= MAX_IMAGE_WIDTH || h >= MAX_IMAGE_HEIGHT) {
13781435 std::stringstream sstr;
14091466 return err;
14101467 }
14111468
1412 overlay_img = overlay_img->convert_colorspace(heif_colorspace_RGB, heif_chroma_444);
1469 overlay_img = convert_colorspace(overlay_img, heif_colorspace_RGB, heif_chroma_444);
14131470 if (!overlay_img) {
14141471 return Error(heif_error_Unsupported_feature, heif_suberror_Unsupported_color_conversion);
14151472 }
16141671 if (colorspace != image->get_colorspace() ||
16151672 chroma != image->get_chroma_format()) {
16161673 // @TODO: use color profile when converting
1617 image = image->convert_colorspace(colorspace, chroma);
1674 image = convert_colorspace(image, colorspace, chroma);
16181675 }
16191676
16201677
277277 std::shared_ptr<HeifPixelImage>& img,
278278 const std::vector<uint8_t>& overlay_data) const;
279279
280 heif_item_id get_id_of_non_virtual_child_image(heif_item_id) const;
280 Error get_id_of_non_virtual_child_image(heif_item_id in, heif_item_id& out) const;
281281 };
282282 }
283283
114114
115115 int w = de265_get_image_width(de265img, c);
116116 int h = de265_get_image_height(de265img, c);
117 if (w < 0 || h < 0) {
118 heif_image_release(out_img);
119 struct heif_error err = { heif_error_Decoder_plugin_error,
120 heif_suberror_Invalid_image_size,
121 kEmptyString };
122 return err;
123 }
117124
118125 err = heif_image_add_plane(out_img, channel2plane[c], w,h, bpp);
119126 if (err.code != heif_error_Ok) {
280287 // TODO(farindk): Set "err" if no image was decoded.
281288 int more;
282289 de265_error decode_err;
290 *out_img = nullptr;
283291 do {
284292 more = 0;
285293 decode_err = de265_decode(decoder->ctx, &more);
290298
291299 const struct de265_image* image = de265_get_next_picture(decoder->ctx);
292300 if (image) {
301 // TODO(farindk): Should we return the first image instead?
302 if (*out_img) {
303 heif_image_release(*out_img);
304 }
293305 err = convert_libde265_image_to_heif_image(decoder, image, out_img);
294306
295307 de265_release_next_picture(decoder->ctx);
222222 .value("heif_suberror_Security_limit_exceeded",heif_suberror_Security_limit_exceeded)
223223 .value("heif_suberror_Unknown_color_profile_type",heif_suberror_Unknown_color_profile_type)
224224 .value("heif_suberror_Wrong_tile_image_chroma_format",heif_suberror_Wrong_tile_image_chroma_format)
225 .value("heif_suberror_Invalid_fractional_number",heif_suberror_Invalid_fractional_number)
226 .value("heif_suberror_Invalid_image_size",heif_suberror_Invalid_image_size)
225227 .value("heif_suberror_Nonexisting_item_referenced",heif_suberror_Nonexisting_item_referenced)
226228 .value("heif_suberror_Null_pointer_argument",heif_suberror_Null_pointer_argument)
227229 .value("heif_suberror_Nonexisting_image_channel_referenced",heif_suberror_Nonexisting_image_channel_referenced)
3636 }
3737
3838
39 const char* kError_unsuppoerted_bit_depth = "Bit depth not supported by x265";
39 const char* kError_unsupported_bit_depth = "Bit depth not supported by x265";
40 const char* kError_unsupported_image_size = "Images smaller than 16 pixels are not supported";
4041
4142
4243 enum parameter_type { UndefinedType, Int, Bool, String };
5455
5556 struct encoder_struct_x265
5657 {
57 x265_encoder* encoder;
58
59 x265_nal* nals;
60 uint32_t num_nals;
61 uint32_t nal_output_counter;
62 int bit_depth;
58 x265_encoder* encoder = nullptr;
59
60 x265_nal* nals = nullptr;
61 uint32_t num_nals = 0;
62 uint32_t nal_output_counter = 0;
63 int bit_depth = 0;
6364
6465 // --- parameters
6566
539540
540541 static void x265_query_input_colorspace(heif_colorspace* colorspace, heif_chroma* chroma)
541542 {
542 *colorspace = heif_colorspace_YCbCr;
543 *chroma = heif_chroma_420;
543 if (*colorspace == heif_colorspace_monochrome) {
544 *colorspace = heif_colorspace_monochrome;
545 *chroma = heif_chroma_monochrome;
546 }
547 else {
548 *colorspace = heif_colorspace_YCbCr;
549 *chroma = heif_chroma_420;
550 }
544551 }
545552
546553
559566
560567
561568 int bit_depth = heif_image_get_bits_per_pixel(image, heif_channel_Y);
569 bool isGreyscale = (heif_image_get_colorspace(image) == heif_colorspace_monochrome);
562570
563571 const x265_api* api = x265_api_get(bit_depth);
564572 if (api==nullptr) {
565573 struct heif_error err = {
566574 heif_error_Encoder_plugin_error,
567575 heif_suberror_Unsupported_bit_depth,
568 kError_unsuppoerted_bit_depth
576 kError_unsupported_bit_depth
569577 };
570578 return err;
571579 }
576584 if (bit_depth == 8) api->param_apply_profile(param, "mainstillpicture");
577585 else if (bit_depth == 10) api->param_apply_profile(param, "main10-intra");
578586 else if (bit_depth == 12) api->param_apply_profile(param, "main12-intra");
579 else return heif_error_unsupported_parameter;
587 else {
588 api->param_free(param);
589 return heif_error_unsupported_parameter;
590 }
580591
581592
582593 param->fpsNum = 1;
583594 param->fpsDenom = 1;
595
596
597 // x265 cannot encode images smaller than one CTU size
598 // https://bitbucket.org/multicoreware/x265/issues/475/x265-does-not-allow-image-sizes-smaller
599 // -> use smaller CTU sizes for very small images
600 char ctu_buf[4];
601 int ctuSize = 64;
602 #if 0
603 while (heif_image_get_width(image, heif_channel_Y) < ctuSize ||
604 heif_image_get_height(image, heif_channel_Y) < ctuSize) {
605 ctuSize /= 2;
606 }
607
608 if (ctuSize < 16) {
609 api->param_free(param);
610 struct heif_error err = {
611 heif_error_Encoder_plugin_error,
612 heif_suberror_Invalid_parameter_value,
613 kError_unsupported_image_size
614 };
615 return err;
616 }
617 #else
618 // TODO: There seems to be a bug in x265 where increasing the CTU size between
619 // multiple encoding jobs causes a segmentation fault. E.g. encoding multiple
620 // times with a CTU of 16 works, the next encoding with a CTU of 32 crashes.
621 // Use hardcoded value of 64 and reject images that are too small.
622 if (heif_image_get_width(image, heif_channel_Y) < ctuSize ||
623 heif_image_get_height(image, heif_channel_Y) < ctuSize) {
624 api->param_free(param);
625 struct heif_error err = {
626 heif_error_Encoder_plugin_error,
627 heif_suberror_Invalid_parameter_value,
628 kError_unsupported_image_size
629 };
630 return err;
631 }
632 #endif
633
634 int s = snprintf(ctu_buf,4,"%d",ctuSize);
635 assert(s<4);
584636
585637 // BPG uses CQP. It does not seem to be better though.
586638 // param->rc.rateControlMode = X265_RC_CQP;
587639 // param->rc.qp = (100 - encoder->quality)/2;
588640 param->totalFrames = 1;
589 param->internalCsp = X265_CSP_I420;
641 param->internalCsp = isGreyscale ? X265_CSP_I400 : X265_CSP_I420;
590642 api->param_parse(param, "info", "0");
591643 api->param_parse(param, "limit-modes", "0");
592644 api->param_parse(param, "limit-refs", "0");
593 api->param_parse(param, "ctu", "64");
645 api->param_parse(param, "ctu", ctu_buf);
594646 api->param_parse(param, "rskip", "0");
595647
596648 api->param_parse(param, "rect", "1");
608660 // quality=50 -> crf=25
609661 // quality=100 -> crf=0
610662
611 param->rc.rfConstant = (100 - p.value_int)/2;
663 param->rc.rfConstant = (100 - p.value_int)/2.0;
612664 }
613665 else if (p.name == heif_encoder_parameter_name_lossless) {
614666 param->bLossless = p.value_int;
647699 param->internalBitDepth = bit_depth;
648700
649701
650
651702 x265_picture* pic = api->picture_alloc();
652703 api->picture_init(param, pic);
653704
654 pic->planes[0] = (void*)heif_image_get_plane_readonly(image, heif_channel_Y, &pic->stride[0]);
655 pic->planes[1] = (void*)heif_image_get_plane_readonly(image, heif_channel_Cb, &pic->stride[1]);
656 pic->planes[2] = (void*)heif_image_get_plane_readonly(image, heif_channel_Cr, &pic->stride[2]);
705 if (isGreyscale) {
706 pic->planes[0] = (void*)heif_image_get_plane_readonly(image, heif_channel_Y, &pic->stride[0]);
707 }
708 else {
709 pic->planes[0] = (void*)heif_image_get_plane_readonly(image, heif_channel_Y, &pic->stride[0]);
710 pic->planes[1] = (void*)heif_image_get_plane_readonly(image, heif_channel_Cb, &pic->stride[1]);
711 pic->planes[2] = (void*)heif_image_get_plane_readonly(image, heif_channel_Cr, &pic->stride[2]);
712 }
713
657714 pic->bitDepth = bit_depth;
658715
659716
353353 }
354354
355355 assert(false);
356 return heif_chroma_420;
356 return heif_chroma_undefined;
357357 }
358358
359359
366366 }
367367
368368 assert(false);
369 return 8;
369 return -1;
370370 }
371371
372372
379379 }
380380
381381 assert(false);
382 return 8;
382 return -1;
383383 }
384384
385385
1919
2020
2121 #include "heif_image.h"
22 #include "heif_colorconversion.h"
2223
2324 #include <assert.h>
2425 #include <string.h>
7576 {
7677 }
7778
79 static int num_interleaved_pixels_per_plane(heif_chroma chroma) {
80 switch (chroma) {
81 case heif_chroma_undefined:
82 case heif_chroma_monochrome:
83 case heif_chroma_420:
84 case heif_chroma_422:
85 case heif_chroma_444:
86 return 1;
87
88 case heif_chroma_interleaved_RGB:
89 case heif_chroma_interleaved_RRGGBB_BE:
90 case heif_chroma_interleaved_RRGGBB_LE:
91 return 3;
92
93 case heif_chroma_interleaved_RGBA:
94 case heif_chroma_interleaved_RRGGBBAA_BE:
95 case heif_chroma_interleaved_RRGGBBAA_LE:
96 return 4;
97 }
98
99 assert(false);
100 return 0;
101 }
102
103
78104 void HeifPixelImage::create(int width,int height, heif_colorspace colorspace, heif_chroma chroma)
79105 {
80106 m_width = width;
83109 m_chroma = chroma;
84110 }
85111
86 void HeifPixelImage::add_plane(heif_channel channel, int width, int height, int bit_depth)
87 {
112 bool HeifPixelImage::add_plane(heif_channel channel, int width, int height, int bit_depth)
113 {
114 assert(width >= 0);
115 assert(height >= 0);
88116 assert(bit_depth >= 1);
117
118 // use 16 byte alignment
119 int alignment = 16; // must be power of two
89120
90121 ImagePlane plane;
91122 plane.width = width;
92123 plane.height = height;
124
125
126 // for backwards compatibility, allow for 24/32 bits for RGB/RGBA interleaved chromas
127
128 if (m_chroma == heif_chroma_interleaved_RGB && bit_depth==24) {
129 bit_depth = 8;
130 }
131
132 if (m_chroma == heif_chroma_interleaved_RGBA && bit_depth==32) {
133 bit_depth = 8;
134 }
135
93136 plane.bit_depth = bit_depth;
94137
95 int bytes_per_pixel = (bit_depth+7)/8;
138
139 int bytes_per_component = (bit_depth+7)/8;
140 int bytes_per_pixel = num_interleaved_pixels_per_plane(m_chroma) * bytes_per_component;
141
96142 plane.stride = width * bytes_per_pixel;
97143
98 plane.mem.resize(width * height * bytes_per_pixel);
99
100 m_planes.insert(std::make_pair(channel, std::move(plane)));
144 plane.stride = (plane.stride+alignment-1) & ~(alignment-1);
145
146 try {
147 plane.unaligned_mem.resize(height * plane.stride + alignment-1);
148 plane.mem = plane.unaligned_mem.data();
149
150 // shift beginning of image data to aligned memory position
151
152 auto mem_start_addr = (uint64_t)plane.mem;
153 auto mem_start_offset = (mem_start_addr & (alignment-1));
154 if (mem_start_offset != 0) {
155 plane.mem += alignment - mem_start_offset;
156 }
157
158 m_planes.insert(std::make_pair(channel, std::move(plane)));
159 }
160 catch (const std::bad_alloc& excpt) {
161 return false;
162 }
163
164 return true;
101165 }
102166
103167
150214 }
151215
152216
217 int HeifPixelImage::get_storage_bits_per_pixel(enum heif_channel channel) const
218 {
219 if (channel == heif_channel_interleaved) {
220 auto chroma = get_chroma_format();
221 switch (chroma) {
222 case heif_chroma_interleaved_RGB:
223 return 24;
224 case heif_chroma_interleaved_RGBA:
225 return 32;
226 case heif_chroma_interleaved_RRGGBB_BE:
227 case heif_chroma_interleaved_RRGGBB_LE:
228 return 48;
229 case heif_chroma_interleaved_RRGGBBAA_BE:
230 case heif_chroma_interleaved_RRGGBBAA_LE:
231 return 64;
232 default:
233 return -1; // invalid channel/chroma specification
234 }
235 }
236 else {
237 return (get_bits_per_pixel(channel) + 7) & ~7;
238 }
239 }
240
241
153242 int HeifPixelImage::get_bits_per_pixel(enum heif_channel channel) const
154243 {
155244 auto iter = m_planes.find(channel);
172261 *out_stride = iter->second.stride;
173262 }
174263
175 return iter->second.mem.data();
264 return iter->second.mem;
176265 }
177266
178267
187276 *out_stride = iter->second.stride;
188277 }
189278
190 return iter->second.mem.data();
191 }
192
193
194 void HeifPixelImage::copy_new_plane_from(const std::shared_ptr<HeifPixelImage> src_image,
279 return iter->second.mem;
280 }
281
282
283 void HeifPixelImage::copy_new_plane_from(const std::shared_ptr<const HeifPixelImage>& src_image,
195284 heif_channel src_channel,
196285 heif_channel dst_channel)
197286 {
209298 src = src_image->get_plane(src_channel, &src_stride);
210299 dst = get_plane(dst_channel, &dst_stride);
211300
212 int bpl = width * ((src_image->get_bits_per_pixel(src_channel)+7)/8);
301 int bpl = width * src_image->get_storage_bits_per_pixel(src_channel);
213302
214303 for (int y=0;y<height;y++) {
215304 memcpy(dst+y*dst_stride, src+y*src_stride, bpl);
243332 }
244333
245334
246 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_colorspace(heif_colorspace target_colorspace,
247 heif_chroma target_chroma) const
248 {
249 std::shared_ptr<HeifPixelImage> out_img;
250
251
252 if (target_colorspace != get_colorspace()) {
253
254 // --- YCbCr -> RGB
255
256 if (get_colorspace() == heif_colorspace_YCbCr &&
257 target_colorspace == heif_colorspace_RGB) {
258
259 // 4:2:0 input -> 4:4:4 planes
260
261 if (get_chroma_format() == heif_chroma_420 &&
262 target_chroma == heif_chroma_444) {
263 out_img = convert_YCbCr420_to_RGB();
264 }
265
266 // 4:2:0 input -> RGB 24bit
267
268 if (get_chroma_format() == heif_chroma_420 &&
269 target_chroma == heif_chroma_interleaved_RGB) {
270 out_img = convert_YCbCr420_to_RGB24();
271 }
272
273 // 4:2:0 input -> RGBA 32bit
274
275 if (get_chroma_format() == heif_chroma_420 &&
276 target_chroma == heif_chroma_interleaved_RGBA) {
277 out_img = convert_YCbCr420_to_RGB32();
278 }
279
280 // 4:2:0 input -> HDR RGB, big endian
281
282 if (get_chroma_format() == heif_chroma_420 &&
283 (target_chroma == heif_chroma_interleaved_RRGGBB_BE ||
284 target_chroma == heif_chroma_interleaved_RRGGBBAA_BE)) {
285 std::shared_ptr<HeifPixelImage> tmpImg = convert_YCbCr420_to_RGB_HDR();
286 out_img = tmpImg->convert_RGB_to_RRGGBBaa_BE();
287 }
288
289
290 // greyscale -> RGB 24bit
291
292 if (get_chroma_format() == heif_chroma_monochrome &&
293 target_chroma == heif_chroma_interleaved_RGB) {
294 out_img = convert_mono_to_RGB(3);
295 }
296
297 // greyscale -> RGB 32bit
298
299 if (get_chroma_format() == heif_chroma_monochrome &&
300 target_chroma == heif_chroma_interleaved_RGBA) {
301 out_img = convert_mono_to_RGB(4);
302 }
303 }
304 else if (get_colorspace() == heif_colorspace_RGB &&
305 target_colorspace == heif_colorspace_YCbCr) {
306
307 // --- RGB -> YCbCr
308
309 if (get_chroma_format() == heif_chroma_444) {
310 if (get_bits_per_pixel(heif_channel_G) != get_bits_per_pixel(heif_channel_R) ||
311 get_bits_per_pixel(heif_channel_B) != get_bits_per_pixel(heif_channel_R)) {
312 assert(false); // TODO: different bit depths for each channel
313 }
314
315 if (has_alpha()) {
316 if (get_bits_per_pixel(heif_channel_Alpha) != get_bits_per_pixel(heif_channel_R)) {
317 assert(false); // TODO: different bit depths for each channel
318 }
319 }
320 }
321
322 if ((get_chroma_format() == heif_chroma_interleaved_RGB ||
323 get_chroma_format() == heif_chroma_interleaved_RGBA) &&
324 target_chroma == heif_chroma_420) {
325 out_img = convert_RGB24_32_to_YCbCr420();
326 }
327
328 if (get_chroma_format() == heif_chroma_444) {
329 std::shared_ptr<HeifPixelImage> img_rgb = convert_RGB_to_RGB24_32();
330 out_img = img_rgb->convert_RGB24_32_to_YCbCr420();
331 }
332 }
333
334 if (get_chroma_format() == heif_chroma_444 &&
335 get_bits_per_pixel(heif_channel_R) > 8 &&
336 target_chroma == heif_chroma_420) {
337 out_img = convert_RGB_to_YCbCr420_HDR();
338 }
339 }
340 else { // same colorspace
341 if (target_colorspace == heif_colorspace_RGB) {
342 if (get_chroma_format() == heif_chroma_444 &&
343 target_chroma == heif_chroma_interleaved_RGB) {
344 out_img = convert_RGB_to_RGB24_32();
345 }
346
347 if (get_chroma_format() == heif_chroma_444 &&
348 (target_chroma == heif_chroma_interleaved_RRGGBB_BE ||
349 target_chroma == heif_chroma_interleaved_RRGGBBAA_BE)) {
350 out_img = convert_RGB_to_RRGGBBaa_BE();
351 }
352 }
353
354
355 if (target_colorspace == heif_colorspace_YCbCr) {
356 if (get_chroma_format() == heif_chroma_monochrome &&
357 target_chroma == heif_chroma_420) {
358 out_img = convert_mono_to_YCbCr420();
359 }
360 }
361 }
362
363
364 if (!out_img) {
365 // TODO: unsupported conversion
366 }
367
368 return out_img;
369 }
370
371
372 static inline uint8_t clip(float fx)
373 {
374 int x = static_cast<int>(fx);
375 if (x<0) return 0;
376 if (x>255) return 255;
377 return static_cast<uint8_t>(x);
378 }
379
380
381 static inline uint16_t clip(float fx,int32_t maxi)
382 {
383 int x = static_cast<int>(fx);
384 if (x<0) return 0;
385 if (x>maxi) return (uint16_t)maxi;
386 return static_cast<uint16_t>(x);
387 }
388
389
390 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_YCbCr420_to_RGB() const
391 {
392 if (get_bits_per_pixel(heif_channel_Y) != 8 ||
393 get_bits_per_pixel(heif_channel_Cb) != 8 ||
394 get_bits_per_pixel(heif_channel_Cr) != 8) {
335 static bool is_chroma_with_alpha(heif_chroma chroma) {
336 switch (chroma) {
337 case heif_chroma_undefined:
338 case heif_chroma_monochrome:
339 case heif_chroma_420:
340 case heif_chroma_422:
341 case heif_chroma_444:
342 case heif_chroma_interleaved_RGB:
343 case heif_chroma_interleaved_RRGGBB_BE:
344 case heif_chroma_interleaved_RRGGBB_LE:
345 return false;
346
347 case heif_chroma_interleaved_RGBA:
348 case heif_chroma_interleaved_RRGGBBAA_BE:
349 case heif_chroma_interleaved_RRGGBBAA_LE:
350 return true;
351 }
352
353 assert(false);
354 return false;
355 }
356
357
358 std::shared_ptr<HeifPixelImage> heif::convert_colorspace(const std::shared_ptr<HeifPixelImage>& input,
359 heif_colorspace target_colorspace,
360 heif_chroma target_chroma)
361 {
362 ColorState input_state;
363 input_state.colorspace = input->get_colorspace();
364 input_state.chroma = input->get_chroma_format();
365 input_state.has_alpha = input->has_channel(heif_channel_Alpha) || is_chroma_with_alpha(input->get_chroma_format());
366
367 std::set<enum heif_channel> channels = input->get_channel_set();
368 assert(!channels.empty());
369 input_state.bits_per_pixel = input->get_bits_per_pixel(*(channels.begin()));
370
371 ColorState output_state = input_state;
372 output_state.colorspace = target_colorspace;
373 output_state.chroma = target_chroma;
374
375
376 ColorConversionPipeline pipeline;
377 bool success = pipeline.construct_pipeline(input_state, output_state);
378 if (!success) {
395379 return nullptr;
396380 }
397381
398 auto outimg = std::make_shared<HeifPixelImage>();
399
400 int bpp = 8; // TODO: how do we specify the output BPPs ?
401
402 outimg->create(m_width, m_height, heif_colorspace_RGB, heif_chroma_444);
403
404 outimg->add_plane(heif_channel_R, m_width, m_height, bpp);
405 outimg->add_plane(heif_channel_G, m_width, m_height, bpp);
406 outimg->add_plane(heif_channel_B, m_width, m_height, bpp);
407
408 bool has_alpha = has_channel(heif_channel_Alpha);
409 if (has_alpha) {
410 outimg->add_plane(heif_channel_Alpha, m_width, m_height, bpp);
411 }
412
413 const uint8_t *in_y,*in_cb,*in_cr,*in_a;
414 int in_y_stride=0, in_cb_stride=0, in_cr_stride=0, in_a_stride=0;
415
416 uint8_t *out_r,*out_g,*out_b,*out_a;
417 int out_r_stride=0, out_g_stride=0, out_b_stride=0, out_a_stride=0;
418
419 in_y = get_plane(heif_channel_Y, &in_y_stride);
420 in_cb = get_plane(heif_channel_Cb, &in_cb_stride);
421 in_cr = get_plane(heif_channel_Cr, &in_cr_stride);
422 out_r = outimg->get_plane(heif_channel_R, &out_r_stride);
423 out_g = outimg->get_plane(heif_channel_G, &out_g_stride);
424 out_b = outimg->get_plane(heif_channel_B, &out_b_stride);
425
426 if (has_alpha) {
427 in_a = get_plane(heif_channel_Alpha, &in_a_stride);
428 out_a = outimg->get_plane(heif_channel_Alpha, &out_a_stride);
429 }
430 else {
431 in_a = nullptr;
432 out_a = nullptr;
433 }
434
435 int x,y;
436 for (y=0;y<m_height;y++) {
437 for (x=0;x<m_width;x++) {
438 float yv = static_cast<float>(in_y [y *in_y_stride + x] );
439 float cb = static_cast<float>(in_cb[y/2*in_cb_stride + x/2]-128);
440 float cr = static_cast<float>(in_cr[y/2*in_cr_stride + x/2]-128);
441
442 out_r[y*out_r_stride + x] = clip(yv + 1.402f*cr);
443 out_g[y*out_g_stride + x] = clip(yv - 0.344136f*cb - 0.714136f*cr);
444 out_b[y*out_b_stride + x] = clip(yv + 1.772f*cb);
445 }
446
447 if (has_alpha) {
448 memcpy(&out_a[y*out_a_stride], &in_a[y*in_a_stride], m_width);
449 }
450 }
451
452 return outimg;
453 }
454
455
456
457 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_YCbCr420_to_RGB_HDR() const
458 {
459 if (get_bits_per_pixel(heif_channel_Y) == 8 ||
460 get_bits_per_pixel(heif_channel_Cb) == 8 ||
461 get_bits_per_pixel(heif_channel_Cr) == 8) {
462 return nullptr;
463 }
464
465 auto outimg = std::make_shared<HeifPixelImage>();
466
467 // TODO: how do we specify the output BPPs ?
468 int bpp = get_bits_per_pixel(heif_channel_Y);
469
470 outimg->create(m_width, m_height, heif_colorspace_RGB, heif_chroma_444);
471
472 outimg->add_plane(heif_channel_R, m_width, m_height, bpp);
473 outimg->add_plane(heif_channel_G, m_width, m_height, bpp);
474 outimg->add_plane(heif_channel_B, m_width, m_height, bpp);
475
476 bool has_alpha = has_channel(heif_channel_Alpha);
477 if (has_alpha) {
478 outimg->add_plane(heif_channel_Alpha, m_width, m_height, bpp);
479 }
480
481 const uint16_t *in_y,*in_cb,*in_cr,*in_a;
482 int in_y_stride=0, in_cb_stride=0, in_cr_stride=0, in_a_stride=0;
483
484 uint16_t *out_r,*out_g,*out_b,*out_a;
485 int out_r_stride=0, out_g_stride=0, out_b_stride=0, out_a_stride=0;
486
487 in_y = (const uint16_t*)get_plane(heif_channel_Y, &in_y_stride);
488 in_cb = (const uint16_t*)get_plane(heif_channel_Cb, &in_cb_stride);
489 in_cr = (const uint16_t*)get_plane(heif_channel_Cr, &in_cr_stride);
490 out_r = (uint16_t*)outimg->get_plane(heif_channel_R, &out_r_stride);
491 out_g = (uint16_t*)outimg->get_plane(heif_channel_G, &out_g_stride);
492 out_b = (uint16_t*)outimg->get_plane(heif_channel_B, &out_b_stride);
493
494 if (has_alpha) {
495 in_a = (const uint16_t*)get_plane(heif_channel_Alpha, &in_a_stride);
496 out_a = (uint16_t*)outimg->get_plane(heif_channel_Alpha, &out_a_stride);
497 }
498 else {
499 in_a = nullptr;
500 out_a = nullptr;
501 }
502
503 in_y_stride /= 2;
504 in_cb_stride /= 2;
505 in_cr_stride /= 2;
506 in_a_stride /= 2;
507 out_r_stride /= 2;
508 out_g_stride /= 2;
509 out_b_stride /= 2;
510 out_a_stride /= 2;
511
512 uint16_t halfRange = (uint16_t)(1<<(bpp-1));
513 int32_t fullRange = (1<<bpp)-1;
514
515 int bdShift = 16-bpp;
516
517 int x,y;
518 for (y=0;y<m_height;y++) {
519 for (x=0;x<m_width;x++) {
520 float yv = static_cast<float>(in_y [y *in_y_stride + x] );
521 float cb = static_cast<float>(in_cb[y/2*in_cb_stride + x/2]-halfRange);
522 float cr = static_cast<float>(in_cr[y/2*in_cr_stride + x/2]-halfRange);
523
524 out_r[y*out_r_stride + x] = (uint16_t)(clip(yv + 1.402f*cr, fullRange) << bdShift);
525 out_g[y*out_g_stride + x] = (uint16_t)(clip(yv - 0.344136f*cb - 0.714136f*cr, fullRange) << bdShift);
526 out_b[y*out_b_stride + x] = (uint16_t)(clip(yv + 1.772f*cb, fullRange) << bdShift);
527 }
528
529 if (has_alpha) {
530 for (int x=0;x<m_width;x++) {
531 out_a[y*out_a_stride+x] = (uint16_t)(in_a[y*in_a_stride+x] << bdShift);
532 }
533 //memcpy(&out_a[y*out_a_stride], &in_a[y*in_a_stride], m_width *2);
534 }
535 }
536
537 return outimg;
538 }
539
540
541
542 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_YCbCr420_to_RGB24() const
543 {
544 if (get_bits_per_pixel(heif_channel_Y) != 8 ||
545 get_bits_per_pixel(heif_channel_Cb) != 8 ||
546 get_bits_per_pixel(heif_channel_Cr) != 8) {
547 return nullptr;
548 }
549
550 auto outimg = std::make_shared<HeifPixelImage>();
551
552 outimg->create(m_width, m_height, heif_colorspace_RGB, heif_chroma_interleaved_24bit);
553
554 outimg->add_plane(heif_channel_interleaved, m_width, m_height, 24);
555
556 const uint8_t *in_y,*in_cb,*in_cr;
557 int in_y_stride=0, in_cb_stride=0, in_cr_stride=0;
558
559 uint8_t *out_p;
560 int out_p_stride=0;
561
562 in_y = get_plane(heif_channel_Y, &in_y_stride);
563 in_cb = get_plane(heif_channel_Cb, &in_cb_stride);
564 in_cr = get_plane(heif_channel_Cr, &in_cr_stride);
565 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
566
567 int x,y;
568 for (y=0;y<m_height;y++) {
569 for (x=0;x<m_width;x++) {
570 float yv = static_cast<float>(in_y [y *in_y_stride + x] );
571 float cb = static_cast<float>(in_cb[y/2*in_cb_stride + x/2]-128);
572 float cr = static_cast<float>(in_cr[y/2*in_cr_stride + x/2]-128);
573
574 out_p[y*out_p_stride + 3*x + 0] = clip(yv + 1.402f*cr);
575 out_p[y*out_p_stride + 3*x + 1] = clip(yv - 0.344136f*cb - 0.714136f*cr);
576 out_p[y*out_p_stride + 3*x + 2] = clip(yv + 1.772f*cb);
577 }
578 }
579
580 return outimg;
581 }
582
583
584 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_YCbCr420_to_RGB32() const
585 {
586 if (get_bits_per_pixel(heif_channel_Y) != 8 ||
587 get_bits_per_pixel(heif_channel_Cb) != 8 ||
588 get_bits_per_pixel(heif_channel_Cr) != 8) {
589 return nullptr;
590 }
591
592 auto outimg = std::make_shared<HeifPixelImage>();
593
594 outimg->create(m_width, m_height, heif_colorspace_RGB, heif_chroma_interleaved_32bit);
595
596 outimg->add_plane(heif_channel_interleaved, m_width, m_height, 32);
597
598 const bool with_alpha = has_channel(heif_channel_Alpha);
599
600 const uint8_t *in_y,*in_cb,*in_cr,*in_a = nullptr;
601 int in_y_stride=0, in_cb_stride=0, in_cr_stride=0, in_a_stride=0;
602
603 uint8_t *out_p;
604 int out_p_stride=0;
605
606 in_y = get_plane(heif_channel_Y, &in_y_stride);
607 in_cb = get_plane(heif_channel_Cb, &in_cb_stride);
608 in_cr = get_plane(heif_channel_Cr, &in_cr_stride);
609 if (with_alpha) {
610 in_a = get_plane(heif_channel_Alpha, &in_a_stride);
611 }
612
613 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
614
615 int x,y;
616 for (y=0;y<m_height;y++) {
617 for (x=0;x<m_width;x++) {
618 float yv = static_cast<float>(in_y [y *in_y_stride + x]);
619 float cb = static_cast<float>(in_cb[y/2*in_cb_stride + x/2]-128);
620 float cr = static_cast<float>(in_cr[y/2*in_cr_stride + x/2]-128);
621
622 out_p[y*out_p_stride + 4*x + 0] = clip(yv + 1.402f*cr);
623 out_p[y*out_p_stride + 4*x + 1] = clip(yv - 0.344136f*cb - 0.714136f*cr);
624 out_p[y*out_p_stride + 4*x + 2] = clip(yv + 1.772f*cb);
625
626 if (with_alpha) {
627 out_p[y*out_p_stride + 4*x + 3] = in_a[y*in_a_stride + x];
628 }
629 else {
630 out_p[y*out_p_stride + 4*x + 3] = 0xFF;
631 }
632 }
633 }
634
635 return outimg;
636 }
637
638
639 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_RGB_to_RGB24_32() const
640 {
641 bool has_alpha = has_channel(heif_channel_Alpha);
642
643 if (get_bits_per_pixel(heif_channel_R) != 8 ||
644 get_bits_per_pixel(heif_channel_G) != 8 ||
645 get_bits_per_pixel(heif_channel_B) != 8) {
646 return nullptr;
647 }
648
649 if (has_alpha && get_bits_per_pixel(heif_channel_Alpha) != 8) {
650 return nullptr;
651 }
652
653 auto outimg = std::make_shared<HeifPixelImage>();
654
655 outimg->create(m_width, m_height, heif_colorspace_RGB,
656 has_alpha ? heif_chroma_interleaved_32bit : heif_chroma_interleaved_24bit);
657
658 outimg->add_plane(heif_channel_interleaved, m_width, m_height, has_alpha ? 32 : 24);
659
660 const uint8_t *in_r,*in_g,*in_b,*in_a=nullptr;
661 int in_r_stride=0, in_g_stride=0, in_b_stride=0, in_a_stride=0;
662
663 uint8_t *out_p;
664 int out_p_stride=0;
665
666 in_r = get_plane(heif_channel_R, &in_r_stride);
667 in_g = get_plane(heif_channel_G, &in_g_stride);
668 in_b = get_plane(heif_channel_B, &in_b_stride);
669 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
670
671 if (has_alpha) {
672 in_a = get_plane(heif_channel_Alpha, &in_a_stride);
673 }
674
675 int x,y;
676 for (y=0;y<m_height;y++) {
677
678 if (has_alpha) {
679 for (x=0;x<m_width;x++) {
680 out_p[y*out_p_stride + 4*x + 0] = in_r[x + y*in_r_stride];
681 out_p[y*out_p_stride + 4*x + 1] = in_g[x + y*in_g_stride];
682 out_p[y*out_p_stride + 4*x + 2] = in_b[x + y*in_b_stride];
683 out_p[y*out_p_stride + 4*x + 3] = in_a[x + y*in_a_stride];
684 }
685 }
686 else {
687 for (x=0;x<m_width;x++) {
688 out_p[y*out_p_stride + 3*x + 0] = in_r[x + y*in_r_stride];
689 out_p[y*out_p_stride + 3*x + 1] = in_g[x + y*in_g_stride];
690 out_p[y*out_p_stride + 3*x + 2] = in_b[x + y*in_b_stride];
691 }
692 }
693 }
694
695 return outimg;
696 }
697
698
699
700 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_RGB_to_RRGGBBaa_BE() const
701 {
702 bool has_alpha = has_channel(heif_channel_Alpha);
703
704 if (get_bits_per_pixel(heif_channel_R) == 8 ||
705 get_bits_per_pixel(heif_channel_G) == 8 ||
706 get_bits_per_pixel(heif_channel_B) == 8) {
707 return nullptr;
708 }
709
710 if (has_alpha && get_bits_per_pixel(heif_channel_Alpha) == 8) {
711 return nullptr;
712 }
713
714 auto outimg = std::make_shared<HeifPixelImage>();
715
716 outimg->create(m_width, m_height, heif_colorspace_RGB,
717 has_alpha ? heif_chroma_interleaved_RRGGBBAA_BE : heif_chroma_interleaved_RRGGBB_BE);
718
719 outimg->add_plane(heif_channel_interleaved, m_width, m_height, has_alpha ? 64 : 48);
720
721 const uint16_t *in_r,*in_g,*in_b,*in_a=nullptr;
722 int in_r_stride=0, in_g_stride=0, in_b_stride=0, in_a_stride=0;
723
724 uint8_t *out_p;
725 int out_p_stride=0;
726
727 in_r = (uint16_t*)get_plane(heif_channel_R, &in_r_stride);
728 in_g = (uint16_t*)get_plane(heif_channel_G, &in_g_stride);
729 in_b = (uint16_t*)get_plane(heif_channel_B, &in_b_stride);
730 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
731
732 if (has_alpha) {
733 in_a = (uint16_t*)get_plane(heif_channel_Alpha, &in_a_stride);
734 }
735
736 in_r_stride /= 2;
737 in_g_stride /= 2;
738 in_b_stride /= 2;
739 in_a_stride /= 2;
740
741 int x,y;
742 for (y=0;y<m_height;y++) {
743
744 if (has_alpha) {
745 for (x=0;x<m_width;x++) {
746 uint16_t r = in_r[x + y*in_r_stride];
747 uint16_t g = in_g[x + y*in_g_stride];
748 uint16_t b = in_b[x + y*in_b_stride];
749 uint16_t a = in_a[x + y*in_a_stride];
750 out_p[y*out_p_stride + 8*x + 0] = (uint8_t)(r>>8);
751 out_p[y*out_p_stride + 8*x + 1] = (uint8_t)(r & 0xFF);
752 out_p[y*out_p_stride + 8*x + 2] = (uint8_t)(g>>8);
753 out_p[y*out_p_stride + 8*x + 3] = (uint8_t)(g & 0xFF);
754 out_p[y*out_p_stride + 8*x + 4] = (uint8_t)(b>>8);
755 out_p[y*out_p_stride + 8*x + 5] = (uint8_t)(b & 0xFF);
756 out_p[y*out_p_stride + 8*x + 6] = (uint8_t)(a>>8);
757 out_p[y*out_p_stride + 8*x + 7] = (uint8_t)(a & 0xFF);
758 }
759 }
760 else {
761 for (x=0;x<m_width;x++) {
762 uint16_t r = in_r[x + y*in_r_stride];
763 uint16_t g = in_g[x + y*in_g_stride];
764 uint16_t b = in_b[x + y*in_b_stride];
765 out_p[y*out_p_stride + 6*x + 0] = (uint8_t)(r>>8);
766 out_p[y*out_p_stride + 6*x + 1] = (uint8_t)(r & 0xFF);
767 out_p[y*out_p_stride + 6*x + 2] = (uint8_t)(g>>8);
768 out_p[y*out_p_stride + 6*x + 3] = (uint8_t)(g & 0xFF);
769 out_p[y*out_p_stride + 6*x + 4] = (uint8_t)(b>>8);
770 out_p[y*out_p_stride + 6*x + 5] = (uint8_t)(b & 0xFF);
771 }
772 }
773 }
774
775 return outimg;
776 }
777
778
779 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_mono_to_YCbCr420() const
780 {
781 auto outimg = std::make_shared<HeifPixelImage>();
782
783 outimg->create(m_width, m_height, heif_colorspace_YCbCr, heif_chroma_420);
784
785 int chroma_width = (m_width+1)/2;
786 int chroma_height = (m_height+1)/2;
787
788 outimg->add_plane(heif_channel_Y, m_width, m_height, 8);
789 outimg->add_plane(heif_channel_Cb, chroma_width, chroma_height, 8);
790 outimg->add_plane(heif_channel_Cr, chroma_width, chroma_height, 8);
791 //outimg->transfer_plane_from_image_as(shared_from_this(), heif_channel_Y, heif_channel_Y);
792
793 uint8_t *out_cb,*out_cr,*out_y;
794 int out_cb_stride=0, out_cr_stride=0, out_y_stride=0;
795
796 const uint8_t *in_y;
797 int in_y_stride=0;
798
799 in_y = get_plane(heif_channel_Y, &in_y_stride);
800
801 out_y = outimg->get_plane(heif_channel_Y, &out_y_stride);
802 out_cb = outimg->get_plane(heif_channel_Cb, &out_cb_stride);
803 out_cr = outimg->get_plane(heif_channel_Cr, &out_cr_stride);
804
805 memset(out_cb, 128, out_cb_stride*chroma_height);
806 memset(out_cr, 128, out_cr_stride*chroma_height);
807
808 for (int y=0;y<m_height;y++) {
809 memcpy(out_y + y*out_y_stride,
810 in_y + y*in_y_stride,
811 m_width);
812 }
813
814 return outimg;
815 }
816
817
818 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_mono_to_RGB(int bpp) const
819 {
820 if (get_bits_per_pixel(heif_channel_Y) != 8) {
821 return nullptr;
822 }
823
824 auto outimg = std::make_shared<HeifPixelImage>();
825
826 if (bpp==3) {
827 outimg->create(m_width, m_height, heif_colorspace_RGB, heif_chroma_interleaved_24bit);
828 } else {
829 outimg->create(m_width, m_height, heif_colorspace_RGB, heif_chroma_interleaved_32bit);
830 }
831
832 outimg->add_plane(heif_channel_interleaved, m_width, m_height, bpp*8);
833
834 const uint8_t *in_y;
835 int in_y_stride=0;
836
837 uint8_t *out_p;
838 int out_p_stride=0;
839
840 in_y = get_plane(heif_channel_Y, &in_y_stride);
841 out_p = outimg->get_plane(heif_channel_interleaved, &out_p_stride);
842
843 int x,y;
844 for (y=0;y<m_height;y++) {
845 if (bpp==3) {
846 for (x=0;x<m_width;x++) {
847 uint8_t v = in_y[x + y*in_y_stride];
848 out_p[y*out_p_stride + 3*x + 0] = v;
849 out_p[y*out_p_stride + 3*x + 1] = v;
850 out_p[y*out_p_stride + 3*x + 2] = v;
851 }
852 }
853 else {
854 // TODO: monochrome with alpha channel
855
856 for (x=0;x<m_width;x++) {
857 uint8_t v = in_y[x + y*in_y_stride];
858 out_p[y*out_p_stride + 4*x + 0] = v;
859 out_p[y*out_p_stride + 4*x + 1] = v;
860 out_p[y*out_p_stride + 4*x + 2] = v;
861 out_p[y*out_p_stride + 4*x + 3] = 0xFF;
862 }
863 }
864 }
865
866 return outimg;
867 }
868
869
870 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_RGB24_32_to_YCbCr420() const
871 {
872 auto outimg = std::make_shared<HeifPixelImage>();
873
874 outimg->create(m_width, m_height, heif_colorspace_YCbCr, heif_chroma_420);
875
876 int chroma_width = (m_width+1)/2;
877 int chroma_height = (m_height+1)/2;
878
879 const bool has_alpha = (get_chroma_format() == heif_chroma_interleaved_32bit);
880
881 outimg->add_plane(heif_channel_Y, m_width, m_height, 8);
882 outimg->add_plane(heif_channel_Cb, chroma_width, chroma_height, 8);
883 outimg->add_plane(heif_channel_Cr, chroma_width, chroma_height, 8);
884
885 if (has_alpha) {
886 outimg->add_plane(heif_channel_Alpha, m_width, m_height, 8);
887 }
888
889 uint8_t *out_cb,*out_cr,*out_y, *out_a;
890 int out_cb_stride=0, out_cr_stride=0, out_y_stride=0, out_a_stride=0;
891
892 const uint8_t *in_p;
893 int in_stride=0;
894
895 in_p = get_plane(heif_channel_interleaved, &in_stride);
896
897 out_y = outimg->get_plane(heif_channel_Y, &out_y_stride);
898 out_cb = outimg->get_plane(heif_channel_Cb, &out_cb_stride);
899 out_cr = outimg->get_plane(heif_channel_Cr, &out_cr_stride);
900
901 if (has_alpha) {
902 out_a = outimg->get_plane(heif_channel_Alpha, &out_a_stride);
903 }
904
905
906 if (!has_alpha) {
907 for (int y=0;y<m_height;y++) {
908 for (int x=0;x<m_width;x++) {
909 uint8_t r = in_p[y*in_stride + x*3 +0];
910 uint8_t g = in_p[y*in_stride + x*3 +1];
911 uint8_t b = in_p[y*in_stride + x*3 +2];
912 out_y[y*out_y_stride + x] = clip(r*0.299f + g*0.587f + b*0.114f);
913 }
914 }
915
916 for (int y=0;y<m_height;y+=2) {
917 for (int x=0;x<m_width;x+=2) {
918 uint8_t r = in_p[y*in_stride + x*3 +0];
919 uint8_t g = in_p[y*in_stride + x*3 +1];
920 uint8_t b = in_p[y*in_stride + x*3 +2];
921 out_cb[(y/2)*out_cb_stride + (x/2)] = clip(128 - r*0.168736f - g*0.331264f + b*0.5f);
922 out_cr[(y/2)*out_cb_stride + (x/2)] = clip(128 + r*0.5f - g*0.418688f - b*0.081312f);
923 }
924 }
925 }
926 else {
927 for (int y=0;y<m_height;y++) {
928 for (int x=0;x<m_width;x++) {
929 uint8_t r = in_p[y*in_stride + x*4 +0];
930 uint8_t g = in_p[y*in_stride + x*4 +1];
931 uint8_t b = in_p[y*in_stride + x*4 +2];
932 uint8_t a = in_p[y*in_stride + x*4 +3];
933 out_y[y*out_y_stride + x] = clip(r*0.299f + g*0.587f + b*0.114f);
934
935 // alpha
936 out_a[y*out_a_stride + x] = a;
937 }
938 }
939
940 for (int y=0;y<m_height;y+=2) {
941 for (int x=0;x<m_width;x+=2) {
942 uint8_t r = in_p[y*in_stride + x*4 +0];
943 uint8_t g = in_p[y*in_stride + x*4 +1];
944 uint8_t b = in_p[y*in_stride + x*4 +2];
945 out_cb[(y/2)*out_cb_stride + (x/2)] = clip(128 - r*0.168736f - g*0.331264f + b*0.5f);
946 out_cr[(y/2)*out_cb_stride + (x/2)] = clip(128 + r*0.5f - g*0.418688f - b*0.081312f);
947 }
948 }
949 }
950
951 return outimg;
952 }
953
954
955 std::shared_ptr<HeifPixelImage> HeifPixelImage::convert_RGB_to_YCbCr420_HDR() const
956 {
957 auto outimg = std::make_shared<HeifPixelImage>();
958
959 outimg->create(m_width, m_height, heif_colorspace_YCbCr, heif_chroma_420);
960
961 int chroma_width = (m_width+1)/2;
962 int chroma_height = (m_height+1)/2;
963
964 // TODO: make sure that all color channels have the same bit depth
965 // TODO: in HEVC, we could save with different luma/chroma bit depths
966 int bit_depth = get_bits_per_pixel(heif_channel_R);
967
968 outimg->add_plane(heif_channel_Y, m_width, m_height, bit_depth);
969 outimg->add_plane(heif_channel_Cb, chroma_width, chroma_height, bit_depth);
970 outimg->add_plane(heif_channel_Cr, chroma_width, chroma_height, bit_depth);
971
972 if (has_alpha()) {
973 outimg->add_plane(heif_channel_Alpha, m_width, m_height, bit_depth);
974 }
975
976 uint16_t *out_cb,*out_cr,*out_y, *out_a = nullptr;
977 int out_cb_stride=0, out_cr_stride=0, out_y_stride=0, out_a_stride=0;
978
979 const uint16_t *in_r;
980 const uint16_t *in_g;
981 const uint16_t *in_b;
982 const uint16_t *in_a;
983 int in_stride_r=0;
984 int in_stride_g=0;
985 int in_stride_b=0;
986 int in_stride_a=0;
987
988 in_r = (const uint16_t*)get_plane(heif_channel_R, &in_stride_r);
989 in_g = (const uint16_t*)get_plane(heif_channel_G, &in_stride_g);
990 in_b = (const uint16_t*)get_plane(heif_channel_B, &in_stride_b);
991 in_a = (const uint16_t*)get_plane(heif_channel_Alpha, &in_stride_a);
992
993 out_y = (uint16_t*)outimg->get_plane(heif_channel_Y, &out_y_stride);
994 out_cb = (uint16_t*)outimg->get_plane(heif_channel_Cb, &out_cb_stride);
995 out_cr = (uint16_t*)outimg->get_plane(heif_channel_Cr, &out_cr_stride);
996
997 if (has_alpha()) {
998 out_a = (uint16_t*)outimg->get_plane(heif_channel_Alpha, &out_a_stride);
999 }
1000
1001 in_stride_r /= 2;
1002 in_stride_g /= 2;
1003 in_stride_b /= 2;
1004 in_stride_a /= 2;
1005
1006 out_y_stride /= 2;
1007 out_cb_stride /= 2;
1008 out_cr_stride /= 2;
1009 out_a_stride /= 2;
1010
1011 assert(bit_depth<=16);
1012
1013 uint16_t halfRange = (uint16_t)(1<<(bit_depth-1));
1014 int32_t fullRange = (1<<bit_depth)-1;
1015
1016 if (!has_alpha()) {
1017 for (int y=0;y<m_height;y++) {
1018 for (int x=0;x<m_width;x++) {
1019 uint16_t r = in_r[y*in_stride_r + x];
1020 uint16_t g = in_g[y*in_stride_g + x];
1021 uint16_t b = in_b[y*in_stride_b + x];
1022 out_y[y*out_y_stride + x] = clip(r*0.299f + g*0.587f + b*0.114f, fullRange);
1023 }
1024 }
1025
1026 for (int y=0;y<m_height;y+=2) {
1027 for (int x=0;x<m_width;x+=2) {
1028 uint16_t r = in_r[y*in_stride_r + x];
1029 uint16_t g = in_g[y*in_stride_g + x];
1030 uint16_t b = in_b[y*in_stride_b + x];
1031 out_cb[(y/2)*out_cb_stride + (x/2)] = clip(halfRange - r*0.168736f - g*0.331264f + b*0.5f, fullRange);
1032 out_cr[(y/2)*out_cb_stride + (x/2)] = clip(halfRange + r*0.5f - g*0.418688f - b*0.081312f, fullRange);
1033 }
1034 }
1035 }
1036 else {
1037 for (int y=0;y<m_height;y++) {
1038 for (int x=0;x<m_width;x++) {
1039 uint16_t r = in_r[y*in_stride_r + x];
1040 uint16_t g = in_g[y*in_stride_g + x];
1041 uint16_t b = in_b[y*in_stride_b + x];
1042 uint16_t a = in_a[y*in_stride_a + x];
1043 out_y[y*out_y_stride + x] = clip(r*0.299f + g*0.587f + b*0.114f, fullRange);
1044
1045 // alpha
1046 out_a[y*out_a_stride + x] = a;
1047 }
1048 }
1049
1050 for (int y=0;y<m_height;y+=2) {
1051 for (int x=0;x<m_width;x+=2) {
1052 uint16_t r = in_r[y*in_stride_r + x];
1053 uint16_t g = in_g[y*in_stride_g + x];
1054 uint16_t b = in_b[y*in_stride_b + x];
1055 out_cb[(y/2)*out_cb_stride + (x/2)] = clip(halfRange - r*0.168736f - g*0.331264f + b*0.5f, fullRange);
1056 out_cr[(y/2)*out_cb_stride + (x/2)] = clip(halfRange + r*0.5f - g*0.418688f - b*0.081312f, fullRange);
1057 }
1058 }
1059 }
1060
1061 return outimg;
382 return pipeline.convert_image(input);
1062383 }
1063384
1064385
1110431 int h = plane.height;
1111432
1112433 int in_stride = plane.stride;
1113 const uint8_t* in_data = plane.mem.data();
434 const uint8_t* in_data = plane.mem;
1114435
1115436 int out_stride = 0;
1116437 uint8_t* out_data = out_img->get_plane(channel, &out_stride);
1180501 int h = plane.height;
1181502
1182503 int stride = plane.stride;
1183 uint8_t* data = plane.mem.data();
504 uint8_t* data = plane.mem;
1184505
1185506 if (horizontal) {
1186507 for (int y=0;y<h;y++) {
1234555 plane.bit_depth);
1235556
1236557 int in_stride = plane.stride;
1237 const uint8_t* in_data = plane.mem.data();
558 const uint8_t* in_data = plane.mem;
1238559
1239560 int out_stride = 0;
1240561 uint8_t* out_data = out_img->get_plane(channel, &out_stride);
1287608 int h = plane.height;
1288609
1289610 int stride = plane.stride;
1290 uint8_t* data = plane.mem.data();
611 uint8_t* data = plane.mem;
1291612
1292613 uint16_t val16;
1293614 switch (channel) {
1445766 }
1446767
1447768 int in_stride = plane.stride;
1448 const uint8_t* in_data = plane.mem.data();
769 const uint8_t* in_data = plane.mem;
1449770
1450771 int out_stride = 0;
1451772 uint8_t* out_data = out_img->get_plane(channel, &out_stride);
4545
4646 void create(int width,int height, heif_colorspace colorspace, heif_chroma chroma);
4747
48 void add_plane(heif_channel channel, int width, int height, int bit_depth);
48 bool add_plane(heif_channel channel, int width, int height, int bit_depth);
4949
5050 bool has_channel(heif_channel channel) const;
5151
6666
6767 std::set<enum heif_channel> get_channel_set() const;
6868
69 int get_storage_bits_per_pixel(enum heif_channel channel) const;
70
6971 int get_bits_per_pixel(enum heif_channel channel) const;
7072
7173 uint8_t* get_plane(enum heif_channel channel, int* out_stride);
7274 const uint8_t* get_plane(enum heif_channel channel, int* out_stride) const;
7375
74 void copy_new_plane_from(const std::shared_ptr<HeifPixelImage> src_image,
76 void copy_new_plane_from(const std::shared_ptr<const HeifPixelImage>& src_image,
7577 heif_channel src_channel,
7678 heif_channel dst_channel);
7779 void fill_new_plane(heif_channel dst_channel, uint8_t value, int width, int height);
7981 void transfer_plane_from_image_as(std::shared_ptr<HeifPixelImage> source,
8082 heif_channel src_channel,
8183 heif_channel dst_channel);
82
83 std::shared_ptr<HeifPixelImage> convert_colorspace(heif_colorspace colorspace,
84 heif_chroma chroma) const;
8584
8685 Error rotate_ccw(int angle_degrees,
8786 std::shared_ptr<HeifPixelImage>& out_img);
107106 int height;
108107 int bit_depth;
109108
110 std::vector<uint8_t> mem;
109 uint8_t* mem; // aligned memory start
110 std::vector<uint8_t> unaligned_mem;
111111 int stride;
112112 };
113113
118118 std::shared_ptr<const color_profile> m_color_profile;
119119
120120 std::map<heif_channel, ImagePlane> m_planes;
121
122 std::shared_ptr<HeifPixelImage> convert_YCbCr420_to_RGB() const;
123 std::shared_ptr<HeifPixelImage> convert_YCbCr420_to_RGB24() const;
124 std::shared_ptr<HeifPixelImage> convert_YCbCr420_to_RGB32() const;
125 std::shared_ptr<HeifPixelImage> convert_RGB_to_RGB24_32() const;
126 std::shared_ptr<HeifPixelImage> convert_mono_to_RGB(int bpp) const;
127 std::shared_ptr<HeifPixelImage> convert_mono_to_YCbCr420() const;
128 std::shared_ptr<HeifPixelImage> convert_RGB24_32_to_YCbCr420() const;
129 std::shared_ptr<HeifPixelImage> convert_RGB_to_YCbCr420_HDR() const;
130 std::shared_ptr<HeifPixelImage> convert_RGB_to_RRGGBBaa_BE() const;
131 std::shared_ptr<HeifPixelImage> convert_YCbCr420_to_RGB_HDR() const;
132121 };
133122
134123
124 std::shared_ptr<HeifPixelImage> convert_colorspace(const std::shared_ptr<HeifPixelImage>& input,
125 heif_colorspace colorspace,
126 heif_chroma chroma);
135127 }
136128
137129 #endif
4545
4646 static const int MAX_BOX_SIZE = 0x7FFFFFFF; // 2 GB
4747 static const int64_t MAX_LARGE_BOX_SIZE = 0x0FFFFFFFFFFFFFFF;
48 static const int64_t MAX_FILE_POS = 0x007FFFFFFFFFFFFFLL; // maximum file position
49 static const int MAX_FRACTION_VALUE = 0x10000;
4850
4951 #endif // LIBHEIF_HEIF_LIMITS_H
2727 #define LIBHEIF_HEIF_VERSION_H
2828
2929 /* Numeric representation of the version */
30 #define LIBHEIF_NUMERIC_VERSION 0x01040000
30 #define LIBHEIF_NUMERIC_VERSION 0x01050000
3131
3232 /* Version string */
33 #define LIBHEIF_VERSION "1.4.0"
33 #define LIBHEIF_VERSION "1.5.0"
3434
3535 #endif // LIBHEIF_HEIF_VERSION_H
+2150
-3645
ltmain.sh less more
0 #! /bin/sh
1 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
2 ## by inline-source v2014-01-03.01
3
4 # libtool (GNU libtool) 2.4.6
5 # Provide generalized library-building support services.
0
1 # libtool (GNU libtool) 2.4.2
62 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
73
8 # Copyright (C) 1996-2015 Free Software Foundation, Inc.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
96 # This is free software; see the source for copying conditions. There is NO
107 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
118
2522 # General Public License for more details.
2623 #
2724 # You should have received a copy of the GNU General Public License
28 # along with this program. If not, see <http://www.gnu.org/licenses/>.
29
25 # along with GNU Libtool; see the file COPYING. If not, a copy
26 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
27 # or obtained by writing to the Free Software Foundation, Inc.,
28 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
30 # Usage: $progname [OPTION]... [MODE-ARG]...
31 #
32 # Provide generalized library-building support services.
33 #
34 # --config show all configuration variables
35 # --debug enable verbose shell tracing
36 # -n, --dry-run display commands without modifying any files
37 # --features display basic configuration information and exit
38 # --mode=MODE use operation mode MODE
39 # --preserve-dup-deps don't remove duplicate dependency libraries
40 # --quiet, --silent don't print informational messages
41 # --no-quiet, --no-silent
42 # print informational messages (default)
43 # --no-warn don't display warning messages
44 # --tag=TAG use configuration variables from tag TAG
45 # -v, --verbose print more informational messages than default
46 # --no-verbose don't print the extra informational messages
47 # --version print version information
48 # -h, --help, --help-all print short, long, or detailed help message
49 #
50 # MODE must be one of the following:
51 #
52 # clean remove files from the build directory
53 # compile compile a source file into a libtool object
54 # execute automatically set library path, then run a program
55 # finish complete the installation of libtool libraries
56 # install install libraries or executables
57 # link create a library or an executable
58 # uninstall remove libraries from an installed directory
59 #
60 # MODE-ARGS vary depending on the MODE. When passed as first option,
61 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
62 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
63 #
64 # When reporting a bug, please describe a test case to reproduce it and
65 # include the following information:
66 #
67 # host-triplet: $host
68 # shell: $SHELL
69 # compiler: $LTCC
70 # compiler flags: $LTCFLAGS
71 # linker: $LD (gnu? $with_gnu_ld)
72 # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1
73 # automake: $automake_version
74 # autoconf: $autoconf_version
75 #
76 # Report bugs to <bug-libtool@gnu.org>.
77 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
78 # General help using GNU software: <http://www.gnu.org/gethelp/>.
3079
3180 PROGRAM=libtool
3281 PACKAGE=libtool
33 VERSION="2.4.6 Debian-2.4.6-2"
34 package_revision=2.4.6
35
36
37 ## ------ ##
38 ## Usage. ##
39 ## ------ ##
40
41 # Run './libtool --help' for help with using this script from the
42 # command line.
43
44
45 ## ------------------------------- ##
46 ## User overridable command paths. ##
47 ## ------------------------------- ##
48
49 # After configure completes, it has a better idea of some of the
50 # shell tools we need than the defaults used by the functions shared
51 # with bootstrap, so set those here where they can still be over-
52 # ridden by the user, but otherwise take precedence.
53
54 : ${AUTOCONF="autoconf"}
55 : ${AUTOMAKE="automake"}
56
57
58 ## -------------------------- ##
59 ## Source external libraries. ##
60 ## -------------------------- ##
61
62 # Much of our low-level functionality needs to be sourced from external
63 # libraries, which are installed to $pkgauxdir.
64
65 # Set a version string for this script.
66 scriptversion=2015-01-20.17; # UTC
67
68 # General shell script boiler plate, and helper functions.
69 # Written by Gary V. Vaughan, 2004
70
71 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
72 # This is free software; see the source for copying conditions. There is NO
73 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
74
75 # This program is free software; you can redistribute it and/or modify
76 # it under the terms of the GNU General Public License as published by
77 # the Free Software Foundation; either version 3 of the License, or
78 # (at your option) any later version.
79
80 # As a special exception to the GNU General Public License, if you distribute
81 # this file as part of a program or library that is built using GNU Libtool,
82 # you may include this file under the same distribution terms that you use
83 # for the rest of that program.
84
85 # This program is distributed in the hope that it will be useful,
86 # but WITHOUT ANY WARRANTY; without even the implied warranty of
87 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
88 # General Public License for more details.
89
90 # You should have received a copy of the GNU General Public License
91 # along with this program. If not, see <http://www.gnu.org/licenses/>.
92
93 # Please report bugs or propose patches to gary@gnu.org.
94
95
96 ## ------ ##
97 ## Usage. ##
98 ## ------ ##
99
100 # Evaluate this file near the top of your script to gain access to
101 # the functions and variables defined here:
102 #
103 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
104 #
105 # If you need to override any of the default environment variable
106 # settings, do that before evaluating this file.
107
108
109 ## -------------------- ##
110 ## Shell normalisation. ##
111 ## -------------------- ##
112
113 # Some shells need a little help to be as Bourne compatible as possible.
114 # Before doing anything else, make sure all that help has been provided!
115
116 DUALCASE=1; export DUALCASE # for MKS sh
117 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
82 VERSION="2.4.2 Debian-2.4.2-1.7ubuntu1"
83 TIMESTAMP=""
84 package_revision=1.3337
85
86 # Be Bourne compatible
87 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
11888 emulate sh
11989 NULLCMD=:
120 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
90 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
12191 # is contrary to our usage. Disable this feature.
12292 alias -g '${1+"$@"}'='"$@"'
12393 setopt NO_GLOB_SUBST
12494 else
125 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
95 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
12696 fi
127
128 # NLS nuisances: We save the old values in case they are required later.
129 _G_user_locale=
130 _G_safe_locale=
131 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
97 BIN_SH=xpg4; export BIN_SH # for Tru64
98 DUALCASE=1; export DUALCASE # for MKS sh
99
100 # A function that is used when there is no print builtin or printf.
101 func_fallback_echo ()
102 {
103 eval 'cat <<_LTECHO_EOF
104 $1
105 _LTECHO_EOF'
106 }
107
108 # NLS nuisances: We save the old values to restore during execute mode.
109 lt_user_locale=
110 lt_safe_locale=
111 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
132112 do
133 eval "if test set = \"\${$_G_var+set}\"; then
134 save_$_G_var=\$$_G_var
135 $_G_var=C
136 export $_G_var
137 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
138 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
113 eval "if test \"\${$lt_var+set}\" = set; then
114 save_$lt_var=\$$lt_var
115 $lt_var=C
116 export $lt_var
117 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
118 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
139119 fi"
140120 done
141
142 # CDPATH.
143 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
144
145 # Make sure IFS has a sensible default
146 sp=' '
147 nl='
148 '
149 IFS="$sp $nl"
150
151 # There are apparently some retarded systems that use ';' as a PATH separator!
152 if test "${PATH_SEPARATOR+set}" != set; then
153 PATH_SEPARATOR=:
154 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
155 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
156 PATH_SEPARATOR=';'
157 }
158 fi
159
160
161
162 ## ------------------------- ##
163 ## Locate command utilities. ##
164 ## ------------------------- ##
165
166
167 # func_executable_p FILE
168 # ----------------------
169 # Check that FILE is an executable regular file.
170 func_executable_p ()
171 {
172 test -f "$1" && test -x "$1"
173 }
174
175
176 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
177 # --------------------------------------------
178 # Search for either a program that responds to --version with output
179 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
180 # trying all the directories in PATH with each of the elements of
181 # PROGS_LIST.
182 #
183 # CHECK_FUNC should accept the path to a candidate program, and
184 # set $func_check_prog_result if it truncates its output less than
185 # $_G_path_prog_max characters.
186 func_path_progs ()
187 {
188 _G_progs_list=$1
189 _G_check_func=$2
190 _G_PATH=${3-"$PATH"}
191
192 _G_path_prog_max=0
193 _G_path_prog_found=false
194 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
195 for _G_dir in $_G_PATH; do
196 IFS=$_G_save_IFS
197 test -z "$_G_dir" && _G_dir=.
198 for _G_prog_name in $_G_progs_list; do
199 for _exeext in '' .EXE; do
200 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
201 func_executable_p "$_G_path_prog" || continue
202 case `"$_G_path_prog" --version 2>&1` in
203 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
204 *) $_G_check_func $_G_path_prog
205 func_path_progs_result=$func_check_prog_result
206 ;;
207 esac
208 $_G_path_prog_found && break 3
209 done
210 done
211 done
212 IFS=$_G_save_IFS
213 test -z "$func_path_progs_result" && {
214 echo "no acceptable sed could be found in \$PATH" >&2
215 exit 1
216 }
217 }
218
219
220 # We want to be able to use the functions in this file before configure
221 # has figured out where the best binaries are kept, which means we have
222 # to search for them ourselves - except when the results are already set
223 # where we skip the searches.
224
225 # Unless the user overrides by setting SED, search the path for either GNU
226 # sed, or the sed that truncates its output the least.
227 test -z "$SED" && {
228 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
229 for _G_i in 1 2 3 4 5 6 7; do
230 _G_sed_script=$_G_sed_script$nl$_G_sed_script
231 done
232 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
233 _G_sed_script=
234
235 func_check_prog_sed ()
236 {
237 _G_path_prog=$1
238
239 _G_count=0
240 printf 0123456789 >conftest.in
241 while :
242 do
243 cat conftest.in conftest.in >conftest.tmp
244 mv conftest.tmp conftest.in
245 cp conftest.in conftest.nl
246 echo '' >> conftest.nl
247 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
248 diff conftest.out conftest.nl >/dev/null 2>&1 || break
249 _G_count=`expr $_G_count + 1`
250 if test "$_G_count" -gt "$_G_path_prog_max"; then
251 # Best one so far, save it but keep looking for a better one
252 func_check_prog_result=$_G_path_prog
253 _G_path_prog_max=$_G_count
254 fi
255 # 10*(2^10) chars as input seems more than enough
256 test 10 -lt "$_G_count" && break
257 done
258 rm -f conftest.in conftest.tmp conftest.nl conftest.out
259 }
260
261 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
262 rm -f conftest.sed
263 SED=$func_path_progs_result
264 }
265
266
267 # Unless the user overrides by setting GREP, search the path for either GNU
268 # grep, or the grep that truncates its output the least.
269 test -z "$GREP" && {
270 func_check_prog_grep ()
271 {
272 _G_path_prog=$1
273
274 _G_count=0
275 _G_path_prog_max=0
276 printf 0123456789 >conftest.in
277 while :
278 do
279 cat conftest.in conftest.in >conftest.tmp
280 mv conftest.tmp conftest.in
281 cp conftest.in conftest.nl
282 echo 'GREP' >> conftest.nl
283 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
284 diff conftest.out conftest.nl >/dev/null 2>&1 || break
285 _G_count=`expr $_G_count + 1`
286 if test "$_G_count" -gt "$_G_path_prog_max"; then
287 # Best one so far, save it but keep looking for a better one
288 func_check_prog_result=$_G_path_prog
289 _G_path_prog_max=$_G_count
290 fi
291 # 10*(2^10) chars as input seems more than enough
292 test 10 -lt "$_G_count" && break
293 done
294 rm -f conftest.in conftest.tmp conftest.nl conftest.out
295 }
296
297 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
298 GREP=$func_path_progs_result
299 }
300
301
302 ## ------------------------------- ##
303 ## User overridable command paths. ##
304 ## ------------------------------- ##
305
306 # All uppercase variable names are used for environment variables. These
307 # variables can be overridden by the user before calling a script that
308 # uses them if a suitable command of that name is not already available
309 # in the command search PATH.
121 LC_ALL=C
122 LANGUAGE=C
123 export LANGUAGE LC_ALL
124
125 $lt_unset CDPATH
126
127
128 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
129 # is ksh but when the shell is invoked as "sh" and the current value of
130 # the _XPG environment variable is not equal to 1 (one), the special
131 # positional parameter $0, within a function call, is the name of the
132 # function.
133 progpath="$0"
134
135
310136
311137 : ${CP="cp -f"}
312 : ${ECHO="printf %s\n"}
313 : ${EGREP="$GREP -E"}
314 : ${FGREP="$GREP -F"}
315 : ${LN_S="ln -s"}
138 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
316139 : ${MAKE="make"}
317140 : ${MKDIR="mkdir"}
318141 : ${MV="mv -f"}
319142 : ${RM="rm -f"}
320143 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
321
322
323 ## -------------------- ##
324 ## Useful sed snippets. ##
325 ## -------------------- ##
326
327 sed_dirname='s|/[^/]*$||'
328 sed_basename='s|^.*/||'
329
330 # Sed substitution that helps us do robust quoting. It backslashifies
331 # metacharacters that are still active within double-quoted strings.
332 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
333
334 # Same as above, but do not quote variable references.
335 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
336
337 # Sed substitution that turns a string into a regex matching for the
338 # string literally.
339 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
340
341 # Sed substitution that converts a w32 file name or path
342 # that contains forward slashes, into one that contains
343 # (escaped) backslashes. A very naive implementation.
344 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
345
346 # Re-'\' parameter expansions in output of sed_double_quote_subst that
347 # were '\'-ed in input to the same. If an odd number of '\' preceded a
348 # '$' in input to sed_double_quote_subst, that '$' was protected from
349 # expansion. Since each input '\' is now two '\'s, look for any number
350 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
351 _G_bs='\\'
352 _G_bs2='\\\\'
353 _G_bs4='\\\\\\\\'
354 _G_dollar='\$'
355 sed_double_backslash="\
356 s/$_G_bs4/&\\
357 /g
358 s/^$_G_bs2$_G_dollar/$_G_bs&/
359 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
360 s/\n//g"
361
362
363 ## ----------------- ##
364 ## Global variables. ##
365 ## ----------------- ##
366
367 # Except for the global variables explicitly listed below, the following
368 # functions in the '^func_' namespace, and the '^require_' namespace
369 # variables initialised in the 'Resource management' section, sourcing
370 # this file will not pollute your global namespace with anything
371 # else. There's no portable way to scope variables in Bourne shell
372 # though, so actually running these functions will sometimes place
373 # results into a variable named after the function, and often use
374 # temporary variables in the '^_G_' namespace. If you are careful to
375 # avoid using those namespaces casually in your sourcing script, things
376 # should continue to work as you expect. And, of course, you can freely
377 # overwrite any of the functions or variables defined here before
378 # calling anything to customize them.
379
144 : ${Xsed="$SED -e 1s/^X//"}
145
146 # Global variables:
380147 EXIT_SUCCESS=0
381148 EXIT_FAILURE=1
382149 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
383150 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
384151
385 # Allow overriding, eg assuming that you follow the convention of
386 # putting '$debug_cmd' at the start of all your functions, you can get
387 # bash to show function call trace with:
388 #
389 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
390 debug_cmd=${debug_cmd-":"}
391 exit_cmd=:
392
393 # By convention, finish your script with:
394 #
395 # exit $exit_status
396 #
397 # so that you can set exit_status to non-zero if you want to indicate
398 # something went wrong during execution without actually bailing out at
399 # the point of failure.
400152 exit_status=$EXIT_SUCCESS
401153
402 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
403 # is ksh but when the shell is invoked as "sh" and the current value of
404 # the _XPG environment variable is not equal to 1 (one), the special
405 # positional parameter $0, within a function call, is the name of the
406 # function.
407 progpath=$0
408
409 # The name of this program.
410 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
411
412 # Make sure we have an absolute progpath for reexecution:
413 case $progpath in
414 [\\/]*|[A-Za-z]:\\*) ;;
415 *[\\/]*)
416 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
417 progdir=`cd "$progdir" && pwd`
418 progpath=$progdir/$progname
419 ;;
420 *)
421 _G_IFS=$IFS
422 IFS=${PATH_SEPARATOR-:}
423 for progdir in $PATH; do
424 IFS=$_G_IFS
425 test -x "$progdir/$progname" && break
426 done
427 IFS=$_G_IFS
428 test -n "$progdir" || progdir=`pwd`
429 progpath=$progdir/$progname
430 ;;
431 esac
432
433
434 ## ----------------- ##
435 ## Standard options. ##
436 ## ----------------- ##
437
438 # The following options affect the operation of the functions defined
439 # below, and should be set appropriately depending on run-time para-
440 # meters passed on the command line.
441
442 opt_dry_run=false
443 opt_quiet=false
444 opt_verbose=false
445
446 # Categories 'all' and 'none' are always available. Append any others
447 # you will pass as the first argument to func_warning from your own
448 # code.
449 warning_categories=
450
451 # By default, display warnings according to 'opt_warning_types'. Set
452 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
453 # treat the next displayed warning as a fatal error.
454 warning_func=func_warn_and_continue
455
456 # Set to 'all' to display all warnings, 'none' to suppress all
457 # warnings, or a space delimited list of some subset of
458 # 'warning_categories' to display only the listed warnings.
459 opt_warning_types=all
460
461
462 ## -------------------- ##
463 ## Resource management. ##
464 ## -------------------- ##
465
466 # This section contains definitions for functions that each ensure a
467 # particular resource (a file, or a non-empty configuration variable for
468 # example) is available, and if appropriate to extract default values
469 # from pertinent package files. Call them using their associated
470 # 'require_*' variable to ensure that they are executed, at most, once.
471 #
472 # It's entirely deliberate that calling these functions can set
473 # variables that don't obey the namespace limitations obeyed by the rest
474 # of this file, in order that that they be as useful as possible to
475 # callers.
476
477
478 # require_term_colors
479 # -------------------
480 # Allow display of bold text on terminals that support it.
481 require_term_colors=func_require_term_colors
482 func_require_term_colors ()
483 {
484 $debug_cmd
485
486 test -t 1 && {
487 # COLORTERM and USE_ANSI_COLORS environment variables take
488 # precedence, because most terminfo databases neglect to describe
489 # whether color sequences are supported.
490 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
491
492 if test 1 = "$USE_ANSI_COLORS"; then
493 # Standard ANSI escape sequences
494 tc_reset=''
495 tc_bold=''; tc_standout=''
496 tc_red=''; tc_green=''
497 tc_blue=''; tc_cyan=''
498 else
499 # Otherwise trust the terminfo database after all.
500 test -n "`tput sgr0 2>/dev/null`" && {
501 tc_reset=`tput sgr0`
502 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
503 tc_standout=$tc_bold
504 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
505 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
506 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
507 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
508 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
509 }
510 fi
511 }
512
513 require_term_colors=:
514 }
515
516
517 ## ----------------- ##
518 ## Function library. ##
519 ## ----------------- ##
520
521 # This section contains a variety of useful functions to call in your
522 # scripts. Take note of the portable wrappers for features provided by
523 # some modern shells, which will fall back to slower equivalents on
524 # less featureful shells.
525
526
527 # func_append VAR VALUE
528 # ---------------------
529 # Append VALUE onto the existing contents of VAR.
530
531 # We should try to minimise forks, especially on Windows where they are
532 # unreasonably slow, so skip the feature probes when bash or zsh are
533 # being used:
534 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
535 : ${_G_HAVE_ARITH_OP="yes"}
536 : ${_G_HAVE_XSI_OPS="yes"}
537 # The += operator was introduced in bash 3.1
538 case $BASH_VERSION in
539 [12].* | 3.0 | 3.0*) ;;
540 *)
541 : ${_G_HAVE_PLUSEQ_OP="yes"}
542 ;;
543 esac
544 fi
545
546 # _G_HAVE_PLUSEQ_OP
547 # Can be empty, in which case the shell is probed, "yes" if += is
548 # useable or anything else if it does not work.
549 test -z "$_G_HAVE_PLUSEQ_OP" \
550 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
551 && _G_HAVE_PLUSEQ_OP=yes
552
553 if test yes = "$_G_HAVE_PLUSEQ_OP"
554 then
555 # This is an XSI compatible shell, allowing a faster implementation...
556 eval 'func_append ()
557 {
558 $debug_cmd
559
560 eval "$1+=\$2"
561 }'
562 else
563 # ...otherwise fall back to using expr, which is often a shell builtin.
564 func_append ()
565 {
566 $debug_cmd
567
568 eval "$1=\$$1\$2"
569 }
570 fi
571
572
573 # func_append_quoted VAR VALUE
574 # ----------------------------
575 # Quote VALUE and append to the end of shell variable VAR, separated
576 # by a space.
577 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
578 eval 'func_append_quoted ()
579 {
580 $debug_cmd
581
582 func_quote_for_eval "$2"
583 eval "$1+=\\ \$func_quote_for_eval_result"
584 }'
585 else
586 func_append_quoted ()
587 {
588 $debug_cmd
589
590 func_quote_for_eval "$2"
591 eval "$1=\$$1\\ \$func_quote_for_eval_result"
592 }
593 fi
594
595
596 # func_append_uniq VAR VALUE
597 # --------------------------
598 # Append unique VALUE onto the existing contents of VAR, assuming
599 # entries are delimited by the first character of VALUE. For example:
600 #
601 # func_append_uniq options " --another-option option-argument"
602 #
603 # will only append to $options if " --another-option option-argument "
604 # is not already present somewhere in $options already (note spaces at
605 # each end implied by leading space in second argument).
606 func_append_uniq ()
607 {
608 $debug_cmd
609
610 eval _G_current_value='`$ECHO $'$1'`'
611 _G_delim=`expr "$2" : '\(.\)'`
612
613 case $_G_delim$_G_current_value$_G_delim in
614 *"$2$_G_delim"*) ;;
615 *) func_append "$@" ;;
616 esac
617 }
618
619
620 # func_arith TERM...
621 # ------------------
622 # Set func_arith_result to the result of evaluating TERMs.
623 test -z "$_G_HAVE_ARITH_OP" \
624 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
625 && _G_HAVE_ARITH_OP=yes
626
627 if test yes = "$_G_HAVE_ARITH_OP"; then
628 eval 'func_arith ()
629 {
630 $debug_cmd
631
632 func_arith_result=$(( $* ))
633 }'
634 else
635 func_arith ()
636 {
637 $debug_cmd
638
639 func_arith_result=`expr "$@"`
640 }
641 fi
642
643
644 # func_basename FILE
645 # ------------------
646 # Set func_basename_result to FILE with everything up to and including
647 # the last / stripped.
648 if test yes = "$_G_HAVE_XSI_OPS"; then
649 # If this shell supports suffix pattern removal, then use it to avoid
650 # forking. Hide the definitions single quotes in case the shell chokes
651 # on unsupported syntax...
652 _b='func_basename_result=${1##*/}'
653 _d='case $1 in
654 */*) func_dirname_result=${1%/*}$2 ;;
655 * ) func_dirname_result=$3 ;;
656 esac'
657
658 else
659 # ...otherwise fall back to using sed.
660 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
661 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
662 if test "X$func_dirname_result" = "X$1"; then
663 func_dirname_result=$3
664 else
665 func_append func_dirname_result "$2"
666 fi'
667 fi
668
669 eval 'func_basename ()
670 {
671 $debug_cmd
672
673 '"$_b"'
674 }'
675
676
677 # func_dirname FILE APPEND NONDIR_REPLACEMENT
678 # -------------------------------------------
154 # Make sure IFS has a sensible default
155 lt_nl='
156 '
157 IFS=" $lt_nl"
158
159 dirname="s,/[^/]*$,,"
160 basename="s,^.*/,,"
161
162 # func_dirname file append nondir_replacement
679163 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
680164 # otherwise set result to NONDIR_REPLACEMENT.
681 eval 'func_dirname ()
682 {
683 $debug_cmd
684
685 '"$_d"'
686 }'
687
688
689 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
690 # --------------------------------------------------------
691 # Perform func_basename and func_dirname in a single function
165 func_dirname ()
166 {
167 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
168 if test "X$func_dirname_result" = "X${1}"; then
169 func_dirname_result="${3}"
170 else
171 func_dirname_result="$func_dirname_result${2}"
172 fi
173 } # func_dirname may be replaced by extended shell implementation
174
175
176 # func_basename file
177 func_basename ()
178 {
179 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
180 } # func_basename may be replaced by extended shell implementation
181
182
183 # func_dirname_and_basename file append nondir_replacement
184 # perform func_basename and func_dirname in a single function
692185 # call:
693186 # dirname: Compute the dirname of FILE. If nonempty,
694187 # add APPEND to the result, otherwise set result
696189 # value returned in "$func_dirname_result"
697190 # basename: Compute filename of FILE.
698191 # value retuned in "$func_basename_result"
699 # For efficiency, we do not delegate to the functions above but instead
700 # duplicate the functionality here.
701 eval 'func_dirname_and_basename ()
702 {
703 $debug_cmd
704
705 '"$_b"'
706 '"$_d"'
707 }'
708
709
710 # func_echo ARG...
711 # ----------------
712 # Echo program name prefixed message.
713 func_echo ()
714 {
715 $debug_cmd
716
717 _G_message=$*
718
719 func_echo_IFS=$IFS
720 IFS=$nl
721 for _G_line in $_G_message; do
722 IFS=$func_echo_IFS
723 $ECHO "$progname: $_G_line"
724 done
725 IFS=$func_echo_IFS
726 }
727
728
729 # func_echo_all ARG...
730 # --------------------
731 # Invoke $ECHO with all args, space-separated.
732 func_echo_all ()
733 {
734 $ECHO "$*"
735 }
736
737
738 # func_echo_infix_1 INFIX ARG...
739 # ------------------------------
740 # Echo program name, followed by INFIX on the first line, with any
741 # additional lines not showing INFIX.
742 func_echo_infix_1 ()
743 {
744 $debug_cmd
745
746 $require_term_colors
747
748 _G_infix=$1; shift
749 _G_indent=$_G_infix
750 _G_prefix="$progname: $_G_infix: "
751 _G_message=$*
752
753 # Strip color escape sequences before counting printable length
754 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
755 do
756 test -n "$_G_tc" && {
757 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
758 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
759 }
760 done
761 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
762
763 func_echo_infix_1_IFS=$IFS
764 IFS=$nl
765 for _G_line in $_G_message; do
766 IFS=$func_echo_infix_1_IFS
767 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
768 _G_prefix=$_G_indent
769 done
770 IFS=$func_echo_infix_1_IFS
771 }
772
773
774 # func_error ARG...
775 # -----------------
776 # Echo program name prefixed message to standard error.
777 func_error ()
778 {
779 $debug_cmd
780
781 $require_term_colors
782
783 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
784 }
785
786
787 # func_fatal_error ARG...
788 # -----------------------
789 # Echo program name prefixed message to standard error, and exit.
790 func_fatal_error ()
791 {
792 $debug_cmd
793
794 func_error "$*"
795 exit $EXIT_FAILURE
796 }
797
798
799 # func_grep EXPRESSION FILENAME
800 # -----------------------------
801 # Check whether EXPRESSION matches any line of FILENAME, without output.
802 func_grep ()
803 {
804 $debug_cmd
805
806 $GREP "$1" "$2" >/dev/null 2>&1
807 }
808
809
810 # func_len STRING
811 # ---------------
812 # Set func_len_result to the length of STRING. STRING may not
813 # start with a hyphen.
814 test -z "$_G_HAVE_XSI_OPS" \
815 && (eval 'x=a/b/c;
816 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
817 && _G_HAVE_XSI_OPS=yes
818
819 if test yes = "$_G_HAVE_XSI_OPS"; then
820 eval 'func_len ()
821 {
822 $debug_cmd
823
824 func_len_result=${#1}
825 }'
826 else
827 func_len ()
828 {
829 $debug_cmd
830
831 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
832 }
833 fi
834
835
836 # func_mkdir_p DIRECTORY-PATH
837 # ---------------------------
838 # Make sure the entire path to DIRECTORY-PATH is available.
839 func_mkdir_p ()
840 {
841 $debug_cmd
842
843 _G_directory_path=$1
844 _G_dir_list=
845
846 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
847
848 # Protect directory names starting with '-'
849 case $_G_directory_path in
850 -*) _G_directory_path=./$_G_directory_path ;;
851 esac
852
853 # While some portion of DIR does not yet exist...
854 while test ! -d "$_G_directory_path"; do
855 # ...make a list in topmost first order. Use a colon delimited
856 # list incase some portion of path contains whitespace.
857 _G_dir_list=$_G_directory_path:$_G_dir_list
858
859 # If the last portion added has no slash in it, the list is done
860 case $_G_directory_path in */*) ;; *) break ;; esac
861
862 # ...otherwise throw away the child directory and loop
863 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
864 done
865 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
866
867 func_mkdir_p_IFS=$IFS; IFS=:
868 for _G_dir in $_G_dir_list; do
869 IFS=$func_mkdir_p_IFS
870 # mkdir can fail with a 'File exist' error if two processes
871 # try to create one of the directories concurrently. Don't
872 # stop in that case!
873 $MKDIR "$_G_dir" 2>/dev/null || :
874 done
875 IFS=$func_mkdir_p_IFS
876
877 # Bail out if we (or some other process) failed to create a directory.
878 test -d "$_G_directory_path" || \
879 func_fatal_error "Failed to create '$1'"
192 # Implementation must be kept synchronized with func_dirname
193 # and func_basename. For efficiency, we do not delegate to
194 # those functions but instead duplicate the functionality here.
195 func_dirname_and_basename ()
196 {
197 # Extract subdirectory from the argument.
198 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
199 if test "X$func_dirname_result" = "X${1}"; then
200 func_dirname_result="${3}"
201 else
202 func_dirname_result="$func_dirname_result${2}"
880203 fi
881 }
882
883
884 # func_mktempdir [BASENAME]
885 # -------------------------
886 # Make a temporary directory that won't clash with other running
887 # libtool processes, and avoids race conditions if possible. If
888 # given, BASENAME is the basename for that directory.
889 func_mktempdir ()
890 {
891 $debug_cmd
892
893 _G_template=${TMPDIR-/tmp}/${1-$progname}
894
895 if test : = "$opt_dry_run"; then
896 # Return a directory name, but don't create it in dry-run mode
897 _G_tmpdir=$_G_template-$$
898 else
899
900 # If mktemp works, use that first and foremost
901 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
902
903 if test ! -d "$_G_tmpdir"; then
904 # Failing that, at least try and use $RANDOM to avoid a race
905 _G_tmpdir=$_G_template-${RANDOM-0}$$
906
907 func_mktempdir_umask=`umask`
908 umask 0077
909 $MKDIR "$_G_tmpdir"
910 umask $func_mktempdir_umask
911 fi
912
913 # If we're not in dry-run mode, bomb out on failure
914 test -d "$_G_tmpdir" || \
915 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
916 fi
917
918 $ECHO "$_G_tmpdir"
919 }
920
204 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
205 } # func_dirname_and_basename may be replaced by extended shell implementation
206
207
208 # func_stripname prefix suffix name
209 # strip PREFIX and SUFFIX off of NAME.
210 # PREFIX and SUFFIX must not contain globbing or regex special
211 # characters, hashes, percent signs, but SUFFIX may contain a leading
212 # dot (in which case that matches only a dot).
213 # func_strip_suffix prefix name
214 func_stripname ()
215 {
216 case ${2} in
217 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
218 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
219 esac
220 } # func_stripname may be replaced by extended shell implementation
221
222
223 # These SED scripts presuppose an absolute path with a trailing slash.
224 pathcar='s,^/\([^/]*\).*$,\1,'
225 pathcdr='s,^/[^/]*,,'
226 removedotparts=':dotsl
227 s@/\./@/@g
228 t dotsl
229 s,/\.$,/,'
230 collapseslashes='s@/\{1,\}@/@g'
231 finalslash='s,/*$,/,'
921232
922233 # func_normal_abspath PATH
923 # ------------------------
924234 # Remove doubled-up and trailing slashes, "." path components,
925235 # and cancel out any ".." path components in PATH after making
926236 # it an absolute path.
237 # value returned in "$func_normal_abspath_result"
927238 func_normal_abspath ()
928239 {
929 $debug_cmd
930
931 # These SED scripts presuppose an absolute path with a trailing slash.
932 _G_pathcar='s|^/\([^/]*\).*$|\1|'
933 _G_pathcdr='s|^/[^/]*||'
934 _G_removedotparts=':dotsl
935 s|/\./|/|g
936 t dotsl
937 s|/\.$|/|'
938 _G_collapseslashes='s|/\{1,\}|/|g'
939 _G_finalslash='s|/*$|/|'
940
941 # Start from root dir and reassemble the path.
942 func_normal_abspath_result=
943 func_normal_abspath_tpath=$1
944 func_normal_abspath_altnamespace=
945 case $func_normal_abspath_tpath in
240 # Start from root dir and reassemble the path.
241 func_normal_abspath_result=
242 func_normal_abspath_tpath=$1
243 func_normal_abspath_altnamespace=
244 case $func_normal_abspath_tpath in
245 "")
246 # Empty path, that just means $cwd.
247 func_stripname '' '/' "`pwd`"
248 func_normal_abspath_result=$func_stripname_result
249 return
250 ;;
251 # The next three entries are used to spot a run of precisely
252 # two leading slashes without using negated character classes;
253 # we take advantage of case's first-match behaviour.
254 ///*)
255 # Unusual form of absolute path, do nothing.
256 ;;
257 //*)
258 # Not necessarily an ordinary path; POSIX reserves leading '//'
259 # and for example Cygwin uses it to access remote file shares
260 # over CIFS/SMB, so we conserve a leading double slash if found.
261 func_normal_abspath_altnamespace=/
262 ;;
263 /*)
264 # Absolute path, do nothing.
265 ;;
266 *)
267 # Relative path, prepend $cwd.
268 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
269 ;;
270 esac
271 # Cancel out all the simple stuff to save iterations. We also want
272 # the path to end with a slash for ease of parsing, so make sure
273 # there is one (and only one) here.
274 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
275 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
276 while :; do
277 # Processed it all yet?
278 if test "$func_normal_abspath_tpath" = / ; then
279 # If we ascended to the root using ".." the result may be empty now.
280 if test -z "$func_normal_abspath_result" ; then
281 func_normal_abspath_result=/
282 fi
283 break
284 fi
285 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
286 -e "$pathcar"`
287 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
288 -e "$pathcdr"`
289 # Figure out what to do with it
290 case $func_normal_abspath_tcomponent in
946291 "")
947 # Empty path, that just means $cwd.
948 func_stripname '' '/' "`pwd`"
949 func_normal_abspath_result=$func_stripname_result
950 return
292 # Trailing empty path component, ignore it.
293 ;;
294 ..)
295 # Parent dir; strip last assembled component from result.
296 func_dirname "$func_normal_abspath_result"
297 func_normal_abspath_result=$func_dirname_result
298 ;;
299 *)
300 # Actual path component, append it.
301 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
302 ;;
303 esac
304 done
305 # Restore leading double-slash if one was found on entry.
306 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
307 }
308
309 # func_relative_path SRCDIR DSTDIR
310 # generates a relative path from SRCDIR to DSTDIR, with a trailing
311 # slash if non-empty, suitable for immediately appending a filename
312 # without needing to append a separator.
313 # value returned in "$func_relative_path_result"
314 func_relative_path ()
315 {
316 func_relative_path_result=
317 func_normal_abspath "$1"
318 func_relative_path_tlibdir=$func_normal_abspath_result
319 func_normal_abspath "$2"
320 func_relative_path_tbindir=$func_normal_abspath_result
321
322 # Ascend the tree starting from libdir
323 while :; do
324 # check if we have found a prefix of bindir
325 case $func_relative_path_tbindir in
326 $func_relative_path_tlibdir)
327 # found an exact match
328 func_relative_path_tcancelled=
329 break
951330 ;;
952 # The next three entries are used to spot a run of precisely
953 # two leading slashes without using negated character classes;
954 # we take advantage of case's first-match behaviour.
955 ///*)
956 # Unusual form of absolute path, do nothing.
957 ;;
958 //*)
959 # Not necessarily an ordinary path; POSIX reserves leading '//'
960 # and for example Cygwin uses it to access remote file shares
961 # over CIFS/SMB, so we conserve a leading double slash if found.
962 func_normal_abspath_altnamespace=/
963 ;;
964 /*)
965 # Absolute path, do nothing.
331 $func_relative_path_tlibdir*)
332 # found a matching prefix
333 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
334 func_relative_path_tcancelled=$func_stripname_result
335 if test -z "$func_relative_path_result"; then
336 func_relative_path_result=.
337 fi
338 break
966339 ;;
967340 *)
968 # Relative path, prepend $cwd.
969 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
341 func_dirname $func_relative_path_tlibdir
342 func_relative_path_tlibdir=${func_dirname_result}
343 if test "x$func_relative_path_tlibdir" = x ; then
344 # Have to descend all the way to the root!
345 func_relative_path_result=../$func_relative_path_result
346 func_relative_path_tcancelled=$func_relative_path_tbindir
347 break
348 fi
349 func_relative_path_result=../$func_relative_path_result
970350 ;;
971351 esac
972
973 # Cancel out all the simple stuff to save iterations. We also want
974 # the path to end with a slash for ease of parsing, so make sure
975 # there is one (and only one) here.
976 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
977 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
978 while :; do
979 # Processed it all yet?
980 if test / = "$func_normal_abspath_tpath"; then
981 # If we ascended to the root using ".." the result may be empty now.
982 if test -z "$func_normal_abspath_result"; then
983 func_normal_abspath_result=/
984 fi
985 break
986 fi
987 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
988 -e "$_G_pathcar"`
989 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
990 -e "$_G_pathcdr"`
991 # Figure out what to do with it
992 case $func_normal_abspath_tcomponent in
993 "")
994 # Trailing empty path component, ignore it.
995 ;;
996 ..)
997 # Parent dir; strip last assembled component from result.
998 func_dirname "$func_normal_abspath_result"
999 func_normal_abspath_result=$func_dirname_result
1000 ;;
1001 *)
1002 # Actual path component, append it.
1003 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1004 ;;
1005 esac
1006 done
1007 # Restore leading double-slash if one was found on entry.
1008 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1009 }
1010
1011
1012 # func_notquiet ARG...
1013 # --------------------
1014 # Echo program name prefixed message only when not in quiet mode.
1015 func_notquiet ()
1016 {
1017 $debug_cmd
1018
1019 $opt_quiet || func_echo ${1+"$@"}
352 done
353
354 # Now calculate path; take care to avoid doubling-up slashes.
355 func_stripname '' '/' "$func_relative_path_result"
356 func_relative_path_result=$func_stripname_result
357 func_stripname '/' '/' "$func_relative_path_tcancelled"
358 if test "x$func_stripname_result" != x ; then
359 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
360 fi
361
362 # Normalisation. If bindir is libdir, return empty string,
363 # else relative path ending with a slash; either way, target
364 # file name can be directly appended.
365 if test ! -z "$func_relative_path_result"; then
366 func_stripname './' '' "$func_relative_path_result/"
367 func_relative_path_result=$func_stripname_result
368 fi
369 }
370
371 # The name of this program:
372 func_dirname_and_basename "$progpath"
373 progname=$func_basename_result
374
375 # Make sure we have an absolute path for reexecution:
376 case $progpath in
377 [\\/]*|[A-Za-z]:\\*) ;;
378 *[\\/]*)
379 progdir=$func_dirname_result
380 progdir=`cd "$progdir" && pwd`
381 progpath="$progdir/$progname"
382 ;;
383 *)
384 save_IFS="$IFS"
385 IFS=${PATH_SEPARATOR-:}
386 for progdir in $PATH; do
387 IFS="$save_IFS"
388 test -x "$progdir/$progname" && break
389 done
390 IFS="$save_IFS"
391 test -n "$progdir" || progdir=`pwd`
392 progpath="$progdir/$progname"
393 ;;
394 esac
395
396 # Sed substitution that helps us do robust quoting. It backslashifies
397 # metacharacters that are still active within double-quoted strings.
398 Xsed="${SED}"' -e 1s/^X//'
399 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
400
401 # Same as above, but do not quote variable references.
402 double_quote_subst='s/\(["`\\]\)/\\\1/g'
403
404 # Sed substitution that turns a string into a regex matching for the
405 # string literally.
406 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
407
408 # Sed substitution that converts a w32 file name or path
409 # which contains forward slashes, into one that contains
410 # (escaped) backslashes. A very naive implementation.
411 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
412
413 # Re-`\' parameter expansions in output of double_quote_subst that were
414 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
415 # in input to double_quote_subst, that '$' was protected from expansion.
416 # Since each input `\' is now two `\'s, look for any number of runs of
417 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
418 bs='\\'
419 bs2='\\\\'
420 bs4='\\\\\\\\'
421 dollar='\$'
422 sed_double_backslash="\
423 s/$bs4/&\\
424 /g
425 s/^$bs2$dollar/$bs&/
426 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
427 s/\n//g"
428
429 # Standard options:
430 opt_dry_run=false
431 opt_help=false
432 opt_quiet=false
433 opt_verbose=false
434 opt_warning=:
435
436 # func_echo arg...
437 # Echo program name prefixed message, along with the current mode
438 # name if it has been set yet.
439 func_echo ()
440 {
441 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
442 }
443
444 # func_verbose arg...
445 # Echo program name prefixed message in verbose mode only.
446 func_verbose ()
447 {
448 $opt_verbose && func_echo ${1+"$@"}
1020449
1021450 # A bug in bash halts the script if the last line of a function
1022451 # fails when set -e is in force, so we need another command to
1024453 :
1025454 }
1026455
1027
1028 # func_relative_path SRCDIR DSTDIR
1029 # --------------------------------
1030 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1031 func_relative_path ()
1032 {
1033 $debug_cmd
1034
1035 func_relative_path_result=
1036 func_normal_abspath "$1"
1037 func_relative_path_tlibdir=$func_normal_abspath_result
1038 func_normal_abspath "$2"
1039 func_relative_path_tbindir=$func_normal_abspath_result
1040
1041 # Ascend the tree starting from libdir
1042 while :; do
1043 # check if we have found a prefix of bindir
1044 case $func_relative_path_tbindir in
1045 $func_relative_path_tlibdir)
1046 # found an exact match
1047 func_relative_path_tcancelled=
1048 break
1049 ;;
1050 $func_relative_path_tlibdir*)
1051 # found a matching prefix
1052 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1053 func_relative_path_tcancelled=$func_stripname_result
1054 if test -z "$func_relative_path_result"; then
1055 func_relative_path_result=.
1056 fi
1057 break
1058 ;;
1059 *)
1060 func_dirname $func_relative_path_tlibdir
1061 func_relative_path_tlibdir=$func_dirname_result
1062 if test -z "$func_relative_path_tlibdir"; then
1063 # Have to descend all the way to the root!
1064 func_relative_path_result=../$func_relative_path_result
1065 func_relative_path_tcancelled=$func_relative_path_tbindir
1066 break
1067 fi
1068 func_relative_path_result=../$func_relative_path_result
1069 ;;
456 # func_echo_all arg...
457 # Invoke $ECHO with all args, space-separated.
458 func_echo_all ()
459 {
460 $ECHO "$*"
461 }
462
463 # func_error arg...
464 # Echo program name prefixed message to standard error.
465 func_error ()
466 {
467 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
468 }
469
470 # func_warning arg...
471 # Echo program name prefixed warning message to standard error.
472 func_warning ()
473 {
474 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
475
476 # bash bug again:
477 :
478 }
479
480 # func_fatal_error arg...
481 # Echo program name prefixed message to standard error, and exit.
482 func_fatal_error ()
483 {
484 func_error ${1+"$@"}
485 exit $EXIT_FAILURE
486 }
487
488 # func_fatal_help arg...
489 # Echo program name prefixed message to standard error, followed by
490 # a help hint, and exit.
491 func_fatal_help ()
492 {
493 func_error ${1+"$@"}
494 func_fatal_error "$help"
495 }
496 help="Try \`$progname --help' for more information." ## default
497
498
499 # func_grep expression filename
500 # Check whether EXPRESSION matches any line of FILENAME, without output.
501 func_grep ()
502 {
503 $GREP "$1" "$2" >/dev/null 2>&1
504 }
505
506
507 # func_mkdir_p directory-path
508 # Make sure the entire path to DIRECTORY-PATH is available.
509 func_mkdir_p ()
510 {
511 my_directory_path="$1"
512 my_dir_list=
513
514 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
515
516 # Protect directory names starting with `-'
517 case $my_directory_path in
518 -*) my_directory_path="./$my_directory_path" ;;
1070519 esac
1071 done
1072
1073 # Now calculate path; take care to avoid doubling-up slashes.
1074 func_stripname '' '/' "$func_relative_path_result"
1075 func_relative_path_result=$func_stripname_result
1076 func_stripname '/' '/' "$func_relative_path_tcancelled"
1077 if test -n "$func_stripname_result"; then
1078 func_append func_relative_path_result "/$func_stripname_result"
520
521 # While some portion of DIR does not yet exist...
522 while test ! -d "$my_directory_path"; do
523 # ...make a list in topmost first order. Use a colon delimited
524 # list incase some portion of path contains whitespace.
525 my_dir_list="$my_directory_path:$my_dir_list"
526
527 # If the last portion added has no slash in it, the list is done
528 case $my_directory_path in */*) ;; *) break ;; esac
529
530 # ...otherwise throw away the child directory and loop
531 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
532 done
533 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
534
535 save_mkdir_p_IFS="$IFS"; IFS=':'
536 for my_dir in $my_dir_list; do
537 IFS="$save_mkdir_p_IFS"
538 # mkdir can fail with a `File exist' error if two processes
539 # try to create one of the directories concurrently. Don't
540 # stop in that case!
541 $MKDIR "$my_dir" 2>/dev/null || :
542 done
543 IFS="$save_mkdir_p_IFS"
544
545 # Bail out if we (or some other process) failed to create a directory.
546 test -d "$my_directory_path" || \
547 func_fatal_error "Failed to create \`$1'"
1079548 fi
1080
1081 # Normalisation. If bindir is libdir, return '.' else relative path.
1082 if test -n "$func_relative_path_result"; then
1083 func_stripname './' '' "$func_relative_path_result"
1084 func_relative_path_result=$func_stripname_result
549 }
550
551
552 # func_mktempdir [string]
553 # Make a temporary directory that won't clash with other running
554 # libtool processes, and avoids race conditions if possible. If
555 # given, STRING is the basename for that directory.
556 func_mktempdir ()
557 {
558 my_template="${TMPDIR-/tmp}/${1-$progname}"
559
560 if test "$opt_dry_run" = ":"; then
561 # Return a directory name, but don't create it in dry-run mode
562 my_tmpdir="${my_template}-$$"
563 else
564
565 # If mktemp works, use that first and foremost
566 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
567
568 if test ! -d "$my_tmpdir"; then
569 # Failing that, at least try and use $RANDOM to avoid a race
570 my_tmpdir="${my_template}-${RANDOM-0}$$"
571
572 save_mktempdir_umask=`umask`
573 umask 0077
574 $MKDIR "$my_tmpdir"
575 umask $save_mktempdir_umask
576 fi
577
578 # If we're not in dry-run mode, bomb out on failure
579 test -d "$my_tmpdir" || \
580 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
1085581 fi
1086582
1087 test -n "$func_relative_path_result" || func_relative_path_result=.
1088
1089 :
1090 }
1091
1092
1093 # func_quote_for_eval ARG...
1094 # --------------------------
1095 # Aesthetically quote ARGs to be evaled later.
1096 # This function returns two values:
1097 # i) func_quote_for_eval_result
1098 # double-quoted, suitable for a subsequent eval
1099 # ii) func_quote_for_eval_unquoted_result
1100 # has all characters that are still active within double
1101 # quotes backslashified.
583 $ECHO "$my_tmpdir"
584 }
585
586
587 # func_quote_for_eval arg
588 # Aesthetically quote ARG to be evaled later.
589 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
590 # is double-quoted, suitable for a subsequent eval, whereas
591 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
592 # which are still active within double quotes backslashified.
1102593 func_quote_for_eval ()
1103594 {
1104 $debug_cmd
1105
1106 func_quote_for_eval_unquoted_result=
1107 func_quote_for_eval_result=
1108 while test 0 -lt $#; do
1109 case $1 in
1110 *[\\\`\"\$]*)
1111 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1112 *)
1113 _G_unquoted_arg=$1 ;;
1114 esac
1115 if test -n "$func_quote_for_eval_unquoted_result"; then
1116 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1117 else
1118 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1119 fi
1120
1121 case $_G_unquoted_arg in
1122 # Double-quote args containing shell metacharacters to delay
1123 # word splitting, command substitution and variable expansion
1124 # for a subsequent eval.
1125 # Many Bourne shells cannot handle close brackets correctly
1126 # in scan sets, so we specify it separately.
1127 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1128 _G_quoted_arg=\"$_G_unquoted_arg\"
1129 ;;
1130 *)
1131 _G_quoted_arg=$_G_unquoted_arg
1132 ;;
1133 esac
1134
1135 if test -n "$func_quote_for_eval_result"; then
1136 func_append func_quote_for_eval_result " $_G_quoted_arg"
1137 else
1138 func_append func_quote_for_eval_result "$_G_quoted_arg"
1139 fi
1140 shift
1141 done
1142 }
1143
1144
1145 # func_quote_for_expand ARG
1146 # -------------------------
595 case $1 in
596 *[\\\`\"\$]*)
597 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
598 *)
599 func_quote_for_eval_unquoted_result="$1" ;;
600 esac
601
602 case $func_quote_for_eval_unquoted_result in
603 # Double-quote args containing shell metacharacters to delay
604 # word splitting, command substitution and and variable
605 # expansion for a subsequent eval.
606 # Many Bourne shells cannot handle close brackets correctly
607 # in scan sets, so we specify it separately.
608 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
609 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
610 ;;
611 *)
612 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
613 esac
614 }
615
616
617 # func_quote_for_expand arg
1147618 # Aesthetically quote ARG to be evaled later; same as above,
1148619 # but do not quote variable references.
1149620 func_quote_for_expand ()
1150621 {
1151 $debug_cmd
1152
1153622 case $1 in
1154623 *[\\\`\"]*)
1155 _G_arg=`$ECHO "$1" | $SED \
1156 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
624 my_arg=`$ECHO "$1" | $SED \
625 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
1157626 *)
1158 _G_arg=$1 ;;
627 my_arg="$1" ;;
1159628 esac
1160629
1161 case $_G_arg in
630 case $my_arg in
1162631 # Double-quote args containing shell metacharacters to delay
1163632 # word splitting and command substitution for a subsequent eval.
1164633 # Many Bourne shells cannot handle close brackets correctly
1165634 # in scan sets, so we specify it separately.
1166635 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1167 _G_arg=\"$_G_arg\"
636 my_arg="\"$my_arg\""
1168637 ;;
1169638 esac
1170639
1171 func_quote_for_expand_result=$_G_arg
1172 }
1173
1174
1175 # func_stripname PREFIX SUFFIX NAME
1176 # ---------------------------------
1177 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1178 # PREFIX and SUFFIX must not contain globbing or regex special
1179 # characters, hashes, percent signs, but SUFFIX may contain a leading
1180 # dot (in which case that matches only a dot).
1181 if test yes = "$_G_HAVE_XSI_OPS"; then
1182 eval 'func_stripname ()
1183 {
1184 $debug_cmd
1185
1186 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1187 # positional parameters, so assign one to ordinary variable first.
1188 func_stripname_result=$3
1189 func_stripname_result=${func_stripname_result#"$1"}
1190 func_stripname_result=${func_stripname_result%"$2"}
1191 }'
1192 else
1193 func_stripname ()
1194 {
1195 $debug_cmd
1196
1197 case $2 in
1198 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1199 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1200 esac
1201 }
1202 fi
1203
1204
1205 # func_show_eval CMD [FAIL_EXP]
1206 # -----------------------------
1207 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
640 func_quote_for_expand_result="$my_arg"
641 }
642
643
644 # func_show_eval cmd [fail_exp]
645 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1208646 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1209647 # is given, then evaluate it.
1210648 func_show_eval ()
1211649 {
1212 $debug_cmd
1213
1214 _G_cmd=$1
1215 _G_fail_exp=${2-':'}
1216
1217 func_quote_for_expand "$_G_cmd"
1218 eval "func_notquiet $func_quote_for_expand_result"
1219
1220 $opt_dry_run || {
1221 eval "$_G_cmd"
1222 _G_status=$?
1223 if test 0 -ne "$_G_status"; then
1224 eval "(exit $_G_status); $_G_fail_exp"
650 my_cmd="$1"
651 my_fail_exp="${2-:}"
652
653 ${opt_silent-false} || {
654 func_quote_for_expand "$my_cmd"
655 eval "func_echo $func_quote_for_expand_result"
656 }
657
658 if ${opt_dry_run-false}; then :; else
659 eval "$my_cmd"
660 my_status=$?
661 if test "$my_status" -eq 0; then :; else
662 eval "(exit $my_status); $my_fail_exp"
1225663 fi
1226 }
1227 }
1228
1229
1230 # func_show_eval_locale CMD [FAIL_EXP]
1231 # ------------------------------------
1232 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
664 fi
665 }
666
667
668 # func_show_eval_locale cmd [fail_exp]
669 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
1233670 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1234671 # is given, then evaluate it. Use the saved locale for evaluation.
1235672 func_show_eval_locale ()
1236673 {
1237 $debug_cmd
1238
1239 _G_cmd=$1
1240 _G_fail_exp=${2-':'}
1241
1242 $opt_quiet || {
1243 func_quote_for_expand "$_G_cmd"
674 my_cmd="$1"
675 my_fail_exp="${2-:}"
676
677 ${opt_silent-false} || {
678 func_quote_for_expand "$my_cmd"
1244679 eval "func_echo $func_quote_for_expand_result"
1245680 }
1246681
1247 $opt_dry_run || {
1248 eval "$_G_user_locale
1249 $_G_cmd"
1250 _G_status=$?
1251 eval "$_G_safe_locale"
1252 if test 0 -ne "$_G_status"; then
1253 eval "(exit $_G_status); $_G_fail_exp"
682 if ${opt_dry_run-false}; then :; else
683 eval "$lt_user_locale
684 $my_cmd"
685 my_status=$?
686 eval "$lt_safe_locale"
687 if test "$my_status" -eq 0; then :; else
688 eval "(exit $my_status); $my_fail_exp"
1254689 fi
1255 }
1256 }
1257
690 fi
691 }
1258692
1259693 # func_tr_sh
1260 # ----------
1261694 # Turn $1 into a string suitable for a shell variable name.
1262695 # Result is stored in $func_tr_sh_result. All characters
1263696 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1264697 # if $1 begins with a digit, a '_' is prepended as well.
1265698 func_tr_sh ()
1266699 {
1267 $debug_cmd
1268
1269 case $1 in
1270 [0-9]* | *[!a-zA-Z0-9_]*)
1271 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1272 ;;
1273 * )
1274 func_tr_sh_result=$1
1275 ;;
1276 esac
1277 }
1278
1279
1280 # func_verbose ARG...
1281 # -------------------
1282 # Echo program name prefixed message in verbose mode only.
1283 func_verbose ()
1284 {
1285 $debug_cmd
1286
1287 $opt_verbose && func_echo "$*"
1288
1289 :
1290 }
1291
1292
1293 # func_warn_and_continue ARG...
1294 # -----------------------------
1295 # Echo program name prefixed warning message to standard error.
1296 func_warn_and_continue ()
1297 {
1298 $debug_cmd
1299
1300 $require_term_colors
1301
1302 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1303 }
1304
1305
1306 # func_warning CATEGORY ARG...
1307 # ----------------------------
1308 # Echo program name prefixed warning message to standard error. Warning
1309 # messages can be filtered according to CATEGORY, where this function
1310 # elides messages where CATEGORY is not listed in the global variable
1311 # 'opt_warning_types'.
1312 func_warning ()
1313 {
1314 $debug_cmd
1315
1316 # CATEGORY must be in the warning_categories list!
1317 case " $warning_categories " in
1318 *" $1 "*) ;;
1319 *) func_internal_error "invalid warning category '$1'" ;;
1320 esac
1321
1322 _G_category=$1
1323 shift
1324
1325 case " $opt_warning_types " in
1326 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1327 esac
1328 }
1329
1330
1331 # func_sort_ver VER1 VER2
1332 # -----------------------
1333 # 'sort -V' is not generally available.
1334 # Note this deviates from the version comparison in automake
1335 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1336 # but this should suffice as we won't be specifying old
1337 # version formats or redundant trailing .0 in bootstrap.conf.
1338 # If we did want full compatibility then we should probably
1339 # use m4_version_compare from autoconf.
1340 func_sort_ver ()
1341 {
1342 $debug_cmd
1343
1344 printf '%s\n%s\n' "$1" "$2" \
1345 | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
1346 }
1347
1348 # func_lt_ver PREV CURR
1349 # ---------------------
1350 # Return true if PREV and CURR are in the correct order according to
1351 # func_sort_ver, otherwise false. Use it like this:
1352 #
1353 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1354 func_lt_ver ()
1355 {
1356 $debug_cmd
1357
1358 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1359 }
1360
1361
1362 # Local variables:
1363 # mode: shell-script
1364 # sh-indentation: 2
1365 # eval: (add-hook 'before-save-hook 'time-stamp)
1366 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1367 # time-stamp-time-zone: "UTC"
1368 # End:
1369 #! /bin/sh
1370
1371 # Set a version string for this script.
1372 scriptversion=2014-01-07.03; # UTC
1373
1374 # A portable, pluggable option parser for Bourne shell.
1375 # Written by Gary V. Vaughan, 2010
1376
1377 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1378 # This is free software; see the source for copying conditions. There is NO
1379 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1380
1381 # This program is free software: you can redistribute it and/or modify
1382 # it under the terms of the GNU General Public License as published by
1383 # the Free Software Foundation, either version 3 of the License, or
1384 # (at your option) any later version.
1385
1386 # This program is distributed in the hope that it will be useful,
1387 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1388 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1389 # GNU General Public License for more details.
1390
1391 # You should have received a copy of the GNU General Public License
1392 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1393
1394 # Please report bugs or propose patches to gary@gnu.org.
1395
1396
1397 ## ------ ##
1398 ## Usage. ##
1399 ## ------ ##
1400
1401 # This file is a library for parsing options in your shell scripts along
1402 # with assorted other useful supporting features that you can make use
1403 # of too.
1404 #
1405 # For the simplest scripts you might need only:
1406 #
1407 # #!/bin/sh
1408 # . relative/path/to/funclib.sh
1409 # . relative/path/to/options-parser
1410 # scriptversion=1.0
1411 # func_options ${1+"$@"}
1412 # eval set dummy "$func_options_result"; shift
1413 # ...rest of your script...
1414 #
1415 # In order for the '--version' option to work, you will need to have a
1416 # suitably formatted comment like the one at the top of this file
1417 # starting with '# Written by ' and ending with '# warranty; '.
1418 #
1419 # For '-h' and '--help' to work, you will also need a one line
1420 # description of your script's purpose in a comment directly above the
1421 # '# Written by ' line, like the one at the top of this file.
1422 #
1423 # The default options also support '--debug', which will turn on shell
1424 # execution tracing (see the comment above debug_cmd below for another
1425 # use), and '--verbose' and the func_verbose function to allow your script
1426 # to display verbose messages only when your user has specified
1427 # '--verbose'.
1428 #
1429 # After sourcing this file, you can plug processing for additional
1430 # options by amending the variables from the 'Configuration' section
1431 # below, and following the instructions in the 'Option parsing'
1432 # section further down.
1433
1434 ## -------------- ##
1435 ## Configuration. ##
1436 ## -------------- ##
1437
1438 # You should override these variables in your script after sourcing this
1439 # file so that they reflect the customisations you have added to the
1440 # option parser.
1441
1442 # The usage line for option parsing errors and the start of '-h' and
1443 # '--help' output messages. You can embed shell variables for delayed
1444 # expansion at the time the message is displayed, but you will need to
1445 # quote other shell meta-characters carefully to prevent them being
1446 # expanded when the contents are evaled.
1447 usage='$progpath [OPTION]...'
1448
1449 # Short help message in response to '-h' and '--help'. Add to this or
1450 # override it after sourcing this library to reflect the full set of
1451 # options your script accepts.
1452 usage_message="\
1453 --debug enable verbose shell tracing
1454 -W, --warnings=CATEGORY
1455 report the warnings falling in CATEGORY [all]
1456 -v, --verbose verbosely report processing
1457 --version print version information and exit
1458 -h, --help print short or long help message and exit
1459 "
1460
1461 # Additional text appended to 'usage_message' in response to '--help'.
1462 long_help_message="
1463 Warning categories include:
1464 'all' show all warnings
1465 'none' turn off all the warnings
1466 'error' warnings are treated as fatal errors"
1467
1468 # Help message printed before fatal option parsing errors.
1469 fatal_help="Try '\$progname --help' for more information."
1470
1471
1472
1473 ## ------------------------- ##
1474 ## Hook function management. ##
1475 ## ------------------------- ##
1476
1477 # This section contains functions for adding, removing, and running hooks
1478 # to the main code. A hook is just a named list of of function, that can
1479 # be run in order later on.
1480
1481 # func_hookable FUNC_NAME
1482 # -----------------------
1483 # Declare that FUNC_NAME will run hooks added with
1484 # 'func_add_hook FUNC_NAME ...'.
1485 func_hookable ()
1486 {
1487 $debug_cmd
1488
1489 func_append hookable_fns " $1"
1490 }
1491
1492
1493 # func_add_hook FUNC_NAME HOOK_FUNC
1494 # ---------------------------------
1495 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1496 # first have been declared "hookable" by a call to 'func_hookable'.
1497 func_add_hook ()
1498 {
1499 $debug_cmd
1500
1501 case " $hookable_fns " in
1502 *" $1 "*) ;;
1503 *) func_fatal_error "'$1' does not accept hook functions." ;;
1504 esac
1505
1506 eval func_append ${1}_hooks '" $2"'
1507 }
1508
1509
1510 # func_remove_hook FUNC_NAME HOOK_FUNC
1511 # ------------------------------------
1512 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
1513 func_remove_hook ()
1514 {
1515 $debug_cmd
1516
1517 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1518 }
1519
1520
1521 # func_run_hooks FUNC_NAME [ARG]...
1522 # ---------------------------------
1523 # Run all hook functions registered to FUNC_NAME.
1524 # It is assumed that the list of hook functions contains nothing more
1525 # than a whitespace-delimited list of legal shell function names, and
1526 # no effort is wasted trying to catch shell meta-characters or preserve
1527 # whitespace.
1528 func_run_hooks ()
1529 {
1530 $debug_cmd
1531
1532 case " $hookable_fns " in
1533 *" $1 "*) ;;
1534 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
1535 esac
1536
1537 eval _G_hook_fns=\$$1_hooks; shift
1538
1539 for _G_hook in $_G_hook_fns; do
1540 eval $_G_hook '"$@"'
1541
1542 # store returned options list back into positional
1543 # parameters for next 'cmd' execution.
1544 eval _G_hook_result=\$${_G_hook}_result
1545 eval set dummy "$_G_hook_result"; shift
1546 done
1547
1548 func_quote_for_eval ${1+"$@"}
1549 func_run_hooks_result=$func_quote_for_eval_result
1550 }
1551
1552
1553
1554 ## --------------- ##
1555 ## Option parsing. ##
1556 ## --------------- ##
1557
1558 # In order to add your own option parsing hooks, you must accept the
1559 # full positional parameter list in your hook function, remove any
1560 # options that you action, and then pass back the remaining unprocessed
1561 # options in '<hooked_function_name>_result', escaped suitably for
1562 # 'eval'. Like this:
1563 #
1564 # my_options_prep ()
1565 # {
1566 # $debug_cmd
1567 #
1568 # # Extend the existing usage message.
1569 # usage_message=$usage_message'
1570 # -s, --silent don'\''t print informational messages
1571 # '
1572 #
1573 # func_quote_for_eval ${1+"$@"}
1574 # my_options_prep_result=$func_quote_for_eval_result
1575 # }
1576 # func_add_hook func_options_prep my_options_prep
1577 #
1578 #
1579 # my_silent_option ()
1580 # {
1581 # $debug_cmd
1582 #
1583 # # Note that for efficiency, we parse as many options as we can
1584 # # recognise in a loop before passing the remainder back to the
1585 # # caller on the first unrecognised argument we encounter.
1586 # while test $# -gt 0; do
1587 # opt=$1; shift
1588 # case $opt in
1589 # --silent|-s) opt_silent=: ;;
1590 # # Separate non-argument short options:
1591 # -s*) func_split_short_opt "$_G_opt"
1592 # set dummy "$func_split_short_opt_name" \
1593 # "-$func_split_short_opt_arg" ${1+"$@"}
1594 # shift
1595 # ;;
1596 # *) set dummy "$_G_opt" "$*"; shift; break ;;
1597 # esac
1598 # done
1599 #
1600 # func_quote_for_eval ${1+"$@"}
1601 # my_silent_option_result=$func_quote_for_eval_result
1602 # }
1603 # func_add_hook func_parse_options my_silent_option
1604 #
1605 #
1606 # my_option_validation ()
1607 # {
1608 # $debug_cmd
1609 #
1610 # $opt_silent && $opt_verbose && func_fatal_help "\
1611 # '--silent' and '--verbose' options are mutually exclusive."
1612 #
1613 # func_quote_for_eval ${1+"$@"}
1614 # my_option_validation_result=$func_quote_for_eval_result
1615 # }
1616 # func_add_hook func_validate_options my_option_validation
1617 #
1618 # You'll alse need to manually amend $usage_message to reflect the extra
1619 # options you parse. It's preferable to append if you can, so that
1620 # multiple option parsing hooks can be added safely.
1621
1622
1623 # func_options [ARG]...
1624 # ---------------------
1625 # All the functions called inside func_options are hookable. See the
1626 # individual implementations for details.
1627 func_hookable func_options
1628 func_options ()
1629 {
1630 $debug_cmd
1631
1632 func_options_prep ${1+"$@"}
1633 eval func_parse_options \
1634 ${func_options_prep_result+"$func_options_prep_result"}
1635 eval func_validate_options \
1636 ${func_parse_options_result+"$func_parse_options_result"}
1637
1638 eval func_run_hooks func_options \
1639 ${func_validate_options_result+"$func_validate_options_result"}
1640
1641 # save modified positional parameters for caller
1642 func_options_result=$func_run_hooks_result
1643 }
1644
1645
1646 # func_options_prep [ARG]...
1647 # --------------------------
1648 # All initialisations required before starting the option parse loop.
1649 # Note that when calling hook functions, we pass through the list of
1650 # positional parameters. If a hook function modifies that list, and
1651 # needs to propogate that back to rest of this script, then the complete
1652 # modified list must be put in 'func_run_hooks_result' before
1653 # returning.
1654 func_hookable func_options_prep
1655 func_options_prep ()
1656 {
1657 $debug_cmd
1658
1659 # Option defaults:
1660 opt_verbose=false
1661 opt_warning_types=
1662
1663 func_run_hooks func_options_prep ${1+"$@"}
1664
1665 # save modified positional parameters for caller
1666 func_options_prep_result=$func_run_hooks_result
1667 }
1668
1669
1670 # func_parse_options [ARG]...
1671 # ---------------------------
1672 # The main option parsing loop.
1673 func_hookable func_parse_options
1674 func_parse_options ()
1675 {
1676 $debug_cmd
1677
1678 func_parse_options_result=
1679
1680 # this just eases exit handling
1681 while test $# -gt 0; do
1682 # Defer to hook functions for initial option parsing, so they
1683 # get priority in the event of reusing an option name.
1684 func_run_hooks func_parse_options ${1+"$@"}
1685
1686 # Adjust func_parse_options positional parameters to match
1687 eval set dummy "$func_run_hooks_result"; shift
1688
1689 # Break out of the loop if we already parsed every option.
1690 test $# -gt 0 || break
1691
1692 _G_opt=$1
1693 shift
1694 case $_G_opt in
1695 --debug|-x) debug_cmd='set -x'
1696 func_echo "enabling shell trace mode"
1697 $debug_cmd
1698 ;;
1699
1700 --no-warnings|--no-warning|--no-warn)
1701 set dummy --warnings none ${1+"$@"}
1702 shift
1703 ;;
1704
1705 --warnings|--warning|-W)
1706 test $# = 0 && func_missing_arg $_G_opt && break
1707 case " $warning_categories $1" in
1708 *" $1 "*)
1709 # trailing space prevents matching last $1 above
1710 func_append_uniq opt_warning_types " $1"
1711 ;;
1712 *all)
1713 opt_warning_types=$warning_categories
1714 ;;
1715 *none)
1716 opt_warning_types=none
1717 warning_func=:
1718 ;;
1719 *error)
1720 opt_warning_types=$warning_categories
1721 warning_func=func_fatal_error
1722 ;;
1723 *)
1724 func_fatal_error \
1725 "unsupported warning category: '$1'"
1726 ;;
1727 esac
1728 shift
1729 ;;
1730
1731 --verbose|-v) opt_verbose=: ;;
1732 --version) func_version ;;
1733 -\?|-h) func_usage ;;
1734 --help) func_help ;;
1735
1736 # Separate optargs to long options (plugins may need this):
1737 --*=*) func_split_equals "$_G_opt"
1738 set dummy "$func_split_equals_lhs" \
1739 "$func_split_equals_rhs" ${1+"$@"}
1740 shift
1741 ;;
1742
1743 # Separate optargs to short options:
1744 -W*)
1745 func_split_short_opt "$_G_opt"
1746 set dummy "$func_split_short_opt_name" \
1747 "$func_split_short_opt_arg" ${1+"$@"}
1748 shift
1749 ;;
1750
1751 # Separate non-argument short options:
1752 -\?*|-h*|-v*|-x*)
1753 func_split_short_opt "$_G_opt"
1754 set dummy "$func_split_short_opt_name" \
1755 "-$func_split_short_opt_arg" ${1+"$@"}
1756 shift
1757 ;;
1758
1759 --) break ;;
1760 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1761 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1762 esac
1763 done
1764
1765 # save modified positional parameters for caller
1766 func_quote_for_eval ${1+"$@"}
1767 func_parse_options_result=$func_quote_for_eval_result
1768 }
1769
1770
1771 # func_validate_options [ARG]...
1772 # ------------------------------
1773 # Perform any sanity checks on option settings and/or unconsumed
1774 # arguments.
1775 func_hookable func_validate_options
1776 func_validate_options ()
1777 {
1778 $debug_cmd
1779
1780 # Display all warnings if -W was not given.
1781 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1782
1783 func_run_hooks func_validate_options ${1+"$@"}
1784
1785 # Bail if the options were screwed!
1786 $exit_cmd $EXIT_FAILURE
1787
1788 # save modified positional parameters for caller
1789 func_validate_options_result=$func_run_hooks_result
1790 }
1791
1792
1793
1794 ## ----------------- ##
1795 ## Helper functions. ##
1796 ## ----------------- ##
1797
1798 # This section contains the helper functions used by the rest of the
1799 # hookable option parser framework in ascii-betical order.
1800
1801
1802 # func_fatal_help ARG...
1803 # ----------------------
1804 # Echo program name prefixed message to standard error, followed by
1805 # a help hint, and exit.
1806 func_fatal_help ()
1807 {
1808 $debug_cmd
1809
1810 eval \$ECHO \""Usage: $usage"\"
1811 eval \$ECHO \""$fatal_help"\"
1812 func_error ${1+"$@"}
1813 exit $EXIT_FAILURE
1814 }
1815
1816
1817 # func_help
1818 # ---------
1819 # Echo long help message to standard output and exit.
700 case $1 in
701 [0-9]* | *[!a-zA-Z0-9_]*)
702 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
703 ;;
704 * )
705 func_tr_sh_result=$1
706 ;;
707 esac
708 }
709
710
711 # func_version
712 # Echo version message to standard output and exit.
713 func_version ()
714 {
715 $opt_debug
716
717 $SED -n '/(C)/!b go
718 :more
719 /\./!{
720 N
721 s/\n# / /
722 b more
723 }
724 :go
725 /^# '$PROGRAM' (GNU /,/# warranty; / {
726 s/^# //
727 s/^# *$//
728 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
729 p
730 }' < "$progpath"
731 exit $?
732 }
733
734 # func_usage
735 # Echo short help message to standard output and exit.
736 func_usage ()
737 {
738 $opt_debug
739
740 $SED -n '/^# Usage:/,/^# *.*--help/ {
741 s/^# //
742 s/^# *$//
743 s/\$progname/'$progname'/
744 p
745 }' < "$progpath"
746 echo
747 $ECHO "run \`$progname --help | more' for full usage"
748 exit $?
749 }
750
751 # func_help [NOEXIT]
752 # Echo long help message to standard output and exit,
753 # unless 'noexit' is passed as argument.
1820754 func_help ()
1821755 {
1822 $debug_cmd
1823
1824 func_usage_message
1825 $ECHO "$long_help_message"
1826 exit 0
1827 }
1828
1829
1830 # func_missing_arg ARGNAME
1831 # ------------------------
756 $opt_debug
757
758 $SED -n '/^# Usage:/,/# Report bugs to/ {
759 :print
760 s/^# //
761 s/^# *$//
762 s*\$progname*'$progname'*
763 s*\$host*'"$host"'*
764 s*\$SHELL*'"$SHELL"'*
765 s*\$LTCC*'"$LTCC"'*
766 s*\$LTCFLAGS*'"$LTCFLAGS"'*
767 s*\$LD*'"$LD"'*
768 s/\$with_gnu_ld/'"$with_gnu_ld"'/
769 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
770 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
771 p
772 d
773 }
774 /^# .* home page:/b print
775 /^# General help using/b print
776 ' < "$progpath"
777 ret=$?
778 if test -z "$1"; then
779 exit $ret
780 fi
781 }
782
783 # func_missing_arg argname
1832784 # Echo program name prefixed message to standard error and set global
1833785 # exit_cmd.
1834786 func_missing_arg ()
1835787 {
1836 $debug_cmd
1837
1838 func_error "Missing argument for '$1'."
788 $opt_debug
789
790 func_error "missing argument for $1."
1839791 exit_cmd=exit
1840792 }
1841793
1842794
1843 # func_split_equals STRING
1844 # ------------------------
1845 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
1846 # splitting STRING at the '=' sign.
1847 test -z "$_G_HAVE_XSI_OPS" \
1848 && (eval 'x=a/b/c;
1849 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1850 && _G_HAVE_XSI_OPS=yes
1851
1852 if test yes = "$_G_HAVE_XSI_OPS"
1853 then
1854 # This is an XSI compatible shell, allowing a faster implementation...
1855 eval 'func_split_equals ()
1856 {
1857 $debug_cmd
1858
1859 func_split_equals_lhs=${1%%=*}
1860 func_split_equals_rhs=${1#*=}
1861 test "x$func_split_equals_lhs" = "x$1" \
1862 && func_split_equals_rhs=
1863 }'
1864 else
1865 # ...otherwise fall back to using expr, which is often a shell builtin.
1866 func_split_equals ()
1867 {
1868 $debug_cmd
1869
1870 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
1871 func_split_equals_rhs=
1872 test "x$func_split_equals_lhs" = "x$1" \
1873 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
1874 }
1875 fi #func_split_equals
1876
1877
1878 # func_split_short_opt SHORTOPT
1879 # -----------------------------
795 # func_split_short_opt shortopt
1880796 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1881797 # variables after splitting SHORTOPT after the 2nd character.
1882 if test yes = "$_G_HAVE_XSI_OPS"
1883 then
1884 # This is an XSI compatible shell, allowing a faster implementation...
1885 eval 'func_split_short_opt ()
1886 {
1887 $debug_cmd
1888
1889 func_split_short_opt_arg=${1#??}
1890 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1891 }'
1892 else
1893 # ...otherwise fall back to using expr, which is often a shell builtin.
1894 func_split_short_opt ()
1895 {
1896 $debug_cmd
1897
1898 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
1899 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
1900 }
1901 fi #func_split_short_opt
1902
1903
1904 # func_usage
1905 # ----------
1906 # Echo short help message to standard output and exit.
1907 func_usage ()
1908 {
1909 $debug_cmd
1910
1911 func_usage_message
1912 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
1913 exit 0
1914 }
1915
1916
1917 # func_usage_message
1918 # ------------------
1919 # Echo short help message to standard output.
1920 func_usage_message ()
1921 {
1922 $debug_cmd
1923
1924 eval \$ECHO \""Usage: $usage"\"
1925 echo
1926 $SED -n 's|^# ||
1927 /^Written by/{
1928 x;p;x
1929 }
1930 h
1931 /^Written by/q' < "$progpath"
1932 echo
1933 eval \$ECHO \""$usage_message"\"
1934 }
1935
1936
1937 # func_version
1938 # ------------
1939 # Echo version message to standard output and exit.
1940 func_version ()
1941 {
1942 $debug_cmd
1943
1944 printf '%s\n' "$progname $scriptversion"
1945 $SED -n '
1946 /(C)/!b go
1947 :more
1948 /\./!{
1949 N
1950 s|\n# | |
1951 b more
1952 }
1953 :go
1954 /^# Written by /,/# warranty; / {
1955 s|^# ||
1956 s|^# *$||
1957 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
1958 p
1959 }
1960 /^# Written by / {
1961 s|^# ||
1962 p
1963 }
1964 /^warranty; /q' < "$progpath"
1965
1966 exit $?
1967 }
1968
1969
1970 # Local variables:
1971 # mode: shell-script
1972 # sh-indentation: 2
1973 # eval: (add-hook 'before-save-hook 'time-stamp)
1974 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1975 # time-stamp-time-zone: "UTC"
1976 # End:
1977
1978 # Set a version string.
1979 scriptversion='(GNU libtool) 2.4.6'
1980
1981
1982 # func_echo ARG...
1983 # ----------------
1984 # Libtool also displays the current mode in messages, so override
1985 # funclib.sh func_echo with this custom definition.
1986 func_echo ()
1987 {
1988 $debug_cmd
1989
1990 _G_message=$*
1991
1992 func_echo_IFS=$IFS
1993 IFS=$nl
1994 for _G_line in $_G_message; do
1995 IFS=$func_echo_IFS
1996 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
1997 done
1998 IFS=$func_echo_IFS
1999 }
2000
2001
2002 # func_warning ARG...
2003 # -------------------
2004 # Libtool warnings are not categorized, so override funclib.sh
2005 # func_warning with this simpler definition.
2006 func_warning ()
2007 {
2008 $debug_cmd
2009
2010 $warning_func ${1+"$@"}
2011 }
2012
2013
2014 ## ---------------- ##
2015 ## Options parsing. ##
2016 ## ---------------- ##
2017
2018 # Hook in the functions to make sure our own options are parsed during
2019 # the option parsing loop.
2020
2021 usage='$progpath [OPTION]... [MODE-ARG]...'
2022
2023 # Short help message in response to '-h'.
2024 usage_message="Options:
2025 --config show all configuration variables
2026 --debug enable verbose shell tracing
2027 -n, --dry-run display commands without modifying any files
2028 --features display basic configuration information and exit
2029 --mode=MODE use operation mode MODE
2030 --no-warnings equivalent to '-Wnone'
2031 --preserve-dup-deps don't remove duplicate dependency libraries
2032 --quiet, --silent don't print informational messages
2033 --tag=TAG use configuration variables from tag TAG
2034 -v, --verbose print more informational messages than default
2035 --version print version information
2036 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2037 -h, --help, --help-all print short, long, or detailed help message
2038 "
2039
2040 # Additional text appended to 'usage_message' in response to '--help'.
2041 func_help ()
2042 {
2043 $debug_cmd
2044
2045 func_usage_message
2046 $ECHO "$long_help_message
2047
2048 MODE must be one of the following:
2049
2050 clean remove files from the build directory
2051 compile compile a source file into a libtool object
2052 execute automatically set library path, then run a program
2053 finish complete the installation of libtool libraries
2054 install install libraries or executables
2055 link create a library or an executable
2056 uninstall remove libraries from an installed directory
2057
2058 MODE-ARGS vary depending on the MODE. When passed as first option,
2059 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2060 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2061
2062 When reporting a bug, please describe a test case to reproduce it and
2063 include the following information:
2064
2065 host-triplet: $host
2066 shell: $SHELL
2067 compiler: $LTCC
2068 compiler flags: $LTCFLAGS
2069 linker: $LD (gnu? $with_gnu_ld)
2070 version: $progname $scriptversion Debian-2.4.6-2
2071 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2072 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2073
2074 Report bugs to <bug-libtool@gnu.org>.
2075 GNU libtool home page: <http://www.gnu.org/s/libtool/>.
2076 General help using GNU software: <http://www.gnu.org/gethelp/>."
2077 exit 0
2078 }
2079
2080
2081 # func_lo2o OBJECT-NAME
2082 # ---------------------
2083 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2084 # object suffix.
2085
2086 lo2o=s/\\.lo\$/.$objext/
2087 o2lo=s/\\.$objext\$/.lo/
2088
2089 if test yes = "$_G_HAVE_XSI_OPS"; then
2090 eval 'func_lo2o ()
2091 {
2092 case $1 in
2093 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2094 * ) func_lo2o_result=$1 ;;
2095 esac
2096 }'
2097
2098 # func_xform LIBOBJ-OR-SOURCE
2099 # ---------------------------
2100 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2101 # suffix to a '.lo' libtool-object suffix.
2102 eval 'func_xform ()
2103 {
2104 func_xform_result=${1%.*}.lo
2105 }'
2106 else
2107 # ...otherwise fall back to using sed.
2108 func_lo2o ()
2109 {
2110 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2111 }
2112
2113 func_xform ()
2114 {
2115 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2116 }
2117 fi
2118
2119
2120 # func_fatal_configuration ARG...
2121 # -------------------------------
798 func_split_short_opt ()
799 {
800 my_sed_short_opt='1s/^\(..\).*$/\1/;q'
801 my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
802
803 func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
804 func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
805 } # func_split_short_opt may be replaced by extended shell implementation
806
807
808 # func_split_long_opt longopt
809 # Set func_split_long_opt_name and func_split_long_opt_arg shell
810 # variables after splitting LONGOPT at the `=' sign.
811 func_split_long_opt ()
812 {
813 my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
814 my_sed_long_arg='1s/^--[^=]*=//'
815
816 func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
817 func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
818 } # func_split_long_opt may be replaced by extended shell implementation
819
820 exit_cmd=:
821
822
823
824
825
826 magic="%%%MAGIC variable%%%"
827 magic_exe="%%%MAGIC EXE variable%%%"
828
829 # Global variables.
830 nonopt=
831 preserve_args=
832 lo2o="s/\\.lo\$/.${objext}/"
833 o2lo="s/\\.${objext}\$/.lo/"
834 extracted_archives=
835 extracted_serial=0
836
837 # If this variable is set in any of the actions, the command in it
838 # will be execed at the end. This prevents here-documents from being
839 # left over by shells.
840 exec_cmd=
841
842 # func_append var value
843 # Append VALUE to the end of shell variable VAR.
844 func_append ()
845 {
846 eval "${1}=\$${1}\${2}"
847 } # func_append may be replaced by extended shell implementation
848
849 # func_append_quoted var value
850 # Quote VALUE and append to the end of shell variable VAR, separated
851 # by a space.
852 func_append_quoted ()
853 {
854 func_quote_for_eval "${2}"
855 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
856 } # func_append_quoted may be replaced by extended shell implementation
857
858
859 # func_arith arithmetic-term...
860 func_arith ()
861 {
862 func_arith_result=`expr "${@}"`
863 } # func_arith may be replaced by extended shell implementation
864
865
866 # func_len string
867 # STRING may not start with a hyphen.
868 func_len ()
869 {
870 func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
871 } # func_len may be replaced by extended shell implementation
872
873
874 # func_lo2o object
875 func_lo2o ()
876 {
877 func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
878 } # func_lo2o may be replaced by extended shell implementation
879
880
881 # func_xform libobj-or-source
882 func_xform ()
883 {
884 func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
885 } # func_xform may be replaced by extended shell implementation
886
887
888 # func_fatal_configuration arg...
2122889 # Echo program name prefixed message to standard error, followed by
2123890 # a configuration failure hint, and exit.
2124891 func_fatal_configuration ()
2125892 {
2126 func__fatal_error ${1+"$@"} \
2127 "See the $PACKAGE documentation for more information." \
2128 "Fatal configuration error."
893 func_error ${1+"$@"}
894 func_error "See the $PACKAGE documentation for more information."
895 func_fatal_error "Fatal configuration error."
2129896 }
2130897
2131898
2132899 # func_config
2133 # -----------
2134900 # Display the configuration for all the tags in this script.
2135901 func_config ()
2136902 {
2148914 exit $?
2149915 }
2150916
2151
2152917 # func_features
2153 # -------------
2154918 # Display the features supported by this script.
2155919 func_features ()
2156920 {
2157921 echo "host: $host"
2158 if test yes = "$build_libtool_libs"; then
922 if test "$build_libtool_libs" = yes; then
2159923 echo "enable shared libraries"
2160924 else
2161925 echo "disable shared libraries"
2162926 fi
2163 if test yes = "$build_old_libs"; then
927 if test "$build_old_libs" = yes; then
2164928 echo "enable static libraries"
2165929 else
2166930 echo "disable static libraries"
2169933 exit $?
2170934 }
2171935
2172
2173 # func_enable_tag TAGNAME
2174 # -----------------------
936 # func_enable_tag tagname
2175937 # Verify that TAGNAME is valid, and either flag an error and exit, or
2176938 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2177939 # variable here.
2178940 func_enable_tag ()
2179941 {
2180 # Global variable:
2181 tagname=$1
2182
2183 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2184 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2185 sed_extractcf=/$re_begincf/,/$re_endcf/p
2186
2187 # Validate tagname.
2188 case $tagname in
2189 *[!-_A-Za-z0-9,/]*)
2190 func_fatal_error "invalid tag name: $tagname"
2191 ;;
2192 esac
2193
2194 # Don't test for the "default" C tag, as we know it's
2195 # there but not specially marked.
2196 case $tagname in
2197 CC) ;;
942 # Global variable:
943 tagname="$1"
944
945 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
946 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
947 sed_extractcf="/$re_begincf/,/$re_endcf/p"
948
949 # Validate tagname.
950 case $tagname in
951 *[!-_A-Za-z0-9,/]*)
952 func_fatal_error "invalid tag name: $tagname"
953 ;;
954 esac
955
956 # Don't test for the "default" C tag, as we know it's
957 # there but not specially marked.
958 case $tagname in
959 CC) ;;
2198960 *)
2199 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2200 taglist="$taglist $tagname"
2201
2202 # Evaluate the configuration. Be careful to quote the path
2203 # and the sed script, to avoid splitting on whitespace, but
2204 # also don't use non-portable quotes within backquotes within
2205 # quotes we have to do it in 2 steps:
2206 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2207 eval "$extractedcf"
2208 else
2209 func_error "ignoring unknown tag $tagname"
2210 fi
2211 ;;
2212 esac
2213 }
2214
961 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
962 taglist="$taglist $tagname"
963
964 # Evaluate the configuration. Be careful to quote the path
965 # and the sed script, to avoid splitting on whitespace, but
966 # also don't use non-portable quotes within backquotes within
967 # quotes we have to do it in 2 steps:
968 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
969 eval "$extractedcf"
970 else
971 func_error "ignoring unknown tag $tagname"
972 fi
973 ;;
974 esac
975 }
2215976
2216977 # func_check_version_match
2217 # ------------------------
2218978 # Ensure that we are using m4 macros, and libtool script from the same
2219979 # release of libtool.
2220980 func_check_version_match ()
2221981 {
2222 if test "$package_revision" != "$macro_revision"; then
2223 if test "$VERSION" != "$macro_version"; then
2224 if test -z "$macro_version"; then
2225 cat >&2 <<_LT_EOF
982 if test "$package_revision" != "$macro_revision"; then
983 if test "$VERSION" != "$macro_version"; then
984 if test -z "$macro_version"; then
985 cat >&2 <<_LT_EOF
2226986 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2227987 $progname: definition of this LT_INIT comes from an older release.
2228988 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2229989 $progname: and run autoconf again.
2230990 _LT_EOF
2231 else
2232 cat >&2 <<_LT_EOF
991 else
992 cat >&2 <<_LT_EOF
2233993 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2234994 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2235995 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2236996 $progname: and run autoconf again.
2237997 _LT_EOF
2238 fi
2239 else
2240 cat >&2 <<_LT_EOF
998 fi
999 else
1000 cat >&2 <<_LT_EOF
22411001 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
22421002 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
22431003 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
22441004 $progname: of $PACKAGE $VERSION and run autoconf again.
22451005 _LT_EOF
2246 fi
2247
2248 exit $EXIT_MISMATCH
22491006 fi
2250 }
2251
2252
2253 # libtool_options_prep [ARG]...
2254 # -----------------------------
2255 # Preparation for options parsed by libtool.
2256 libtool_options_prep ()
2257 {
2258 $debug_mode
2259
2260 # Option defaults:
2261 opt_config=false
2262 opt_dlopen=
2263 opt_dry_run=false
2264 opt_help=false
2265 opt_mode=
2266 opt_preserve_dup_deps=false
2267 opt_quiet=false
2268
2269 nonopt=
2270 preserve_args=
2271
2272 # Shorthand for --mode=foo, only valid as the first argument
2273 case $1 in
2274 clean|clea|cle|cl)
2275 shift; set dummy --mode clean ${1+"$@"}; shift
1007
1008 exit $EXIT_MISMATCH
1009 fi
1010 }
1011
1012
1013 # Shorthand for --mode=foo, only valid as the first argument
1014 case $1 in
1015 clean|clea|cle|cl)
1016 shift; set dummy --mode clean ${1+"$@"}; shift
1017 ;;
1018 compile|compil|compi|comp|com|co|c)
1019 shift; set dummy --mode compile ${1+"$@"}; shift
1020 ;;
1021 execute|execut|execu|exec|exe|ex|e)
1022 shift; set dummy --mode execute ${1+"$@"}; shift
1023 ;;
1024 finish|finis|fini|fin|fi|f)
1025 shift; set dummy --mode finish ${1+"$@"}; shift
1026 ;;
1027 install|instal|insta|inst|ins|in|i)
1028 shift; set dummy --mode install ${1+"$@"}; shift
1029 ;;
1030 link|lin|li|l)
1031 shift; set dummy --mode link ${1+"$@"}; shift
1032 ;;
1033 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
1034 shift; set dummy --mode uninstall ${1+"$@"}; shift
1035 ;;
1036 esac
1037
1038
1039
1040 # Option defaults:
1041 opt_debug=:
1042 opt_dry_run=false
1043 opt_config=false
1044 opt_preserve_dup_deps=false
1045 opt_features=false
1046 opt_finish=false
1047 opt_help=false
1048 opt_help_all=false
1049 opt_silent=:
1050 opt_warning=:
1051 opt_verbose=:
1052 opt_silent=false
1053 opt_verbose=false
1054
1055
1056 # Parse options once, thoroughly. This comes as soon as possible in the
1057 # script to make things like `--version' happen as quickly as we can.
1058 {
1059 # this just eases exit handling
1060 while test $# -gt 0; do
1061 opt="$1"
1062 shift
1063 case $opt in
1064 --debug|-x) opt_debug='set -x'
1065 func_echo "enabling shell trace mode"
1066 $opt_debug
1067 ;;
1068 --dry-run|--dryrun|-n)
1069 opt_dry_run=:
1070 ;;
1071 --config)
1072 opt_config=:
1073 func_config
1074 ;;
1075 --dlopen|-dlopen)
1076 optarg="$1"
1077 opt_dlopen="${opt_dlopen+$opt_dlopen
1078 }$optarg"
1079 shift
1080 ;;
1081 --preserve-dup-deps)
1082 opt_preserve_dup_deps=:
1083 ;;
1084 --features)
1085 opt_features=:
1086 func_features
1087 ;;
1088 --finish)
1089 opt_finish=:
1090 set dummy --mode finish ${1+"$@"}; shift
1091 ;;
1092 --help)
1093 opt_help=:
1094 ;;
1095 --help-all)
1096 opt_help_all=:
1097 opt_help=': help-all'
1098 ;;
1099 --mode)
1100 test $# = 0 && func_missing_arg $opt && break
1101 optarg="$1"
1102 opt_mode="$optarg"
1103 case $optarg in
1104 # Valid mode arguments:
1105 clean|compile|execute|finish|install|link|relink|uninstall) ;;
1106
1107 # Catch anything else as an error
1108 *) func_error "invalid argument for $opt"
1109 exit_cmd=exit
1110 break
1111 ;;
1112 esac
1113 shift
1114 ;;
1115 --no-silent|--no-quiet)
1116 opt_silent=false
1117 func_append preserve_args " $opt"
1118 ;;
1119 --no-warning|--no-warn)
1120 opt_warning=false
1121 func_append preserve_args " $opt"
1122 ;;
1123 --no-verbose)
1124 opt_verbose=false
1125 func_append preserve_args " $opt"
1126 ;;
1127 --silent|--quiet)
1128 opt_silent=:
1129 func_append preserve_args " $opt"
1130 opt_verbose=false
1131 ;;
1132 --verbose|-v)
1133 opt_verbose=:
1134 func_append preserve_args " $opt"
1135 opt_silent=false
1136 ;;
1137 --tag)
1138 test $# = 0 && func_missing_arg $opt && break
1139 optarg="$1"
1140 opt_tag="$optarg"
1141 func_append preserve_args " $opt $optarg"
1142 func_enable_tag "$optarg"
1143 shift
1144 ;;
1145
1146 -\?|-h) func_usage ;;
1147 --help) func_help ;;
1148 --version) func_version ;;
1149
1150 # Separate optargs to long options:
1151 --*=*)
1152 func_split_long_opt "$opt"
1153 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1154 shift
1155 ;;
1156
1157 # Separate non-argument short options:
1158 -\?*|-h*|-n*|-v*)
1159 func_split_short_opt "$opt"
1160 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1161 shift
1162 ;;
1163
1164 --) break ;;
1165 -*) func_fatal_help "unrecognized option \`$opt'" ;;
1166 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
1167 esac
1168 done
1169
1170 # Validate options:
1171
1172 # save first non-option argument
1173 if test "$#" -gt 0; then
1174 nonopt="$opt"
1175 shift
1176 fi
1177
1178 # preserve --debug
1179 test "$opt_debug" = : || func_append preserve_args " --debug"
1180
1181 case $host in
1182 *cygwin* | *mingw* | *pw32* | *cegcc*)
1183 # don't eliminate duplications in $postdeps and $predeps
1184 opt_duplicate_compiler_generated_deps=:
22761185 ;;
2277 compile|compil|compi|comp|com|co|c)
2278 shift; set dummy --mode compile ${1+"$@"}; shift
1186 *)
1187 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
22791188 ;;
2280 execute|execut|execu|exec|exe|ex|e)
2281 shift; set dummy --mode execute ${1+"$@"}; shift
2282 ;;
2283 finish|finis|fini|fin|fi|f)
2284 shift; set dummy --mode finish ${1+"$@"}; shift
2285 ;;
2286 install|instal|insta|inst|ins|in|i)
2287 shift; set dummy --mode install ${1+"$@"}; shift
2288 ;;
2289 link|lin|li|l)
2290 shift; set dummy --mode link ${1+"$@"}; shift
2291 ;;
2292 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2293 shift; set dummy --mode uninstall ${1+"$@"}; shift
2294 ;;
2295 esac
2296
2297 # Pass back the list of options.
2298 func_quote_for_eval ${1+"$@"}
2299 libtool_options_prep_result=$func_quote_for_eval_result
2300 }
2301 func_add_hook func_options_prep libtool_options_prep
2302
2303
2304 # libtool_parse_options [ARG]...
2305 # ---------------------------------
2306 # Provide handling for libtool specific options.
2307 libtool_parse_options ()
2308 {
2309 $debug_cmd
2310
2311 # Perform our own loop to consume as many options as possible in
2312 # each iteration.
2313 while test $# -gt 0; do
2314 _G_opt=$1
2315 shift
2316 case $_G_opt in
2317 --dry-run|--dryrun|-n)
2318 opt_dry_run=:
2319 ;;
2320
2321 --config) func_config ;;
2322
2323 --dlopen|-dlopen)
2324 opt_dlopen="${opt_dlopen+$opt_dlopen
2325 }$1"
2326 shift
2327 ;;
2328
2329 --preserve-dup-deps)
2330 opt_preserve_dup_deps=: ;;
2331
2332 --features) func_features ;;
2333
2334 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2335
2336 --help) opt_help=: ;;
2337
2338 --help-all) opt_help=': help-all' ;;
2339
2340 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2341 opt_mode=$1
2342 case $1 in
2343 # Valid mode arguments:
2344 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2345
2346 # Catch anything else as an error
2347 *) func_error "invalid argument for $_G_opt"
2348 exit_cmd=exit
2349 break
2350 ;;
2351 esac
2352 shift
2353 ;;
2354
2355 --no-silent|--no-quiet)
2356 opt_quiet=false
2357 func_append preserve_args " $_G_opt"
2358 ;;
2359
2360 --no-warnings|--no-warning|--no-warn)
2361 opt_warning=false
2362 func_append preserve_args " $_G_opt"
2363 ;;
2364
2365 --no-verbose)
2366 opt_verbose=false
2367 func_append preserve_args " $_G_opt"
2368 ;;
2369
2370 --silent|--quiet)
2371 opt_quiet=:
2372 opt_verbose=false
2373 func_append preserve_args " $_G_opt"
2374 ;;
2375
2376 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2377 opt_tag=$1
2378 func_append preserve_args " $_G_opt $1"
2379 func_enable_tag "$1"
2380 shift
2381 ;;
2382
2383 --verbose|-v) opt_quiet=false
2384 opt_verbose=:
2385 func_append preserve_args " $_G_opt"
2386 ;;
2387
2388 # An option not handled by this hook function:
2389 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2390 esac
2391 done
2392
2393
2394 # save modified positional parameters for caller
2395 func_quote_for_eval ${1+"$@"}
2396 libtool_parse_options_result=$func_quote_for_eval_result
2397 }
2398 func_add_hook func_parse_options libtool_parse_options
2399
2400
2401
2402 # libtool_validate_options [ARG]...
2403 # ---------------------------------
2404 # Perform any sanity checks on option settings and/or unconsumed
2405 # arguments.
2406 libtool_validate_options ()
2407 {
2408 # save first non-option argument
2409 if test 0 -lt $#; then
2410 nonopt=$1
2411 shift
1189 esac
1190
1191 $opt_help || {
1192 # Sanity checks first:
1193 func_check_version_match
1194
1195 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1196 func_fatal_configuration "not configured to build any kind of library"
24121197 fi
24131198
2414 # preserve --debug
2415 test : = "$debug_cmd" || func_append preserve_args " --debug"
2416
2417 case $host in
2418 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2419 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2420 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2421 # don't eliminate duplications in $postdeps and $predeps
2422 opt_duplicate_compiler_generated_deps=:
2423 ;;
2424 *)
2425 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2426 ;;
2427 esac
2428
2429 $opt_help || {
2430 # Sanity checks first:
2431 func_check_version_match
2432
2433 test yes != "$build_libtool_libs" \
2434 && test yes != "$build_old_libs" \
2435 && func_fatal_configuration "not configured to build any kind of library"
2436
2437 # Darwin sucks
2438 eval std_shrext=\"$shrext_cmds\"
2439
2440 # Only execute mode is allowed to have -dlopen flags.
2441 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2442 func_error "unrecognized option '-dlopen'"
2443 $ECHO "$help" 1>&2
2444 exit $EXIT_FAILURE
2445 fi
2446
2447 # Change the help message to a mode-specific one.
2448 generic_help=$help
2449 help="Try '$progname --help --mode=$opt_mode' for more information."
2450 }
2451
2452 # Pass back the unparsed argument list
2453 func_quote_for_eval ${1+"$@"}
2454 libtool_validate_options_result=$func_quote_for_eval_result
2455 }
2456 func_add_hook func_validate_options libtool_validate_options
2457
2458
2459 # Process options as early as possible so that --help and --version
2460 # can return quickly.
2461 func_options ${1+"$@"}
2462 eval set dummy "$func_options_result"; shift
1199 # Darwin sucks
1200 eval std_shrext=\"$shrext_cmds\"
1201
1202 # Only execute mode is allowed to have -dlopen flags.
1203 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
1204 func_error "unrecognized option \`-dlopen'"
1205 $ECHO "$help" 1>&2
1206 exit $EXIT_FAILURE
1207 fi
1208
1209 # Change the help message to a mode-specific one.
1210 generic_help="$help"
1211 help="Try \`$progname --help --mode=$opt_mode' for more information."
1212 }
1213
1214
1215 # Bail if the options were screwed
1216 $exit_cmd $EXIT_FAILURE
1217 }
1218
24631219
24641220
24651221
24671223 ## Main. ##
24681224 ## ----------- ##
24691225
2470 magic='%%%MAGIC variable%%%'
2471 magic_exe='%%%MAGIC EXE variable%%%'
2472
2473 # Global variables.
2474 extracted_archives=
2475 extracted_serial=0
2476
2477 # If this variable is set in any of the actions, the command in it
2478 # will be execed at the end. This prevents here-documents from being
2479 # left over by shells.
2480 exec_cmd=
2481
2482
2483 # A function that is used when there is no print builtin or printf.
2484 func_fallback_echo ()
2485 {
2486 eval 'cat <<_LTECHO_EOF
2487 $1
2488 _LTECHO_EOF'
2489 }
2490
2491 # func_generated_by_libtool
2492 # True iff stdin has been generated by Libtool. This function is only
2493 # a basic sanity check; it will hardly flush out determined imposters.
2494 func_generated_by_libtool_p ()
2495 {
2496 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2497 }
2498
24991226 # func_lalib_p file
2500 # True iff FILE is a libtool '.la' library or '.lo' object file.
1227 # True iff FILE is a libtool `.la' library or `.lo' object file.
25011228 # This function is only a basic sanity check; it will hardly flush out
25021229 # determined imposters.
25031230 func_lalib_p ()
25041231 {
25051232 test -f "$1" &&
2506 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
1233 $SED -e 4q "$1" 2>/dev/null \
1234 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
25071235 }
25081236
25091237 # func_lalib_unsafe_p file
2510 # True iff FILE is a libtool '.la' library or '.lo' object file.
1238 # True iff FILE is a libtool `.la' library or `.lo' object file.
25111239 # This function implements the same check as func_lalib_p without
25121240 # resorting to external programs. To this end, it redirects stdin and
25131241 # closes it afterwards, without saving the original file descriptor.
25141242 # As a safety measure, use it only where a negative result would be
2515 # fatal anyway. Works if 'file' does not exist.
1243 # fatal anyway. Works if `file' does not exist.
25161244 func_lalib_unsafe_p ()
25171245 {
25181246 lalib_p=no
25201248 for lalib_p_l in 1 2 3 4
25211249 do
25221250 read lalib_p_line
2523 case $lalib_p_line in
1251 case "$lalib_p_line" in
25241252 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
25251253 esac
25261254 done
25271255 exec 0<&5 5<&-
25281256 fi
2529 test yes = "$lalib_p"
1257 test "$lalib_p" = yes
25301258 }
25311259
25321260 # func_ltwrapper_script_p file
25351263 # determined imposters.
25361264 func_ltwrapper_script_p ()
25371265 {
2538 test -f "$1" &&
2539 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
1266 func_lalib_p "$1"
25401267 }
25411268
25421269 # func_ltwrapper_executable_p file
25611288 {
25621289 func_dirname_and_basename "$1" "" "."
25631290 func_stripname '' '.exe' "$func_basename_result"
2564 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
1291 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
25651292 }
25661293
25671294 # func_ltwrapper_p file
25801307 # FAIL_CMD may read-access the current command in variable CMD!
25811308 func_execute_cmds ()
25821309 {
2583 $debug_cmd
2584
1310 $opt_debug
25851311 save_ifs=$IFS; IFS='~'
25861312 for cmd in $1; do
2587 IFS=$sp$nl
1313 IFS=$save_ifs
25881314 eval cmd=\"$cmd\"
2589 IFS=$save_ifs
25901315 func_show_eval "$cmd" "${2-:}"
25911316 done
25921317 IFS=$save_ifs
25981323 # Note that it is not necessary on cygwin/mingw to append a dot to
25991324 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
26001325 # behavior happens only for exec(3), not for open(2)! Also, sourcing
2601 # 'FILE.' does not work on cygwin managed mounts.
1326 # `FILE.' does not work on cygwin managed mounts.
26021327 func_source ()
26031328 {
2604 $debug_cmd
2605
1329 $opt_debug
26061330 case $1 in
26071331 */* | *\\*) . "$1" ;;
26081332 *) . "./$1" ;;
26291353 # store the result into func_replace_sysroot_result.
26301354 func_replace_sysroot ()
26311355 {
2632 case $lt_sysroot:$1 in
1356 case "$lt_sysroot:$1" in
26331357 ?*:"$lt_sysroot"*)
26341358 func_stripname "$lt_sysroot" '' "$1"
2635 func_replace_sysroot_result='='$func_stripname_result
1359 func_replace_sysroot_result="=$func_stripname_result"
26361360 ;;
26371361 *)
26381362 # Including no sysroot.
26491373 # arg is usually of the form 'gcc ...'
26501374 func_infer_tag ()
26511375 {
2652 $debug_cmd
2653
1376 $opt_debug
26541377 if test -n "$available_tags" && test -z "$tagname"; then
26551378 CC_quoted=
26561379 for arg in $CC; do
26691392 for z in $available_tags; do
26701393 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
26711394 # Evaluate the configuration.
2672 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1395 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
26731396 CC_quoted=
26741397 for arg in $CC; do
26751398 # Double-quote args containing other shell metacharacters.
26941417 # line option must be used.
26951418 if test -z "$tagname"; then
26961419 func_echo "unable to infer tagged configuration"
2697 func_fatal_error "specify a tag with '--tag'"
1420 func_fatal_error "specify a tag with \`--tag'"
26981421 # else
26991422 # func_verbose "using $tagname tagged configuration"
27001423 fi
27101433 # but don't create it if we're doing a dry run.
27111434 func_write_libtool_object ()
27121435 {
2713 write_libobj=$1
2714 if test yes = "$build_libtool_libs"; then
2715 write_lobj=\'$2\'
1436 write_libobj=${1}
1437 if test "$build_libtool_libs" = yes; then
1438 write_lobj=\'${2}\'
27161439 else
27171440 write_lobj=none
27181441 fi
27191442
2720 if test yes = "$build_old_libs"; then
2721 write_oldobj=\'$3\'
1443 if test "$build_old_libs" = yes; then
1444 write_oldobj=\'${3}\'
27221445 else
27231446 write_oldobj=none
27241447 fi
27261449 $opt_dry_run || {
27271450 cat >${write_libobj}T <<EOF
27281451 # $write_libobj - a libtool object file
2729 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
1452 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
27301453 #
27311454 # Please DO NOT delete this file!
27321455 # It is necessary for linking the library.
27381461 non_pic_object=$write_oldobj
27391462
27401463 EOF
2741 $MV "${write_libobj}T" "$write_libobj"
1464 $MV "${write_libobj}T" "${write_libobj}"
27421465 }
27431466 }
27441467
27581481 # be empty on error (or when ARG is empty)
27591482 func_convert_core_file_wine_to_w32 ()
27601483 {
2761 $debug_cmd
2762
2763 func_convert_core_file_wine_to_w32_result=$1
1484 $opt_debug
1485 func_convert_core_file_wine_to_w32_result="$1"
27641486 if test -n "$1"; then
27651487 # Unfortunately, winepath does not exit with a non-zero error code, so we
27661488 # are forced to check the contents of stdout. On the other hand, if the
27681490 # *an error message* to stdout. So we must check for both error code of
27691491 # zero AND non-empty stdout, which explains the odd construction:
27701492 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2771 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
1493 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
27721494 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2773 $SED -e "$sed_naive_backslashify"`
1495 $SED -e "$lt_sed_naive_backslashify"`
27741496 else
27751497 func_convert_core_file_wine_to_w32_result=
27761498 fi
27911513 # are convertible, then the result may be empty.
27921514 func_convert_core_path_wine_to_w32 ()
27931515 {
2794 $debug_cmd
2795
1516 $opt_debug
27961517 # unfortunately, winepath doesn't convert paths, only file names
2797 func_convert_core_path_wine_to_w32_result=
1518 func_convert_core_path_wine_to_w32_result=""
27981519 if test -n "$1"; then
27991520 oldIFS=$IFS
28001521 IFS=:
28011522 for func_convert_core_path_wine_to_w32_f in $1; do
28021523 IFS=$oldIFS
28031524 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
2804 if test -n "$func_convert_core_file_wine_to_w32_result"; then
1525 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
28051526 if test -z "$func_convert_core_path_wine_to_w32_result"; then
2806 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
1527 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
28071528 else
28081529 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
28091530 fi
28321553 # environment variable; do not put it in $PATH.
28331554 func_cygpath ()
28341555 {
2835 $debug_cmd
2836
1556 $opt_debug
28371557 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
28381558 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
28391559 if test "$?" -ne 0; then
28421562 fi
28431563 else
28441564 func_cygpath_result=
2845 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
1565 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
28461566 fi
28471567 }
28481568 #end: func_cygpath
28531573 # result in func_convert_core_msys_to_w32_result.
28541574 func_convert_core_msys_to_w32 ()
28551575 {
2856 $debug_cmd
2857
1576 $opt_debug
28581577 # awkward: cmd appends spaces to result
28591578 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2860 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
1579 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
28611580 }
28621581 #end: func_convert_core_msys_to_w32
28631582
28681587 # func_to_host_file_result to ARG1).
28691588 func_convert_file_check ()
28701589 {
2871 $debug_cmd
2872
2873 if test -z "$2" && test -n "$1"; then
1590 $opt_debug
1591 if test -z "$2" && test -n "$1" ; then
28741592 func_error "Could not determine host file name corresponding to"
2875 func_error " '$1'"
1593 func_error " \`$1'"
28761594 func_error "Continuing, but uninstalled executables may not work."
28771595 # Fallback:
2878 func_to_host_file_result=$1
1596 func_to_host_file_result="$1"
28791597 fi
28801598 }
28811599 # end func_convert_file_check
28871605 # func_to_host_file_result to a simplistic fallback value (see below).
28881606 func_convert_path_check ()
28891607 {
2890 $debug_cmd
2891
1608 $opt_debug
28921609 if test -z "$4" && test -n "$3"; then
28931610 func_error "Could not determine the host path corresponding to"
2894 func_error " '$3'"
1611 func_error " \`$3'"
28951612 func_error "Continuing, but uninstalled executables may not work."
28961613 # Fallback. This is a deliberately simplistic "conversion" and
28971614 # should not be "improved". See libtool.info.
29001617 func_to_host_path_result=`echo "$3" |
29011618 $SED -e "$lt_replace_pathsep_chars"`
29021619 else
2903 func_to_host_path_result=$3
1620 func_to_host_path_result="$3"
29041621 fi
29051622 fi
29061623 }
29121629 # and appending REPL if ORIG matches BACKPAT.
29131630 func_convert_path_front_back_pathsep ()
29141631 {
2915 $debug_cmd
2916
1632 $opt_debug
29171633 case $4 in
2918 $1 ) func_to_host_path_result=$3$func_to_host_path_result
1634 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
29191635 ;;
29201636 esac
29211637 case $4 in
29291645 ##################################################
29301646 # $build to $host FILE NAME CONVERSION FUNCTIONS #
29311647 ##################################################
2932 # invoked via '$to_host_file_cmd ARG'
1648 # invoked via `$to_host_file_cmd ARG'
29331649 #
29341650 # In each case, ARG is the path to be converted from $build to $host format.
29351651 # Result will be available in $func_to_host_file_result.
29401656 # in func_to_host_file_result.
29411657 func_to_host_file ()
29421658 {
2943 $debug_cmd
2944
1659 $opt_debug
29451660 $to_host_file_cmd "$1"
29461661 }
29471662 # end func_to_host_file
29531668 # in (the comma separated) LAZY, no conversion takes place.
29541669 func_to_tool_file ()
29551670 {
2956 $debug_cmd
2957
1671 $opt_debug
29581672 case ,$2, in
29591673 *,"$to_tool_file_cmd",*)
29601674 func_to_tool_file_result=$1
29721686 # Copy ARG to func_to_host_file_result.
29731687 func_convert_file_noop ()
29741688 {
2975 func_to_host_file_result=$1
1689 func_to_host_file_result="$1"
29761690 }
29771691 # end func_convert_file_noop
29781692
29831697 # func_to_host_file_result.
29841698 func_convert_file_msys_to_w32 ()
29851699 {
2986 $debug_cmd
2987
2988 func_to_host_file_result=$1
1700 $opt_debug
1701 func_to_host_file_result="$1"
29891702 if test -n "$1"; then
29901703 func_convert_core_msys_to_w32 "$1"
2991 func_to_host_file_result=$func_convert_core_msys_to_w32_result
1704 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
29921705 fi
29931706 func_convert_file_check "$1" "$func_to_host_file_result"
29941707 }
30001713 # func_to_host_file_result.
30011714 func_convert_file_cygwin_to_w32 ()
30021715 {
3003 $debug_cmd
3004
3005 func_to_host_file_result=$1
1716 $opt_debug
1717 func_to_host_file_result="$1"
30061718 if test -n "$1"; then
30071719 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
30081720 # LT_CYGPATH in this case.
30181730 # and a working winepath. Returns result in func_to_host_file_result.
30191731 func_convert_file_nix_to_w32 ()
30201732 {
3021 $debug_cmd
3022
3023 func_to_host_file_result=$1
1733 $opt_debug
1734 func_to_host_file_result="$1"
30241735 if test -n "$1"; then
30251736 func_convert_core_file_wine_to_w32 "$1"
3026 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
1737 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
30271738 fi
30281739 func_convert_file_check "$1" "$func_to_host_file_result"
30291740 }
30351746 # Returns result in func_to_host_file_result.
30361747 func_convert_file_msys_to_cygwin ()
30371748 {
3038 $debug_cmd
3039
3040 func_to_host_file_result=$1
1749 $opt_debug
1750 func_to_host_file_result="$1"
30411751 if test -n "$1"; then
30421752 func_convert_core_msys_to_w32 "$1"
30431753 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3044 func_to_host_file_result=$func_cygpath_result
1754 func_to_host_file_result="$func_cygpath_result"
30451755 fi
30461756 func_convert_file_check "$1" "$func_to_host_file_result"
30471757 }
30541764 # in func_to_host_file_result.
30551765 func_convert_file_nix_to_cygwin ()
30561766 {
3057 $debug_cmd
3058
3059 func_to_host_file_result=$1
1767 $opt_debug
1768 func_to_host_file_result="$1"
30601769 if test -n "$1"; then
30611770 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
30621771 func_convert_core_file_wine_to_w32 "$1"
30631772 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3064 func_to_host_file_result=$func_cygpath_result
1773 func_to_host_file_result="$func_cygpath_result"
30651774 fi
30661775 func_convert_file_check "$1" "$func_to_host_file_result"
30671776 }
30711780 #############################################
30721781 # $build to $host PATH CONVERSION FUNCTIONS #
30731782 #############################################
3074 # invoked via '$to_host_path_cmd ARG'
1783 # invoked via `$to_host_path_cmd ARG'
30751784 #
30761785 # In each case, ARG is the path to be converted from $build to $host format.
30771786 # The result will be available in $func_to_host_path_result.
30951804 to_host_path_cmd=
30961805 func_init_to_host_path_cmd ()
30971806 {
3098 $debug_cmd
3099
1807 $opt_debug
31001808 if test -z "$to_host_path_cmd"; then
31011809 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3102 to_host_path_cmd=func_convert_path_$func_stripname_result
1810 to_host_path_cmd="func_convert_path_${func_stripname_result}"
31031811 fi
31041812 }
31051813
31091817 # in func_to_host_path_result.
31101818 func_to_host_path ()
31111819 {
3112 $debug_cmd
3113
1820 $opt_debug
31141821 func_init_to_host_path_cmd
31151822 $to_host_path_cmd "$1"
31161823 }
31211828 # Copy ARG to func_to_host_path_result.
31221829 func_convert_path_noop ()
31231830 {
3124 func_to_host_path_result=$1
1831 func_to_host_path_result="$1"
31251832 }
31261833 # end func_convert_path_noop
31271834
31321839 # func_to_host_path_result.
31331840 func_convert_path_msys_to_w32 ()
31341841 {
3135 $debug_cmd
3136
3137 func_to_host_path_result=$1
1842 $opt_debug
1843 func_to_host_path_result="$1"
31381844 if test -n "$1"; then
31391845 # Remove leading and trailing path separator characters from ARG. MSYS
31401846 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
31421848 func_stripname : : "$1"
31431849 func_to_host_path_tmp1=$func_stripname_result
31441850 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3145 func_to_host_path_result=$func_convert_core_msys_to_w32_result
1851 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
31461852 func_convert_path_check : ";" \
31471853 "$func_to_host_path_tmp1" "$func_to_host_path_result"
31481854 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
31561862 # func_to_host_file_result.
31571863 func_convert_path_cygwin_to_w32 ()
31581864 {
3159 $debug_cmd
3160
3161 func_to_host_path_result=$1
1865 $opt_debug
1866 func_to_host_path_result="$1"
31621867 if test -n "$1"; then
31631868 # See func_convert_path_msys_to_w32:
31641869 func_stripname : : "$1"
31771882 # a working winepath. Returns result in func_to_host_file_result.
31781883 func_convert_path_nix_to_w32 ()
31791884 {
3180 $debug_cmd
3181
3182 func_to_host_path_result=$1
1885 $opt_debug
1886 func_to_host_path_result="$1"
31831887 if test -n "$1"; then
31841888 # See func_convert_path_msys_to_w32:
31851889 func_stripname : : "$1"
31861890 func_to_host_path_tmp1=$func_stripname_result
31871891 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3188 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
1892 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
31891893 func_convert_path_check : ";" \
31901894 "$func_to_host_path_tmp1" "$func_to_host_path_result"
31911895 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
31991903 # Returns result in func_to_host_file_result.
32001904 func_convert_path_msys_to_cygwin ()
32011905 {
3202 $debug_cmd
3203
3204 func_to_host_path_result=$1
1906 $opt_debug
1907 func_to_host_path_result="$1"
32051908 if test -n "$1"; then
32061909 # See func_convert_path_msys_to_w32:
32071910 func_stripname : : "$1"
32081911 func_to_host_path_tmp1=$func_stripname_result
32091912 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
32101913 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3211 func_to_host_path_result=$func_cygpath_result
1914 func_to_host_path_result="$func_cygpath_result"
32121915 func_convert_path_check : : \
32131916 "$func_to_host_path_tmp1" "$func_to_host_path_result"
32141917 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
32231926 # func_to_host_file_result.
32241927 func_convert_path_nix_to_cygwin ()
32251928 {
3226 $debug_cmd
3227
3228 func_to_host_path_result=$1
1929 $opt_debug
1930 func_to_host_path_result="$1"
32291931 if test -n "$1"; then
32301932 # Remove leading and trailing path separator characters from
32311933 # ARG. msys behavior is inconsistent here, cygpath turns them
32341936 func_to_host_path_tmp1=$func_stripname_result
32351937 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
32361938 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3237 func_to_host_path_result=$func_cygpath_result
1939 func_to_host_path_result="$func_cygpath_result"
32381940 func_convert_path_check : : \
32391941 "$func_to_host_path_tmp1" "$func_to_host_path_result"
32401942 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
32431945 # end func_convert_path_nix_to_cygwin
32441946
32451947
3246 # func_dll_def_p FILE
3247 # True iff FILE is a Windows DLL '.def' file.
3248 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3249 func_dll_def_p ()
3250 {
3251 $debug_cmd
3252
3253 func_dll_def_p_tmp=`$SED -n \
3254 -e 's/^[ ]*//' \
3255 -e '/^\(;.*\)*$/d' \
3256 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3257 -e q \
3258 "$1"`
3259 test DEF = "$func_dll_def_p_tmp"
3260 }
3261
3262
32631948 # func_mode_compile arg...
32641949 func_mode_compile ()
32651950 {
3266 $debug_cmd
3267
1951 $opt_debug
32681952 # Get the compilation command and the source file.
32691953 base_compile=
3270 srcfile=$nonopt # always keep a non-empty value in "srcfile"
1954 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
32711955 suppress_opt=yes
32721956 suppress_output=
32731957 arg_mode=normal
32801964 case $arg_mode in
32811965 arg )
32821966 # do not "continue". Instead, add this to base_compile
3283 lastarg=$arg
1967 lastarg="$arg"
32841968 arg_mode=normal
32851969 ;;
32861970
32871971 target )
3288 libobj=$arg
1972 libobj="$arg"
32891973 arg_mode=normal
32901974 continue
32911975 ;;
32951979 case $arg in
32961980 -o)
32971981 test -n "$libobj" && \
3298 func_fatal_error "you cannot specify '-o' more than once"
1982 func_fatal_error "you cannot specify \`-o' more than once"
32991983 arg_mode=target
33001984 continue
33011985 ;;
33242008 func_stripname '-Wc,' '' "$arg"
33252009 args=$func_stripname_result
33262010 lastarg=
3327 save_ifs=$IFS; IFS=,
2011 save_ifs="$IFS"; IFS=','
33282012 for arg in $args; do
3329 IFS=$save_ifs
2013 IFS="$save_ifs"
33302014 func_append_quoted lastarg "$arg"
33312015 done
3332 IFS=$save_ifs
2016 IFS="$save_ifs"
33332017 func_stripname ' ' '' "$lastarg"
33342018 lastarg=$func_stripname_result
33352019
33422026 # Accept the current argument as the source file.
33432027 # The previous "srcfile" becomes the current argument.
33442028 #
3345 lastarg=$srcfile
3346 srcfile=$arg
2029 lastarg="$srcfile"
2030 srcfile="$arg"
33472031 ;;
33482032 esac # case $arg
33492033 ;;
33582042 func_fatal_error "you must specify an argument for -Xcompile"
33592043 ;;
33602044 target)
3361 func_fatal_error "you must specify a target with '-o'"
2045 func_fatal_error "you must specify a target with \`-o'"
33622046 ;;
33632047 *)
33642048 # Get the name of the library object.
33652049 test -z "$libobj" && {
33662050 func_basename "$srcfile"
3367 libobj=$func_basename_result
2051 libobj="$func_basename_result"
33682052 }
33692053 ;;
33702054 esac
33842068 case $libobj in
33852069 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
33862070 *)
3387 func_fatal_error "cannot determine name of library object from '$libobj'"
2071 func_fatal_error "cannot determine name of library object from \`$libobj'"
33882072 ;;
33892073 esac
33902074
33932077 for arg in $later; do
33942078 case $arg in
33952079 -shared)
3396 test yes = "$build_libtool_libs" \
3397 || func_fatal_configuration "cannot build a shared library"
2080 test "$build_libtool_libs" != yes && \
2081 func_fatal_configuration "can not build a shared library"
33982082 build_old_libs=no
33992083 continue
34002084 ;;
34202104 func_quote_for_eval "$libobj"
34212105 test "X$libobj" != "X$func_quote_for_eval_result" \
34222106 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3423 && func_warning "libobj name '$libobj' may not contain shell special characters."
2107 && func_warning "libobj name \`$libobj' may not contain shell special characters."
34242108 func_dirname_and_basename "$obj" "/" ""
3425 objname=$func_basename_result
3426 xdir=$func_dirname_result
3427 lobj=$xdir$objdir/$objname
2109 objname="$func_basename_result"
2110 xdir="$func_dirname_result"
2111 lobj=${xdir}$objdir/$objname
34282112
34292113 test -z "$base_compile" && \
34302114 func_fatal_help "you must specify a compilation command"
34312115
34322116 # Delete any leftover library objects.
3433 if test yes = "$build_old_libs"; then
2117 if test "$build_old_libs" = yes; then
34342118 removelist="$obj $lobj $libobj ${libobj}T"
34352119 else
34362120 removelist="$lobj $libobj ${libobj}T"
34422126 pic_mode=default
34432127 ;;
34442128 esac
3445 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
2129 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
34462130 # non-PIC code in shared libraries is not supported
34472131 pic_mode=default
34482132 fi
34492133
34502134 # Calculate the filename of the output object if compiler does
34512135 # not support -o with -c
3452 if test no = "$compiler_c_o"; then
3453 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3454 lockfile=$output_obj.lock
2136 if test "$compiler_c_o" = no; then
2137 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
2138 lockfile="$output_obj.lock"
34552139 else
34562140 output_obj=
34572141 need_locks=no
34602144
34612145 # Lock this critical section if it is needed
34622146 # We use this script file to make the link, it avoids creating a new file
3463 if test yes = "$need_locks"; then
2147 if test "$need_locks" = yes; then
34642148 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
34652149 func_echo "Waiting for $lockfile to be removed"
34662150 sleep 2
34672151 done
3468 elif test warn = "$need_locks"; then
2152 elif test "$need_locks" = warn; then
34692153 if test -f "$lockfile"; then
34702154 $ECHO "\
34712155 *** ERROR, $lockfile exists and contains:
34732157
34742158 This indicates that another process is trying to use the same
34752159 temporary object file, and libtool could not work around it because
3476 your compiler does not support '-c' and '-o' together. If you
2160 your compiler does not support \`-c' and \`-o' together. If you
34772161 repeat this compilation, it may succeed, by chance, but you had better
34782162 avoid parallel builds (make -j) in this platform, or get a better
34792163 compiler."
34952179 qsrcfile=$func_quote_for_eval_result
34962180
34972181 # Only build a PIC object if we are building libtool libraries.
3498 if test yes = "$build_libtool_libs"; then
2182 if test "$build_libtool_libs" = yes; then
34992183 # Without this assignment, base_compile gets emptied.
35002184 fbsd_hideous_sh_bug=$base_compile
35012185
3502 if test no != "$pic_mode"; then
2186 if test "$pic_mode" != no; then
35032187 command="$base_compile $qsrcfile $pic_flag"
35042188 else
35052189 # Don't build PIC code
35162200 func_show_eval_locale "$command" \
35172201 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
35182202
3519 if test warn = "$need_locks" &&
2203 if test "$need_locks" = warn &&
35202204 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
35212205 $ECHO "\
35222206 *** ERROR, $lockfile contains:
35272211
35282212 This indicates that another process is trying to use the same
35292213 temporary object file, and libtool could not work around it because
3530 your compiler does not support '-c' and '-o' together. If you
2214 your compiler does not support \`-c' and \`-o' together. If you
35312215 repeat this compilation, it may succeed, by chance, but you had better
35322216 avoid parallel builds (make -j) in this platform, or get a better
35332217 compiler."
35432227 fi
35442228
35452229 # Allow error messages only from the first compilation.
3546 if test yes = "$suppress_opt"; then
2230 if test "$suppress_opt" = yes; then
35472231 suppress_output=' >/dev/null 2>&1'
35482232 fi
35492233 fi
35502234
35512235 # Only build a position-dependent object if we build old libraries.
3552 if test yes = "$build_old_libs"; then
3553 if test yes != "$pic_mode"; then
2236 if test "$build_old_libs" = yes; then
2237 if test "$pic_mode" != yes; then
35542238 # Don't build PIC code
35552239 command="$base_compile $qsrcfile$pie_flag"
35562240 else
35572241 command="$base_compile $qsrcfile $pic_flag"
35582242 fi
3559 if test yes = "$compiler_c_o"; then
2243 if test "$compiler_c_o" = yes; then
35602244 func_append command " -o $obj"
35612245 fi
35622246
35652249 func_show_eval_locale "$command" \
35662250 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
35672251
3568 if test warn = "$need_locks" &&
2252 if test "$need_locks" = warn &&
35692253 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
35702254 $ECHO "\
35712255 *** ERROR, $lockfile contains:
35762260
35772261 This indicates that another process is trying to use the same
35782262 temporary object file, and libtool could not work around it because
3579 your compiler does not support '-c' and '-o' together. If you
2263 your compiler does not support \`-c' and \`-o' together. If you
35802264 repeat this compilation, it may succeed, by chance, but you had better
35812265 avoid parallel builds (make -j) in this platform, or get a better
35822266 compiler."
35962280 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
35972281
35982282 # Unlock the critical section if it was locked
3599 if test no != "$need_locks"; then
2283 if test "$need_locks" != no; then
36002284 removelist=$lockfile
36012285 $RM "$lockfile"
36022286 fi
36062290 }
36072291
36082292 $opt_help || {
3609 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
2293 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
36102294 }
36112295
36122296 func_mode_help ()
36262310 Remove files from the build directory.
36272311
36282312 RM is the name of the program to use to delete files associated with each FILE
3629 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
2313 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
36302314 to RM.
36312315
36322316 If FILE is a libtool library, object or program, all the files associated
36452329 -no-suppress do not suppress compiler output for multiple passes
36462330 -prefer-pic try to build PIC objects only
36472331 -prefer-non-pic try to build non-PIC objects only
3648 -shared do not build a '.o' file suitable for static linking
3649 -static only build a '.o' file suitable for static linking
2332 -shared do not build a \`.o' file suitable for static linking
2333 -static only build a \`.o' file suitable for static linking
36502334 -Wc,FLAG pass FLAG directly to the compiler
36512335
3652 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
2336 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
36532337 from the given SOURCEFILE.
36542338
36552339 The output file name is determined by removing the directory component from
3656 SOURCEFILE, then substituting the C source code suffix '.c' with the
3657 library object suffix, '.lo'."
2340 SOURCEFILE, then substituting the C source code suffix \`.c' with the
2341 library object suffix, \`.lo'."
36582342 ;;
36592343
36602344 execute)
36672351
36682352 -dlopen FILE add the directory containing FILE to the library path
36692353
3670 This mode sets the library path environment variable according to '-dlopen'
2354 This mode sets the library path environment variable according to \`-dlopen'
36712355 flags.
36722356
36732357 If any of the ARGS are libtool executable wrappers, then they are translated
36862370 Each LIBDIR is a directory that contains libtool libraries.
36872371
36882372 The commands that this mode executes may require superuser privileges. Use
3689 the '--dry-run' option if you just want to see what would be executed."
2373 the \`--dry-run' option if you just want to see what would be executed."
36902374 ;;
36912375
36922376 install)
36962380 Install executables or libraries.
36972381
36982382 INSTALL-COMMAND is the installation command. The first component should be
3699 either the 'install' or 'cp' program.
2383 either the \`install' or \`cp' program.
37002384
37012385 The following components of INSTALL-COMMAND are treated specially:
37022386
37222406 -avoid-version do not add a version suffix if possible
37232407 -bindir BINDIR specify path to binaries directory (for systems where
37242408 libraries must be found in the PATH setting at runtime)
3725 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
2409 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
37262410 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
37272411 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
37282412 -export-symbols SYMFILE
37362420 -no-install link a not-installable executable
37372421 -no-undefined declare that a library does not refer to external symbols
37382422 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3739 -objectlist FILE use a list of object files found in FILE to specify objects
3740 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
2423 -objectlist FILE Use a list of object files found in FILE to specify objects
37412424 -precious-files-regex REGEX
37422425 don't remove output files matching REGEX
37432426 -release RELEASE specify package release information
37572440 -Xlinker FLAG pass linker-specific FLAG directly to the linker
37582441 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
37592442
3760 All other options (arguments beginning with '-') are ignored.
3761
3762 Every other argument is treated as a filename. Files ending in '.la' are
2443 All other options (arguments beginning with \`-') are ignored.
2444
2445 Every other argument is treated as a filename. Files ending in \`.la' are
37632446 treated as uninstalled libtool libraries, other files are standard or library
37642447 object files.
37652448
3766 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
3767 only library objects ('.lo' files) may be specified, and '-rpath' is
2449 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
2450 only library objects (\`.lo' files) may be specified, and \`-rpath' is
37682451 required, except when creating a convenience library.
37692452
3770 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
3771 using 'ar' and 'ranlib', or on Windows using 'lib'.
3772
3773 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
2453 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
2454 using \`ar' and \`ranlib', or on Windows using \`lib'.
2455
2456 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
37742457 is created, otherwise an executable program is created."
37752458 ;;
37762459
37812464 Remove libraries from an installation directory.
37822465
37832466 RM is the name of the program to use to delete files associated with each FILE
3784 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
2467 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
37852468 to RM.
37862469
37872470 If FILE is a libtool library, all the files associated with it are deleted.
37892472 ;;
37902473
37912474 *)
3792 func_fatal_help "invalid operation mode '$opt_mode'"
2475 func_fatal_help "invalid operation mode \`$opt_mode'"
37932476 ;;
37942477 esac
37952478
37962479 echo
3797 $ECHO "Try '$progname --help' for more information about other modes."
2480 $ECHO "Try \`$progname --help' for more information about other modes."
37982481 }
37992482
38002483 # Now that we've collected a possible --mode arg, show help if necessary
38012484 if $opt_help; then
3802 if test : = "$opt_help"; then
2485 if test "$opt_help" = :; then
38032486 func_mode_help
38042487 else
38052488 {
38072490 for opt_mode in compile link execute install finish uninstall clean; do
38082491 func_mode_help
38092492 done
3810 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
2493 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
38112494 {
38122495 func_help noexit
38132496 for opt_mode in compile link execute install finish uninstall clean; do
38152498 func_mode_help
38162499 done
38172500 } |
3818 $SED '1d
2501 sed '1d
38192502 /^When reporting/,/^Report/{
38202503 H
38212504 d
38322515 # func_mode_execute arg...
38332516 func_mode_execute ()
38342517 {
3835 $debug_cmd
3836
2518 $opt_debug
38372519 # The first argument is the command name.
3838 cmd=$nonopt
2520 cmd="$nonopt"
38392521 test -z "$cmd" && \
38402522 func_fatal_help "you must specify a COMMAND"
38412523
38422524 # Handle -dlopen flags immediately.
38432525 for file in $opt_dlopen; do
38442526 test -f "$file" \
3845 || func_fatal_help "'$file' is not a file"
2527 || func_fatal_help "\`$file' is not a file"
38462528
38472529 dir=
38482530 case $file in
38522534
38532535 # Check to see that this really is a libtool archive.
38542536 func_lalib_unsafe_p "$file" \
3855 || func_fatal_help "'$lib' is not a valid libtool archive"
2537 || func_fatal_help "\`$lib' is not a valid libtool archive"
38562538
38572539 # Read the libtool library.
38582540 dlname=
38632545 if test -z "$dlname"; then
38642546 # Warn if it was a shared library.
38652547 test -n "$library_names" && \
3866 func_warning "'$file' was not linked with '-export-dynamic'"
2548 func_warning "\`$file' was not linked with \`-export-dynamic'"
38672549 continue
38682550 fi
38692551
38702552 func_dirname "$file" "" "."
3871 dir=$func_dirname_result
2553 dir="$func_dirname_result"
38722554
38732555 if test -f "$dir/$objdir/$dlname"; then
38742556 func_append dir "/$objdir"
38752557 else
38762558 if test ! -f "$dir/$dlname"; then
3877 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
2559 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
38782560 fi
38792561 fi
38802562 ;;
38822564 *.lo)
38832565 # Just add the directory containing the .lo file.
38842566 func_dirname "$file" "" "."
3885 dir=$func_dirname_result
2567 dir="$func_dirname_result"
38862568 ;;
38872569
38882570 *)
3889 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
2571 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
38902572 continue
38912573 ;;
38922574 esac
38932575
38942576 # Get the absolute pathname.
38952577 absdir=`cd "$dir" && pwd`
3896 test -n "$absdir" && dir=$absdir
2578 test -n "$absdir" && dir="$absdir"
38972579
38982580 # Now add the directory to shlibpath_var.
38992581 if eval "test -z \"\$$shlibpath_var\""; then
39052587
39062588 # This variable tells wrapper scripts just to set shlibpath_var
39072589 # rather than running their programs.
3908 libtool_execute_magic=$magic
2590 libtool_execute_magic="$magic"
39092591
39102592 # Check if any of the arguments is a wrapper script.
39112593 args=
39182600 if func_ltwrapper_script_p "$file"; then
39192601 func_source "$file"
39202602 # Transform arg to wrapped name.
3921 file=$progdir/$program
2603 file="$progdir/$program"
39222604 elif func_ltwrapper_executable_p "$file"; then
39232605 func_ltwrapper_scriptname "$file"
39242606 func_source "$func_ltwrapper_scriptname_result"
39252607 # Transform arg to wrapped name.
3926 file=$progdir/$program
2608 file="$progdir/$program"
39272609 fi
39282610 ;;
39292611 esac
39312613 func_append_quoted args "$file"
39322614 done
39332615
3934 if $opt_dry_run; then
3935 # Display what would be done.
3936 if test -n "$shlibpath_var"; then
3937 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
3938 echo "export $shlibpath_var"
3939 fi
3940 $ECHO "$cmd$args"
3941 exit $EXIT_SUCCESS
3942 else
2616 if test "X$opt_dry_run" = Xfalse; then
39432617 if test -n "$shlibpath_var"; then
39442618 # Export the shlibpath_var.
39452619 eval "export $shlibpath_var"
39562630 done
39572631
39582632 # Now prepare to actually exec the command.
3959 exec_cmd=\$cmd$args
2633 exec_cmd="\$cmd$args"
2634 else
2635 # Display what would be done.
2636 if test -n "$shlibpath_var"; then
2637 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2638 echo "export $shlibpath_var"
2639 fi
2640 $ECHO "$cmd$args"
2641 exit $EXIT_SUCCESS
39602642 fi
39612643 }
39622644
3963 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
2645 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
39642646
39652647
39662648 # func_mode_finish arg...
39672649 func_mode_finish ()
39682650 {
3969 $debug_cmd
3970
2651 $opt_debug
39712652 libs=
39722653 libdirs=
39732654 admincmds=
39812662 if func_lalib_unsafe_p "$opt"; then
39822663 func_append libs " $opt"
39832664 else
3984 func_warning "'$opt' is not a valid libtool archive"
2665 func_warning "\`$opt' is not a valid libtool archive"
39852666 fi
39862667
39872668 else
3988 func_fatal_error "invalid argument '$opt'"
2669 func_fatal_error "invalid argument \`$opt'"
39892670 fi
39902671 done
39912672
40002681 # Remove sysroot references
40012682 if $opt_dry_run; then
40022683 for lib in $libs; do
4003 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
2684 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
40042685 done
40052686 else
40062687 tmpdir=`func_mktempdir`
40072688 for lib in $libs; do
4008 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
2689 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
40092690 > $tmpdir/tmp-la
40102691 mv -f $tmpdir/tmp-la $lib
40112692 done
40302711 fi
40312712
40322713 # Exit here if they wanted silent mode.
4033 $opt_quiet && exit $EXIT_SUCCESS
2714 $opt_silent && exit $EXIT_SUCCESS
40342715
40352716 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
40362717 echo "----------------------------------------------------------------------"
40412722 echo
40422723 echo "If you ever happen to want to link against installed libraries"
40432724 echo "in a given directory, LIBDIR, you must either use libtool, and"
4044 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
2725 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
40452726 echo "flag during linking and do at least one of the following:"
40462727 if test -n "$shlibpath_var"; then
4047 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
2728 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
40482729 echo " during execution"
40492730 fi
40502731 if test -n "$runpath_var"; then
4051 echo " - add LIBDIR to the '$runpath_var' environment variable"
2732 echo " - add LIBDIR to the \`$runpath_var' environment variable"
40522733 echo " during linking"
40532734 fi
40542735 if test -n "$hardcode_libdir_flag_spec"; then
40552736 libdir=LIBDIR
40562737 eval flag=\"$hardcode_libdir_flag_spec\"
40572738
4058 $ECHO " - use the '$flag' linker flag"
2739 $ECHO " - use the \`$flag' linker flag"
40592740 fi
40602741 if test -n "$admincmds"; then
40612742 $ECHO " - have your system administrator run these commands:$admincmds"
40622743 fi
40632744 if test -f /etc/ld.so.conf; then
4064 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
2745 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
40652746 fi
40662747 echo
40672748
40802761 exit $EXIT_SUCCESS
40812762 }
40822763
4083 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
2764 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
40842765
40852766
40862767 # func_mode_install arg...
40872768 func_mode_install ()
40882769 {
4089 $debug_cmd
4090
2770 $opt_debug
40912771 # There may be an optional sh(1) argument at the beginning of
40922772 # install_prog (especially on Windows NT).
4093 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
2773 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
40942774 # Allow the use of GNU shtool's install command.
4095 case $nonopt in *shtool*) :;; *) false;; esac
4096 then
2775 case $nonopt in *shtool*) :;; *) false;; esac; then
40972776 # Aesthetically quote it.
40982777 func_quote_for_eval "$nonopt"
40992778 install_prog="$func_quote_for_eval_result "
41202799 opts=
41212800 prev=
41222801 install_type=
4123 isdir=false
2802 isdir=no
41242803 stripme=
41252804 no_mode=:
41262805 for arg
41332812 fi
41342813
41352814 case $arg in
4136 -d) isdir=: ;;
2815 -d) isdir=yes ;;
41372816 -f)
41382817 if $install_cp; then :; else
41392818 prev=$arg
41512830 *)
41522831 # If the previous option needed an argument, then skip it.
41532832 if test -n "$prev"; then
4154 if test X-m = "X$prev" && test -n "$install_override_mode"; then
2833 if test "x$prev" = x-m && test -n "$install_override_mode"; then
41552834 arg2=$install_override_mode
41562835 no_mode=false
41572836 fi
41762855 func_fatal_help "you must specify an install program"
41772856
41782857 test -n "$prev" && \
4179 func_fatal_help "the '$prev' option requires an argument"
2858 func_fatal_help "the \`$prev' option requires an argument"
41802859
41812860 if test -n "$install_override_mode" && $no_mode; then
41822861 if $install_cp; then :; else
41982877 dest=$func_stripname_result
41992878
42002879 # Check to see that the destination is a directory.
4201 test -d "$dest" && isdir=:
4202 if $isdir; then
4203 destdir=$dest
2880 test -d "$dest" && isdir=yes
2881 if test "$isdir" = yes; then
2882 destdir="$dest"
42042883 destname=
42052884 else
42062885 func_dirname_and_basename "$dest" "" "."
4207 destdir=$func_dirname_result
4208 destname=$func_basename_result
2886 destdir="$func_dirname_result"
2887 destname="$func_basename_result"
42092888
42102889 # Not a directory, so check to see that there is only one file specified.
42112890 set dummy $files; shift
42122891 test "$#" -gt 1 && \
4213 func_fatal_help "'$dest' is not a directory"
2892 func_fatal_help "\`$dest' is not a directory"
42142893 fi
42152894 case $destdir in
42162895 [\\/]* | [A-Za-z]:[\\/]*) ;;
42192898 case $file in
42202899 *.lo) ;;
42212900 *)
4222 func_fatal_help "'$destdir' must be an absolute directory name"
2901 func_fatal_help "\`$destdir' must be an absolute directory name"
42232902 ;;
42242903 esac
42252904 done
42282907
42292908 # This variable tells wrapper scripts just to set variables rather
42302909 # than running their programs.
4231 libtool_install_magic=$magic
2910 libtool_install_magic="$magic"
42322911
42332912 staticlibs=
42342913 future_libdirs=
42482927
42492928 # Check to see that this really is a libtool archive.
42502929 func_lalib_unsafe_p "$file" \
4251 || func_fatal_help "'$file' is not a valid libtool archive"
2930 || func_fatal_help "\`$file' is not a valid libtool archive"
42522931
42532932 library_names=
42542933 old_library=
42702949 fi
42712950
42722951 func_dirname "$file" "/" ""
4273 dir=$func_dirname_result
2952 dir="$func_dirname_result"
42742953 func_append dir "$objdir"
42752954
42762955 if test -n "$relink_command"; then
42842963 # are installed into $libdir/../bin (currently, that works fine)
42852964 # but it's something to keep an eye on.
42862965 test "$inst_prefix_dir" = "$destdir" && \
4287 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
2966 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
42882967
42892968 if test -n "$inst_prefix_dir"; then
42902969 # Stick the inst_prefix_dir data into the link command.
42932972 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
42942973 fi
42952974
4296 func_warning "relinking '$file'"
2975 func_warning "relinking \`$file'"
42972976 func_show_eval "$relink_command" \
4298 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
2977 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
42992978 fi
43002979
43012980 # See the names of the shared library.
43022981 set dummy $library_names; shift
43032982 if test -n "$1"; then
4304 realname=$1
2983 realname="$1"
43052984 shift
43062985
4307 srcname=$realname
4308 test -n "$relink_command" && srcname=${realname}T
2986 srcname="$realname"
2987 test -n "$relink_command" && srcname="$realname"T
43092988
43102989 # Install the shared library and build the symlinks.
43112990 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
43122991 'exit $?'
4313 tstripme=$stripme
2992 tstripme="$stripme"
43142993 case $host_os in
43152994 cygwin* | mingw* | pw32* | cegcc*)
43162995 case $realname in
43172996 *.dll.a)
4318 tstripme=
4319 ;;
4320 esac
4321 ;;
4322 os2*)
4323 case $realname in
4324 *_dll.a)
4325 tstripme=
2997 tstripme=""
43262998 ;;
43272999 esac
43283000 ;;
43333005
43343006 if test "$#" -gt 0; then
43353007 # Delete the old symlinks, and create new ones.
4336 # Try 'ln -sf' first, because the 'ln' binary might depend on
3008 # Try `ln -sf' first, because the `ln' binary might depend on
43373009 # the symlink we replace! Solaris /bin/ln does not understand -f,
43383010 # so we also need to try rm && ln -s.
43393011 for linkname
43443016 fi
43453017
43463018 # Do each command in the postinstall commands.
4347 lib=$destdir/$realname
3019 lib="$destdir/$realname"
43483020 func_execute_cmds "$postinstall_cmds" 'exit $?'
43493021 fi
43503022
43513023 # Install the pseudo-library for information purposes.
43523024 func_basename "$file"
4353 name=$func_basename_result
4354 instname=$dir/${name}i
3025 name="$func_basename_result"
3026 instname="$dir/$name"i
43553027 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
43563028
43573029 # Maybe install the static library, too.
43633035
43643036 # Figure out destination file name, if it wasn't already specified.
43653037 if test -n "$destname"; then
4366 destfile=$destdir/$destname
3038 destfile="$destdir/$destname"
43673039 else
43683040 func_basename "$file"
4369 destfile=$func_basename_result
4370 destfile=$destdir/$destfile
3041 destfile="$func_basename_result"
3042 destfile="$destdir/$destfile"
43713043 fi
43723044
43733045 # Deduce the name of the destination old-style object file.
43773049 staticdest=$func_lo2o_result
43783050 ;;
43793051 *.$objext)
4380 staticdest=$destfile
3052 staticdest="$destfile"
43813053 destfile=
43823054 ;;
43833055 *)
4384 func_fatal_help "cannot copy a libtool object to '$destfile'"
3056 func_fatal_help "cannot copy a libtool object to \`$destfile'"
43853057 ;;
43863058 esac
43873059
43903062 func_show_eval "$install_prog $file $destfile" 'exit $?'
43913063
43923064 # Install the old object if enabled.
4393 if test yes = "$build_old_libs"; then
3065 if test "$build_old_libs" = yes; then
43943066 # Deduce the name of the old-style object file.
43953067 func_lo2o "$file"
43963068 staticobj=$func_lo2o_result
44023074 *)
44033075 # Figure out destination file name, if it wasn't already specified.
44043076 if test -n "$destname"; then
4405 destfile=$destdir/$destname
3077 destfile="$destdir/$destname"
44063078 else
44073079 func_basename "$file"
4408 destfile=$func_basename_result
4409 destfile=$destdir/$destfile
3080 destfile="$func_basename_result"
3081 destfile="$destdir/$destfile"
44103082 fi
44113083
44123084 # If the file is missing, and there is a .exe on the end, strip it
44133085 # because it is most likely a libtool script we actually want to
44143086 # install
4415 stripped_ext=
3087 stripped_ext=""
44163088 case $file in
44173089 *.exe)
44183090 if test ! -f "$file"; then
44193091 func_stripname '' '.exe' "$file"
44203092 file=$func_stripname_result
4421 stripped_ext=.exe
3093 stripped_ext=".exe"
44223094 fi
44233095 ;;
44243096 esac
44463118
44473119 # Check the variables that should have been set.
44483120 test -z "$generated_by_libtool_version" && \
4449 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4450
4451 finalize=:
3121 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
3122
3123 finalize=yes
44523124 for lib in $notinst_deplibs; do
44533125 # Check to see that each library is installed.
44543126 libdir=
44553127 if test -f "$lib"; then
44563128 func_source "$lib"
44573129 fi
4458 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
3130 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
44593131 if test -n "$libdir" && test ! -f "$libfile"; then
4460 func_warning "'$lib' has not been installed in '$libdir'"
4461 finalize=false
3132 func_warning "\`$lib' has not been installed in \`$libdir'"
3133 finalize=no
44623134 fi
44633135 done
44643136
44663138 func_source "$wrapper"
44673139
44683140 outputname=
4469 if test no = "$fast_install" && test -n "$relink_command"; then
3141 if test "$fast_install" = no && test -n "$relink_command"; then
44703142 $opt_dry_run || {
4471 if $finalize; then
3143 if test "$finalize" = yes; then
44723144 tmpdir=`func_mktempdir`
44733145 func_basename "$file$stripped_ext"
4474 file=$func_basename_result
4475 outputname=$tmpdir/$file
3146 file="$func_basename_result"
3147 outputname="$tmpdir/$file"
44763148 # Replace the output file specification.
44773149 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
44783150
4479 $opt_quiet || {
3151 $opt_silent || {
44803152 func_quote_for_expand "$relink_command"
44813153 eval "func_echo $func_quote_for_expand_result"
44823154 }
44833155 if eval "$relink_command"; then :
44843156 else
4485 func_error "error: relink '$file' with the above command before installing it"
3157 func_error "error: relink \`$file' with the above command before installing it"
44863158 $opt_dry_run || ${RM}r "$tmpdir"
44873159 continue
44883160 fi
4489 file=$outputname
3161 file="$outputname"
44903162 else
4491 func_warning "cannot relink '$file'"
3163 func_warning "cannot relink \`$file'"
44923164 fi
44933165 }
44943166 else
45253197
45263198 for file in $staticlibs; do
45273199 func_basename "$file"
4528 name=$func_basename_result
3200 name="$func_basename_result"
45293201
45303202 # Set up the ranlib parameters.
4531 oldlib=$destdir/$name
3203 oldlib="$destdir/$name"
45323204 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
45333205 tool_oldlib=$func_to_tool_file_result
45343206
45433215 done
45443216
45453217 test -n "$future_libdirs" && \
4546 func_warning "remember to run '$progname --finish$future_libdirs'"
3218 func_warning "remember to run \`$progname --finish$future_libdirs'"
45473219
45483220 if test -n "$current_libdirs"; then
45493221 # Maybe just do a dry run.
45503222 $opt_dry_run && current_libdirs=" -n$current_libdirs"
4551 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
3223 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
45523224 else
45533225 exit $EXIT_SUCCESS
45543226 fi
45553227 }
45563228
4557 test install = "$opt_mode" && func_mode_install ${1+"$@"}
3229 test "$opt_mode" = install && func_mode_install ${1+"$@"}
45583230
45593231
45603232 # func_generate_dlsyms outputname originator pic_p
45623234 # a dlpreopen symbol table.
45633235 func_generate_dlsyms ()
45643236 {
4565 $debug_cmd
4566
4567 my_outputname=$1
4568 my_originator=$2
4569 my_pic_p=${3-false}
4570 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
3237 $opt_debug
3238 my_outputname="$1"
3239 my_originator="$2"
3240 my_pic_p="${3-no}"
3241 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
45713242 my_dlsyms=
45723243
4573 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
3244 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
45743245 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4575 my_dlsyms=${my_outputname}S.c
3246 my_dlsyms="${my_outputname}S.c"
45763247 else
45773248 func_error "not configured to extract global symbols from dlpreopened files"
45783249 fi
45833254 "") ;;
45843255 *.c)
45853256 # Discover the nlist of each of the dlfiles.
4586 nlist=$output_objdir/$my_outputname.nm
3257 nlist="$output_objdir/${my_outputname}.nm"
45873258
45883259 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
45893260
45913262 func_verbose "creating $output_objdir/$my_dlsyms"
45923263
45933264 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
4594 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
4595 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
3265 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
3266 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
45963267
45973268 #ifdef __cplusplus
45983269 extern \"C\" {
45993270 #endif
46003271
4601 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
3272 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
46023273 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
46033274 #endif
46043275
46053276 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
4606 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
4607 /* DATA imports from DLLs on WIN32 can't be const, because runtime
3277 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3278 /* DATA imports from DLLs on WIN32 con't be const, because runtime
46083279 relocations are performed -- see ld's documentation on pseudo-relocs. */
46093280 # define LT_DLSYM_CONST
4610 #elif defined __osf__
3281 #elif defined(__osf__)
46113282 /* This system does not cope well with relocations in const data. */
46123283 # define LT_DLSYM_CONST
46133284 #else
46143285 # define LT_DLSYM_CONST const
46153286 #endif
46163287
4617 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
4618
46193288 /* External symbol declarations for the compiler. */\
46203289 "
46213290
4622 if test yes = "$dlself"; then
4623 func_verbose "generating symbol list for '$output'"
3291 if test "$dlself" = yes; then
3292 func_verbose "generating symbol list for \`$output'"
46243293
46253294 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
46263295
46283297 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
46293298 for progfile in $progfiles; do
46303299 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
4631 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
3300 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
46323301 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
46333302 done
46343303
46483317
46493318 # Prepare the list of exported symbols
46503319 if test -z "$export_symbols"; then
4651 export_symbols=$output_objdir/$outputname.exp
3320 export_symbols="$output_objdir/$outputname.exp"
46523321 $opt_dry_run || {
46533322 $RM $export_symbols
4654 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3323 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
46553324 case $host in
46563325 *cygwin* | *mingw* | *cegcc* )
46573326 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
46613330 }
46623331 else
46633332 $opt_dry_run || {
4664 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
3333 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
46653334 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
46663335 eval '$MV "$nlist"T "$nlist"'
46673336 case $host in
46753344 fi
46763345
46773346 for dlprefile in $dlprefiles; do
4678 func_verbose "extracting global C symbols from '$dlprefile'"
3347 func_verbose "extracting global C symbols from \`$dlprefile'"
46793348 func_basename "$dlprefile"
4680 name=$func_basename_result
3349 name="$func_basename_result"
46813350 case $host in
46823351 *cygwin* | *mingw* | *cegcc* )
46833352 # if an import library, we need to obtain dlname
46843353 if func_win32_import_lib_p "$dlprefile"; then
46853354 func_tr_sh "$dlprefile"
46863355 eval "curr_lafile=\$libfile_$func_tr_sh_result"
4687 dlprefile_dlbasename=
3356 dlprefile_dlbasename=""
46883357 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
46893358 # Use subshell, to avoid clobbering current variable values
46903359 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
4691 if test -n "$dlprefile_dlname"; then
3360 if test -n "$dlprefile_dlname" ; then
46923361 func_basename "$dlprefile_dlname"
4693 dlprefile_dlbasename=$func_basename_result
3362 dlprefile_dlbasename="$func_basename_result"
46943363 else
46953364 # no lafile. user explicitly requested -dlpreopen <import library>.
46963365 $sharedlib_from_linklib_cmd "$dlprefile"
46983367 fi
46993368 fi
47003369 $opt_dry_run || {
4701 if test -n "$dlprefile_dlbasename"; then
3370 if test -n "$dlprefile_dlbasename" ; then
47023371 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
47033372 else
47043373 func_warning "Could not compute DLL name from $name"
47543423 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
47553424 fi
47563425
4757 func_show_eval '$RM "${nlist}I"'
4758 if test -n "$global_symbol_to_import"; then
4759 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
4760 fi
4761
47623426 echo >> "$output_objdir/$my_dlsyms" "\
47633427
47643428 /* The mapping between symbol names and symbols. */
47673431 void *address;
47683432 } lt_dlsymlist;
47693433 extern LT_DLSYM_CONST lt_dlsymlist
4770 lt_${my_prefix}_LTX_preloaded_symbols[];\
4771 "
4772
4773 if test -s "$nlist"I; then
4774 echo >> "$output_objdir/$my_dlsyms" "\
4775 static void lt_syminit(void)
4776 {
4777 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
4778 for (; symbol->name; ++symbol)
4779 {"
4780 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
4781 echo >> "$output_objdir/$my_dlsyms" "\
4782 }
4783 }"
4784 fi
4785 echo >> "$output_objdir/$my_dlsyms" "\
3434 lt_${my_prefix}_LTX_preloaded_symbols[];
47863435 LT_DLSYM_CONST lt_dlsymlist
47873436 lt_${my_prefix}_LTX_preloaded_symbols[] =
4788 { {\"$my_originator\", (void *) 0},"
4789
4790 if test -s "$nlist"I; then
4791 echo >> "$output_objdir/$my_dlsyms" "\
4792 {\"@INIT@\", (void *) &lt_syminit},"
4793 fi
3437 {\
3438 { \"$my_originator\", (void *) 0 },"
47943439
47953440 case $need_lib_prefix in
47963441 no)
48323477 *-*-hpux*)
48333478 pic_flag_for_symtable=" $pic_flag" ;;
48343479 *)
4835 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
3480 if test "X$my_pic_p" != Xno; then
3481 pic_flag_for_symtable=" $pic_flag"
3482 fi
48363483 ;;
48373484 esac
48383485 ;;
48493496 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
48503497
48513498 # Clean up the generated files.
4852 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
3499 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
48533500
48543501 # Transform the symbol file into the correct name.
4855 symfileobj=$output_objdir/${my_outputname}S.$objext
3502 symfileobj="$output_objdir/${my_outputname}S.$objext"
48563503 case $host in
48573504 *cygwin* | *mingw* | *cegcc* )
48583505 if test -f "$output_objdir/$my_outputname.def"; then
48703517 esac
48713518 ;;
48723519 *)
4873 func_fatal_error "unknown suffix for '$my_dlsyms'"
3520 func_fatal_error "unknown suffix for \`$my_dlsyms'"
48743521 ;;
48753522 esac
48763523 else
48823529 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
48833530 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
48843531 fi
4885 }
4886
4887 # func_cygming_gnu_implib_p ARG
4888 # This predicate returns with zero status (TRUE) if
4889 # ARG is a GNU/binutils-style import library. Returns
4890 # with nonzero status (FALSE) otherwise.
4891 func_cygming_gnu_implib_p ()
4892 {
4893 $debug_cmd
4894
4895 func_to_tool_file "$1" func_convert_file_msys_to_w32
4896 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
4897 test -n "$func_cygming_gnu_implib_tmp"
4898 }
4899
4900 # func_cygming_ms_implib_p ARG
4901 # This predicate returns with zero status (TRUE) if
4902 # ARG is an MS-style import library. Returns
4903 # with nonzero status (FALSE) otherwise.
4904 func_cygming_ms_implib_p ()
4905 {
4906 $debug_cmd
4907
4908 func_to_tool_file "$1" func_convert_file_msys_to_w32
4909 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4910 test -n "$func_cygming_ms_implib_tmp"
49113532 }
49123533
49133534 # func_win32_libid arg
49193540 # Despite the name, also deal with 64 bit binaries.
49203541 func_win32_libid ()
49213542 {
4922 $debug_cmd
4923
4924 win32_libid_type=unknown
3543 $opt_debug
3544 win32_libid_type="unknown"
49253545 win32_fileres=`file -L $1 2>/dev/null`
49263546 case $win32_fileres in
49273547 *ar\ archive\ import\ library*) # definitely import
49313551 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
49323552 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
49333553 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
4934 case $nm_interface in
4935 "MS dumpbin")
4936 if func_cygming_ms_implib_p "$1" ||
4937 func_cygming_gnu_implib_p "$1"
4938 then
4939 win32_nmres=import
4940 else
4941 win32_nmres=
4942 fi
4943 ;;
4944 *)
4945 func_to_tool_file "$1" func_convert_file_msys_to_w32
4946 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
4947 $SED -n -e '
3554 func_to_tool_file "$1" func_convert_file_msys_to_w32
3555 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3556 $SED -n -e '
49483557 1,100{
49493558 / I /{
4950 s|.*|import|
3559 s,.*,import,
49513560 p
49523561 q
49533562 }
49543563 }'`
4955 ;;
4956 esac
49573564 case $win32_nmres in
49583565 import*) win32_libid_type="x86 archive import";;
49593566 *) win32_libid_type="x86 archive static";;
49853592 # $sharedlib_from_linklib_result
49863593 func_cygming_dll_for_implib ()
49873594 {
4988 $debug_cmd
4989
3595 $opt_debug
49903596 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
49913597 }
49923598
50033609 # specified import library.
50043610 func_cygming_dll_for_implib_fallback_core ()
50053611 {
5006 $debug_cmd
5007
3612 $opt_debug
50083613 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
50093614 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
50103615 $SED '/^Contents of section '"$match_literal"':/{
50403645 /./p' |
50413646 # we now have a list, one entry per line, of the stringified
50423647 # contents of the appropriate section of all members of the
5043 # archive that possess that section. Heuristic: eliminate
5044 # all those that have a first or second character that is
3648 # archive which possess that section. Heuristic: eliminate
3649 # all those which have a first or second character that is
50453650 # a '.' (that is, objdump's representation of an unprintable
50463651 # character.) This should work for all archives with less than
50473652 # 0x302f exports -- but will fail for DLLs whose name actually
50503655 #
50513656 # Of those that remain, print the first one.
50523657 $SED -e '/^\./d;/^.\./d;q'
3658 }
3659
3660 # func_cygming_gnu_implib_p ARG
3661 # This predicate returns with zero status (TRUE) if
3662 # ARG is a GNU/binutils-style import library. Returns
3663 # with nonzero status (FALSE) otherwise.
3664 func_cygming_gnu_implib_p ()
3665 {
3666 $opt_debug
3667 func_to_tool_file "$1" func_convert_file_msys_to_w32
3668 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
3669 test -n "$func_cygming_gnu_implib_tmp"
3670 }
3671
3672 # func_cygming_ms_implib_p ARG
3673 # This predicate returns with zero status (TRUE) if
3674 # ARG is an MS-style import library. Returns
3675 # with nonzero status (FALSE) otherwise.
3676 func_cygming_ms_implib_p ()
3677 {
3678 $opt_debug
3679 func_to_tool_file "$1" func_convert_file_msys_to_w32
3680 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
3681 test -n "$func_cygming_ms_implib_tmp"
50533682 }
50543683
50553684 # func_cygming_dll_for_implib_fallback ARG
50653694 # $sharedlib_from_linklib_result
50663695 func_cygming_dll_for_implib_fallback ()
50673696 {
5068 $debug_cmd
5069
5070 if func_cygming_gnu_implib_p "$1"; then
3697 $opt_debug
3698 if func_cygming_gnu_implib_p "$1" ; then
50713699 # binutils import library
50723700 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5073 elif func_cygming_ms_implib_p "$1"; then
3701 elif func_cygming_ms_implib_p "$1" ; then
50743702 # ms-generated import library
50753703 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
50763704 else
50773705 # unknown
5078 sharedlib_from_linklib_result=
3706 sharedlib_from_linklib_result=""
50793707 fi
50803708 }
50813709
50833711 # func_extract_an_archive dir oldlib
50843712 func_extract_an_archive ()
50853713 {
5086 $debug_cmd
5087
5088 f_ex_an_ar_dir=$1; shift
5089 f_ex_an_ar_oldlib=$1
5090 if test yes = "$lock_old_archive_extraction"; then
3714 $opt_debug
3715 f_ex_an_ar_dir="$1"; shift
3716 f_ex_an_ar_oldlib="$1"
3717 if test "$lock_old_archive_extraction" = yes; then
50913718 lockfile=$f_ex_an_ar_oldlib.lock
50923719 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
50933720 func_echo "Waiting for $lockfile to be removed"
50963723 fi
50973724 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
50983725 'stat=$?; rm -f "$lockfile"; exit $stat'
5099 if test yes = "$lock_old_archive_extraction"; then
3726 if test "$lock_old_archive_extraction" = yes; then
51003727 $opt_dry_run || rm -f "$lockfile"
51013728 fi
51023729 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
51103737 # func_extract_archives gentop oldlib ...
51113738 func_extract_archives ()
51123739 {
5113 $debug_cmd
5114
5115 my_gentop=$1; shift
3740 $opt_debug
3741 my_gentop="$1"; shift
51163742 my_oldlibs=${1+"$@"}
5117 my_oldobjs=
5118 my_xlib=
5119 my_xabs=
5120 my_xdir=
3743 my_oldobjs=""
3744 my_xlib=""
3745 my_xabs=""
3746 my_xdir=""
51213747
51223748 for my_xlib in $my_oldlibs; do
51233749 # Extract the objects.
51243750 case $my_xlib in
5125 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
3751 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
51263752 *) my_xabs=`pwd`"/$my_xlib" ;;
51273753 esac
51283754 func_basename "$my_xlib"
5129 my_xlib=$func_basename_result
3755 my_xlib="$func_basename_result"
51303756 my_xlib_u=$my_xlib
51313757 while :; do
51323758 case " $extracted_archives " in
51383764 esac
51393765 done
51403766 extracted_archives="$extracted_archives $my_xlib_u"
5141 my_xdir=$my_gentop/$my_xlib_u
3767 my_xdir="$my_gentop/$my_xlib_u"
51423768
51433769 func_mkdir_p "$my_xdir"
51443770
51513777 cd $my_xdir || exit $?
51523778 darwin_archive=$my_xabs
51533779 darwin_curdir=`pwd`
5154 func_basename "$darwin_archive"
5155 darwin_base_archive=$func_basename_result
3780 darwin_base_archive=`basename "$darwin_archive"`
51563781 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
51573782 if test -n "$darwin_arches"; then
51583783 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
51593784 darwin_arch=
51603785 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5161 for darwin_arch in $darwin_arches; do
5162 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5163 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5164 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5165 func_extract_an_archive "`pwd`" "$darwin_base_archive"
3786 for darwin_arch in $darwin_arches ; do
3787 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3788 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3789 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3790 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
51663791 cd "$darwin_curdir"
5167 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
3792 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
51683793 done # $darwin_arches
51693794 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5170 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
3795 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
51713796 darwin_file=
51723797 darwin_files=
51733798 for darwin_file in $darwin_filelist; do
51893814 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
51903815 done
51913816
5192 func_extract_archives_result=$my_oldobjs
3817 func_extract_archives_result="$my_oldobjs"
51933818 }
51943819
51953820
52043829 #
52053830 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
52063831 # variable will take. If 'yes', then the emitted script
5207 # will assume that the directory where it is stored is
3832 # will assume that the directory in which it is stored is
52083833 # the $objdir directory. This is a cygwin/mingw-specific
52093834 # behavior.
52103835 func_emit_wrapper ()
52153840 #! $SHELL
52163841
52173842 # $output - temporary wrapper script for $objdir/$outputname
5218 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
3843 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
52193844 #
52203845 # The $output program cannot be directly executed until all the libtool
52213846 # libraries that it depends on are installed.
52723897
52733898 # Very basic option parsing. These options are (a) specific to
52743899 # the libtool wrapper, (b) are identical between the wrapper
5275 # /script/ and the wrapper /executable/ that is used only on
3900 # /script/ and the wrapper /executable/ which is used only on
52763901 # windows platforms, and (c) all begin with the string "--lt-"
5277 # (application programs are unlikely to have options that match
3902 # (application programs are unlikely to have options which match
52783903 # this pattern).
52793904 #
52803905 # There are only two supported options: --lt-debug and
53073932
53083933 # Print the debug banner immediately:
53093934 if test -n \"\$lt_option_debug\"; then
5310 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
3935 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
53113936 fi
53123937 }
53133938
53183943 lt_dump_args_N=1;
53193944 for lt_arg
53203945 do
5321 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
3946 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
53223947 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
53233948 done
53243949 }
53323957 *-*-mingw | *-*-os2* | *-cegcc*)
53333958 $ECHO "\
53343959 if test -n \"\$lt_option_debug\"; then
5335 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
3960 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
53363961 func_lt_dump_args \${1+\"\$@\"} 1>&2
53373962 fi
53383963 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
53423967 *)
53433968 $ECHO "\
53443969 if test -n \"\$lt_option_debug\"; then
5345 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
3970 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
53463971 func_lt_dump_args \${1+\"\$@\"} 1>&2
53473972 fi
53483973 exec \"\$progdir/\$program\" \${1+\"\$@\"}
54174042 test -n \"\$absdir\" && thisdir=\"\$absdir\"
54184043 "
54194044
5420 if test yes = "$fast_install"; then
4045 if test "$fast_install" = yes; then
54214046 $ECHO "\
54224047 program=lt-'$outputname'$exeext
54234048 progdir=\"\$thisdir/$objdir\"
54244049
54254050 if test ! -f \"\$progdir/\$program\" ||
5426 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
4051 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
54274052 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
54284053
54294054 file=\"\$\$-\$program\"
54404065 if test -n \"\$relink_command\"; then
54414066 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
54424067 else
5443 \$ECHO \"\$relink_command_output\" >&2
4068 $ECHO \"\$relink_command_output\" >&2
54444069 $RM \"\$progdir/\$file\"
54454070 exit 1
54464071 fi
54754100 fi
54764101
54774102 # Export our shlibpath_var if we have one.
5478 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4103 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
54794104 $ECHO "\
54804105 # Add our own library path to $shlibpath_var
54814106 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
54954120 fi
54964121 else
54974122 # The program doesn't exist.
5498 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
4123 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
54994124 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
55004125 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
55014126 exit 1
55144139 cat <<EOF
55154140
55164141 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5517 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
4142 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
55184143
55194144 The $output program cannot be directly executed until all the libtool
55204145 libraries that it depends on are installed.
55494174 #include <fcntl.h>
55504175 #include <sys/stat.h>
55514176
5552 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5553
55544177 /* declarations of non-ANSI functions */
5555 #if defined __MINGW32__
4178 #if defined(__MINGW32__)
55564179 # ifdef __STRICT_ANSI__
55574180 int _putenv (const char *);
55584181 # endif
5559 #elif defined __CYGWIN__
4182 #elif defined(__CYGWIN__)
55604183 # ifdef __STRICT_ANSI__
55614184 char *realpath (const char *, char *);
55624185 int putenv (char *);
55634186 int setenv (const char *, const char *, int);
55644187 # endif
5565 /* #elif defined other_platform || defined ... */
4188 /* #elif defined (other platforms) ... */
55664189 #endif
55674190
55684191 /* portability defines, excluding path handling macros */
5569 #if defined _MSC_VER
4192 #if defined(_MSC_VER)
55704193 # define setmode _setmode
55714194 # define stat _stat
55724195 # define chmod _chmod
55734196 # define getcwd _getcwd
55744197 # define putenv _putenv
55754198 # define S_IXUSR _S_IEXEC
5576 #elif defined __MINGW32__
4199 # ifndef _INTPTR_T_DEFINED
4200 # define _INTPTR_T_DEFINED
4201 # define intptr_t int
4202 # endif
4203 #elif defined(__MINGW32__)
55774204 # define setmode _setmode
55784205 # define stat _stat
55794206 # define chmod _chmod
55804207 # define getcwd _getcwd
55814208 # define putenv _putenv
5582 #elif defined __CYGWIN__
4209 #elif defined(__CYGWIN__)
55834210 # define HAVE_SETENV
55844211 # define FOPEN_WB "wb"
5585 /* #elif defined other platforms ... */
4212 /* #elif defined (other platforms) ... */
55864213 #endif
55874214
5588 #if defined PATH_MAX
4215 #if defined(PATH_MAX)
55894216 # define LT_PATHMAX PATH_MAX
5590 #elif defined MAXPATHLEN
4217 #elif defined(MAXPATHLEN)
55914218 # define LT_PATHMAX MAXPATHLEN
55924219 #else
55934220 # define LT_PATHMAX 1024
56064233 # define PATH_SEPARATOR ':'
56074234 #endif
56084235
5609 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
5610 defined __OS2__
4236 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4237 defined (__OS2__)
56114238 # define HAVE_DOS_BASED_FILE_SYSTEM
56124239 # define FOPEN_WB "wb"
56134240 # ifndef DIR_SEPARATOR_2
56404267
56414268 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
56424269 #define XFREE(stale) do { \
5643 if (stale) { free (stale); stale = 0; } \
4270 if (stale) { free ((void *) stale); stale = 0; } \
56444271 } while (0)
56454272
5646 #if defined LT_DEBUGWRAPPER
4273 #if defined(LT_DEBUGWRAPPER)
56474274 static int lt_debug = 1;
56484275 #else
56494276 static int lt_debug = 0;
56724299 EOF
56734300
56744301 cat <<EOF
5675 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
5676 # define externally_visible volatile
5677 #else
5678 # define externally_visible __attribute__((externally_visible)) volatile
5679 #endif
5680 externally_visible const char * MAGIC_EXE = "$magic_exe";
4302 volatile const char * MAGIC_EXE = "$magic_exe";
56814303 const char * LIB_PATH_VARNAME = "$shlibpath_var";
56824304 EOF
56834305
5684 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4306 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
56854307 func_to_host_path "$temp_rpath"
56864308 cat <<EOF
56874309 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
57054327 EOF
57064328 fi
57074329
5708 if test yes = "$fast_install"; then
4330 if test "$fast_install" = yes; then
57094331 cat <<EOF
57104332 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
57114333 EOF
57344356 char *actual_cwrapper_name;
57354357 char *target_name;
57364358 char *lt_argv_zero;
5737 int rval = 127;
4359 intptr_t rval = 127;
57384360
57394361 int i;
57404362
57414363 program_name = (char *) xstrdup (base_name (argv[0]));
5742 newargz = XMALLOC (char *, (size_t) argc + 1);
4364 newargz = XMALLOC (char *, argc + 1);
57434365
57444366 /* very simple arg parsing; don't want to rely on getopt
57454367 * also, copy all non cwrapper options to newargz, except
57484370 newargc=0;
57494371 for (i = 1; i < argc; i++)
57504372 {
5751 if (STREQ (argv[i], dumpscript_opt))
4373 if (strcmp (argv[i], dumpscript_opt) == 0)
57524374 {
57534375 EOF
5754 case $host in
4376 case "$host" in
57554377 *mingw* | *cygwin* )
57564378 # make stdout use "unix" line endings
57574379 echo " setmode(1,_O_BINARY);"
57624384 lt_dump_script (stdout);
57634385 return 0;
57644386 }
5765 if (STREQ (argv[i], debug_opt))
4387 if (strcmp (argv[i], debug_opt) == 0)
57664388 {
57674389 lt_debug = 1;
57684390 continue;
57694391 }
5770 if (STREQ (argv[i], ltwrapper_option_prefix))
4392 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
57714393 {
57724394 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
57734395 namespace, but it is not one of the ones we know about and
57904412 EOF
57914413 cat <<EOF
57924414 /* The GNU banner must be the first non-error debug message */
5793 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
4415 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
57944416 EOF
57954417 cat <<"EOF"
57964418 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
59014523 cat <<"EOF"
59024524 /* execv doesn't actually work on mingw as expected on unix */
59034525 newargz = prepare_spawn (newargz);
5904 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
4526 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
59054527 if (rval == -1)
59064528 {
59074529 /* failed to start process */
59464568 {
59474569 const char *base;
59484570
5949 #if defined HAVE_DOS_BASED_FILE_SYSTEM
4571 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
59504572 /* Skip over the disk name in MSDOS pathnames. */
59514573 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
59524574 name += 2;
60054627 const char *p_next;
60064628 /* static buffer for getcwd */
60074629 char tmp[LT_PATHMAX + 1];
6008 size_t tmp_len;
4630 int tmp_len;
60094631 char *concat_name;
60104632
60114633 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
60154637 return NULL;
60164638
60174639 /* Absolute path? */
6018 #if defined HAVE_DOS_BASED_FILE_SYSTEM
4640 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
60194641 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
60204642 {
60214643 concat_name = xstrdup (wrapper);
60334655 return concat_name;
60344656 XFREE (concat_name);
60354657 }
6036 #if defined HAVE_DOS_BASED_FILE_SYSTEM
4658 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
60374659 }
60384660 #endif
60394661
60564678 for (q = p; *q; q++)
60574679 if (IS_PATH_SEPARATOR (*q))
60584680 break;
6059 p_len = (size_t) (q - p);
4681 p_len = q - p;
60604682 p_next = (*q == '\0' ? q : q + 1);
60614683 if (p_len == 0)
60624684 {
61754797 if (patlen <= len)
61764798 {
61774799 str += len - patlen;
6178 if (STREQ (str, pat))
4800 if (strcmp (str, pat) == 0)
61794801 *str = '\0';
61804802 }
61814803 return str;
62404862 char *str = xstrdup (value);
62414863 setenv (name, str, 1);
62424864 #else
6243 size_t len = strlen (name) + 1 + strlen (value) + 1;
4865 int len = strlen (name) + 1 + strlen (value) + 1;
62444866 char *str = XMALLOC (char, len);
62454867 sprintf (str, "%s=%s", name, value);
62464868 if (putenv (str) != EXIT_SUCCESS)
62574879 char *new_value;
62584880 if (orig_value && *orig_value)
62594881 {
6260 size_t orig_value_len = strlen (orig_value);
6261 size_t add_len = strlen (add);
4882 int orig_value_len = strlen (orig_value);
4883 int add_len = strlen (add);
62624884 new_value = XMALLOC (char, add_len + orig_value_len + 1);
62634885 if (to_end)
62644886 {
62894911 {
62904912 char *new_value = lt_extend_str (getenv (name), value, 0);
62914913 /* some systems can't cope with a ':'-terminated path #' */
6292 size_t len = strlen (new_value);
6293 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4914 int len = strlen (new_value);
4915 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
62944916 {
6295 new_value[--len] = '\0';
4917 new_value[len-1] = '\0';
62964918 }
62974919 lt_setenv (name, new_value);
62984920 XFREE (new_value);
64595081 # True if ARG is an import lib, as indicated by $file_magic_cmd
64605082 func_win32_import_lib_p ()
64615083 {
6462 $debug_cmd
6463
5084 $opt_debug
64645085 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
64655086 *import*) : ;;
64665087 *) false ;;
64675088 esac
64685089 }
64695090
6470 # func_suncc_cstd_abi
6471 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6472 # Several compiler flags select an ABI that is incompatible with the
6473 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6474 func_suncc_cstd_abi ()
6475 {
6476 $debug_cmd
6477
6478 case " $compile_command " in
6479 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6480 suncc_use_cstd_abi=no
6481 ;;
6482 *)
6483 suncc_use_cstd_abi=yes
6484 ;;
6485 esac
6486 }
6487
64885091 # func_mode_link arg...
64895092 func_mode_link ()
64905093 {
6491 $debug_cmd
6492
5094 $opt_debug
64935095 case $host in
64945096 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
64955097 # It is impossible to link a dll without this setting, and
64965098 # we shouldn't force the makefile maintainer to figure out
6497 # what system we are compiling for in order to pass an extra
5099 # which system we are compiling for in order to pass an extra
64985100 # flag for every libtool invocation.
64995101 # allow_undefined=no
65005102
65015103 # FIXME: Unfortunately, there are problems with the above when trying
6502 # to make a dll that has undefined symbols, in which case not
5104 # to make a dll which has undefined symbols, in which case not
65035105 # even a static library is built. For now, we need to specify
65045106 # -no-undefined on the libtool link line when we can be certain
65055107 # that all symbols are satisfied, otherwise we get a static library.
65435145 module=no
65445146 no_install=no
65455147 objs=
6546 os2dllname=
65475148 non_pic_objects=
65485149 precious_files_regex=
65495150 prefer_static_libs=no
6550 preload=false
5151 preload=no
65515152 prev=
65525153 prevarg=
65535154 release=
65595160 vinfo=
65605161 vinfo_number=no
65615162 weak_libs=
6562 single_module=$wl-single_module
5163 single_module="${wl}-single_module"
65635164 func_infer_tag $base_compile
65645165
65655166 # We need to know -static, to get the right output filenames.
65675168 do
65685169 case $arg in
65695170 -shared)
6570 test yes != "$build_libtool_libs" \
6571 && func_fatal_configuration "cannot build a shared library"
5171 test "$build_libtool_libs" != yes && \
5172 func_fatal_configuration "can not build a shared library"
65725173 build_old_libs=no
65735174 break
65745175 ;;
65755176 -all-static | -static | -static-libtool-libs)
65765177 case $arg in
65775178 -all-static)
6578 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
5179 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
65795180 func_warning "complete static linking is impossible in this configuration"
65805181 fi
65815182 if test -n "$link_static_flag"; then
66085209
66095210 # Go through the arguments, transforming them on the way.
66105211 while test "$#" -gt 0; do
6611 arg=$1
5212 arg="$1"
66125213 shift
66135214 func_quote_for_eval "$arg"
66145215 qarg=$func_quote_for_eval_unquoted_result
66255226
66265227 case $prev in
66275228 bindir)
6628 bindir=$arg
5229 bindir="$arg"
66295230 prev=
66305231 continue
66315232 ;;
66325233 dlfiles|dlprefiles)
6633 $preload || {
5234 if test "$preload" = no; then
66345235 # Add the symbol object into the linking commands.
66355236 func_append compile_command " @SYMFILE@"
66365237 func_append finalize_command " @SYMFILE@"
6637 preload=:
6638 }
5238 preload=yes
5239 fi
66395240 case $arg in
66405241 *.la | *.lo) ;; # We handle these cases below.
66415242 force)
6642 if test no = "$dlself"; then
5243 if test "$dlself" = no; then
66435244 dlself=needless
66445245 export_dynamic=yes
66455246 fi
66475248 continue
66485249 ;;
66495250 self)
6650 if test dlprefiles = "$prev"; then
5251 if test "$prev" = dlprefiles; then
66515252 dlself=yes
6652 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
5253 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
66535254 dlself=yes
66545255 else
66555256 dlself=needless
66595260 continue
66605261 ;;
66615262 *)
6662 if test dlfiles = "$prev"; then
5263 if test "$prev" = dlfiles; then
66635264 func_append dlfiles " $arg"
66645265 else
66655266 func_append dlprefiles " $arg"
66705271 esac
66715272 ;;
66725273 expsyms)
6673 export_symbols=$arg
5274 export_symbols="$arg"
66745275 test -f "$arg" \
6675 || func_fatal_error "symbol file '$arg' does not exist"
5276 || func_fatal_error "symbol file \`$arg' does not exist"
66765277 prev=
66775278 continue
66785279 ;;
66795280 expsyms_regex)
6680 export_symbols_regex=$arg
5281 export_symbols_regex="$arg"
66815282 prev=
66825283 continue
66835284 ;;
66955296 continue
66965297 ;;
66975298 inst_prefix)
6698 inst_prefix_dir=$arg
6699 prev=
6700 continue
6701 ;;
6702 mllvm)
6703 # Clang does not use LLVM to link, so we can simply discard any
6704 # '-mllvm $arg' options when doing the link step.
5299 inst_prefix_dir="$arg"
67055300 prev=
67065301 continue
67075302 ;;
67255320
67265321 if test -z "$pic_object" ||
67275322 test -z "$non_pic_object" ||
6728 test none = "$pic_object" &&
6729 test none = "$non_pic_object"; then
6730 func_fatal_error "cannot find name of object for '$arg'"
5323 test "$pic_object" = none &&
5324 test "$non_pic_object" = none; then
5325 func_fatal_error "cannot find name of object for \`$arg'"
67315326 fi
67325327
67335328 # Extract subdirectory from the argument.
67345329 func_dirname "$arg" "/" ""
6735 xdir=$func_dirname_result
6736
6737 if test none != "$pic_object"; then
5330 xdir="$func_dirname_result"
5331
5332 if test "$pic_object" != none; then
67385333 # Prepend the subdirectory the object is found in.
6739 pic_object=$xdir$pic_object
6740
6741 if test dlfiles = "$prev"; then
6742 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
5334 pic_object="$xdir$pic_object"
5335
5336 if test "$prev" = dlfiles; then
5337 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
67435338 func_append dlfiles " $pic_object"
67445339 prev=
67455340 continue
67505345 fi
67515346
67525347 # CHECK ME: I think I busted this. -Ossama
6753 if test dlprefiles = "$prev"; then
5348 if test "$prev" = dlprefiles; then
67545349 # Preload the old-style object.
67555350 func_append dlprefiles " $pic_object"
67565351 prev=
67585353
67595354 # A PIC object.
67605355 func_append libobjs " $pic_object"
6761 arg=$pic_object
5356 arg="$pic_object"
67625357 fi
67635358
67645359 # Non-PIC object.
6765 if test none != "$non_pic_object"; then
5360 if test "$non_pic_object" != none; then
67665361 # Prepend the subdirectory the object is found in.
6767 non_pic_object=$xdir$non_pic_object
5362 non_pic_object="$xdir$non_pic_object"
67685363
67695364 # A standard non-PIC object
67705365 func_append non_pic_objects " $non_pic_object"
6771 if test -z "$pic_object" || test none = "$pic_object"; then
6772 arg=$non_pic_object
5366 if test -z "$pic_object" || test "$pic_object" = none ; then
5367 arg="$non_pic_object"
67735368 fi
67745369 else
67755370 # If the PIC object exists, use it instead.
67765371 # $xdir was prepended to $pic_object above.
6777 non_pic_object=$pic_object
5372 non_pic_object="$pic_object"
67785373 func_append non_pic_objects " $non_pic_object"
67795374 fi
67805375 else
67825377 if $opt_dry_run; then
67835378 # Extract subdirectory from the argument.
67845379 func_dirname "$arg" "/" ""
6785 xdir=$func_dirname_result
5380 xdir="$func_dirname_result"
67865381
67875382 func_lo2o "$arg"
67885383 pic_object=$xdir$objdir/$func_lo2o_result
67905385 func_append libobjs " $pic_object"
67915386 func_append non_pic_objects " $non_pic_object"
67925387 else
6793 func_fatal_error "'$arg' is not a valid libtool object"
5388 func_fatal_error "\`$arg' is not a valid libtool object"
67945389 fi
67955390 fi
67965391 done
67975392 else
6798 func_fatal_error "link input file '$arg' does not exist"
5393 func_fatal_error "link input file \`$arg' does not exist"
67995394 fi
68005395 arg=$save_arg
68015396 prev=
68025397 continue
68035398 ;;
6804 os2dllname)
6805 os2dllname=$arg
6806 prev=
6807 continue
6808 ;;
68095399 precious_regex)
6810 precious_files_regex=$arg
5400 precious_files_regex="$arg"
68115401 prev=
68125402 continue
68135403 ;;
68145404 release)
6815 release=-$arg
5405 release="-$arg"
68165406 prev=
68175407 continue
68185408 ;;
68245414 func_fatal_error "only absolute run-paths are allowed"
68255415 ;;
68265416 esac
6827 if test rpath = "$prev"; then
5417 if test "$prev" = rpath; then
68285418 case "$rpath " in
68295419 *" $arg "*) ;;
68305420 *) func_append rpath " $arg" ;;
68395429 continue
68405430 ;;
68415431 shrext)
6842 shrext_cmds=$arg
5432 shrext_cmds="$arg"
68435433 prev=
68445434 continue
68455435 ;;
68795469 esac
68805470 fi # test -n "$prev"
68815471
6882 prevarg=$arg
5472 prevarg="$arg"
68835473
68845474 case $arg in
68855475 -all-static)
68935483
68945484 -allow-undefined)
68955485 # FIXME: remove this flag sometime in the future.
6896 func_fatal_error "'-allow-undefined' must not be used because it is the default"
5486 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
68975487 ;;
68985488
68995489 -avoid-version)
69255515 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
69265516 func_fatal_error "more than one -exported-symbols argument is not allowed"
69275517 fi
6928 if test X-export-symbols = "X$arg"; then
5518 if test "X$arg" = "X-export-symbols"; then
69295519 prev=expsyms
69305520 else
69315521 prev=expsyms_regex
69595549 func_stripname "-L" '' "$arg"
69605550 if test -z "$func_stripname_result"; then
69615551 if test "$#" -gt 0; then
6962 func_fatal_error "require no space between '-L' and '$1'"
5552 func_fatal_error "require no space between \`-L' and \`$1'"
69635553 else
6964 func_fatal_error "need path for '-L' option"
5554 func_fatal_error "need path for \`-L' option"
69655555 fi
69665556 fi
69675557 func_resolve_sysroot "$func_stripname_result"
69725562 *)
69735563 absdir=`cd "$dir" && pwd`
69745564 test -z "$absdir" && \
6975 func_fatal_error "cannot determine absolute directory name of '$dir'"
6976 dir=$absdir
5565 func_fatal_error "cannot determine absolute directory name of \`$dir'"
5566 dir="$absdir"
69775567 ;;
69785568 esac
69795569 case "$deplibs " in
70085598 ;;
70095599
70105600 -l*)
7011 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
5601 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
70125602 case $host in
70135603 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
70145604 # These systems don't actually have a C or math library (as such)
70165606 ;;
70175607 *-*-os2*)
70185608 # These systems don't actually have a C library (as such)
7019 test X-lc = "X$arg" && continue
5609 test "X$arg" = "X-lc" && continue
70205610 ;;
7021 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
5611 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
70225612 # Do not include libc due to us having libc/libc_r.
7023 test X-lc = "X$arg" && continue
5613 test "X$arg" = "X-lc" && continue
70245614 ;;
70255615 *-*-rhapsody* | *-*-darwin1.[012])
70265616 # Rhapsody C and math libraries are in the System framework
70295619 ;;
70305620 *-*-sco3.2v5* | *-*-sco5v6*)
70315621 # Causes problems with __ctype
7032 test X-lc = "X$arg" && continue
5622 test "X$arg" = "X-lc" && continue
70335623 ;;
70345624 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
70355625 # Compiler inserts libc in the correct place for threads to work
7036 test X-lc = "X$arg" && continue
5626 test "X$arg" = "X-lc" && continue
70375627 ;;
70385628 esac
7039 elif test X-lc_r = "X$arg"; then
5629 elif test "X$arg" = "X-lc_r"; then
70405630 case $host in
7041 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
5631 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
70425632 # Do not include libc_r directly, use -pthread flag.
70435633 continue
70445634 ;;
70455635 esac
70465636 fi
70475637 func_append deplibs " $arg"
7048 continue
7049 ;;
7050
7051 -mllvm)
7052 prev=mllvm
70535638 continue
70545639 ;;
70555640
70825667 ;;
70835668
70845669 -multi_module)
7085 single_module=$wl-multi_module
5670 single_module="${wl}-multi_module"
70865671 continue
70875672 ;;
70885673
70965681 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
70975682 # The PATH hackery in wrapper scripts is required on Windows
70985683 # and Darwin in order for the loader to find any dlls it needs.
7099 func_warning "'-no-install' is ignored for $host"
7100 func_warning "assuming '-no-fast-install' instead"
5684 func_warning "\`-no-install' is ignored for $host"
5685 func_warning "assuming \`-no-fast-install' instead"
71015686 fast_install=no
71025687 ;;
71035688 *) no_install=yes ;;
71125697
71135698 -objectlist)
71145699 prev=objectlist
7115 continue
7116 ;;
7117
7118 -os2dllname)
7119 prev=os2dllname
71205700 continue
71215701 ;;
71225702
72075787 func_stripname '-Wc,' '' "$arg"
72085788 args=$func_stripname_result
72095789 arg=
7210 save_ifs=$IFS; IFS=,
5790 save_ifs="$IFS"; IFS=','
72115791 for flag in $args; do
7212 IFS=$save_ifs
5792 IFS="$save_ifs"
72135793 func_quote_for_eval "$flag"
72145794 func_append arg " $func_quote_for_eval_result"
72155795 func_append compiler_flags " $func_quote_for_eval_result"
72165796 done
7217 IFS=$save_ifs
5797 IFS="$save_ifs"
72185798 func_stripname ' ' '' "$arg"
72195799 arg=$func_stripname_result
72205800 ;;
72235803 func_stripname '-Wl,' '' "$arg"
72245804 args=$func_stripname_result
72255805 arg=
7226 save_ifs=$IFS; IFS=,
5806 save_ifs="$IFS"; IFS=','
72275807 for flag in $args; do
7228 IFS=$save_ifs
5808 IFS="$save_ifs"
72295809 func_quote_for_eval "$flag"
72305810 func_append arg " $wl$func_quote_for_eval_result"
72315811 func_append compiler_flags " $wl$func_quote_for_eval_result"
72325812 func_append linker_flags " $func_quote_for_eval_result"
72335813 done
7234 IFS=$save_ifs
5814 IFS="$save_ifs"
72355815 func_stripname ' ' '' "$arg"
72365816 arg=$func_stripname_result
72375817 ;;
72545834 # -msg_* for osf cc
72555835 -msg_*)
72565836 func_quote_for_eval "$arg"
7257 arg=$func_quote_for_eval_result
5837 arg="$func_quote_for_eval_result"
72585838 ;;
72595839
72605840 # Flags to be passed through unchanged, with rationale:
72665846 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
72675847 # -F/path path to uninstalled frameworks, gcc on darwin
72685848 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7269 # -fstack-protector* stack protector flags for GCC
72705849 # @file GCC response files
72715850 # -tp=* Portland pgcc target processor selection
72725851 # --sysroot=* for sysroot support
7273 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7274 # -specs=* GCC specs files
7275 # -stdlib=* select c++ std lib with clang
7276 # -fsanitize=* Clang/GCC memory and address sanitizer
5852 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
72775853 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
72785854 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7279 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7280 -specs=*|-fsanitize=*)
5855 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
72815856 func_quote_for_eval "$arg"
7282 arg=$func_quote_for_eval_result
5857 arg="$func_quote_for_eval_result"
72835858 func_append compile_command " $arg"
72845859 func_append finalize_command " $arg"
72855860 func_append compiler_flags " $arg"
72865861 continue
72875862 ;;
72885863
7289 -Z*)
7290 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7291 # OS/2 uses -Zxxx to specify OS/2-specific options
7292 compiler_flags="$compiler_flags $arg"
7293 func_append compile_command " $arg"
7294 func_append finalize_command " $arg"
7295 case $arg in
7296 -Zlinker | -Zstack)
7297 prev=xcompiler
7298 ;;
7299 esac
7300 continue
7301 else
7302 # Otherwise treat like 'Some other compiler flag' below
7303 func_quote_for_eval "$arg"
7304 arg=$func_quote_for_eval_result
7305 fi
7306 ;;
7307
73085864 # Some other compiler flag.
73095865 -* | +*)
73105866 func_quote_for_eval "$arg"
7311 arg=$func_quote_for_eval_result
5867 arg="$func_quote_for_eval_result"
73125868 ;;
73135869
73145870 *.$objext)
73295885
73305886 if test -z "$pic_object" ||
73315887 test -z "$non_pic_object" ||
7332 test none = "$pic_object" &&
7333 test none = "$non_pic_object"; then
7334 func_fatal_error "cannot find name of object for '$arg'"
5888 test "$pic_object" = none &&
5889 test "$non_pic_object" = none; then
5890 func_fatal_error "cannot find name of object for \`$arg'"
73355891 fi
73365892
73375893 # Extract subdirectory from the argument.
73385894 func_dirname "$arg" "/" ""
7339 xdir=$func_dirname_result
7340
7341 test none = "$pic_object" || {
5895 xdir="$func_dirname_result"
5896
5897 if test "$pic_object" != none; then
73425898 # Prepend the subdirectory the object is found in.
7343 pic_object=$xdir$pic_object
7344
7345 if test dlfiles = "$prev"; then
7346 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
5899 pic_object="$xdir$pic_object"
5900
5901 if test "$prev" = dlfiles; then
5902 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
73475903 func_append dlfiles " $pic_object"
73485904 prev=
73495905 continue
73545910 fi
73555911
73565912 # CHECK ME: I think I busted this. -Ossama
7357 if test dlprefiles = "$prev"; then
5913 if test "$prev" = dlprefiles; then
73585914 # Preload the old-style object.
73595915 func_append dlprefiles " $pic_object"
73605916 prev=
73625918
73635919 # A PIC object.
73645920 func_append libobjs " $pic_object"
7365 arg=$pic_object
7366 }
5921 arg="$pic_object"
5922 fi
73675923
73685924 # Non-PIC object.
7369 if test none != "$non_pic_object"; then
5925 if test "$non_pic_object" != none; then
73705926 # Prepend the subdirectory the object is found in.
7371 non_pic_object=$xdir$non_pic_object
5927 non_pic_object="$xdir$non_pic_object"
73725928
73735929 # A standard non-PIC object
73745930 func_append non_pic_objects " $non_pic_object"
7375 if test -z "$pic_object" || test none = "$pic_object"; then
7376 arg=$non_pic_object
5931 if test -z "$pic_object" || test "$pic_object" = none ; then
5932 arg="$non_pic_object"
73775933 fi
73785934 else
73795935 # If the PIC object exists, use it instead.
73805936 # $xdir was prepended to $pic_object above.
7381 non_pic_object=$pic_object
5937 non_pic_object="$pic_object"
73825938 func_append non_pic_objects " $non_pic_object"
73835939 fi
73845940 else
73865942 if $opt_dry_run; then
73875943 # Extract subdirectory from the argument.
73885944 func_dirname "$arg" "/" ""
7389 xdir=$func_dirname_result
5945 xdir="$func_dirname_result"
73905946
73915947 func_lo2o "$arg"
73925948 pic_object=$xdir$objdir/$func_lo2o_result
73945950 func_append libobjs " $pic_object"
73955951 func_append non_pic_objects " $non_pic_object"
73965952 else
7397 func_fatal_error "'$arg' is not a valid libtool object"
5953 func_fatal_error "\`$arg' is not a valid libtool object"
73985954 fi
73995955 fi
74005956 ;;
74105966 # A libtool-controlled library.
74115967
74125968 func_resolve_sysroot "$arg"
7413 if test dlfiles = "$prev"; then
5969 if test "$prev" = dlfiles; then
74145970 # This library was specified with -dlopen.
74155971 func_append dlfiles " $func_resolve_sysroot_result"
74165972 prev=
7417 elif test dlprefiles = "$prev"; then
5973 elif test "$prev" = dlprefiles; then
74185974 # The library was specified with -dlpreopen.
74195975 func_append dlprefiles " $func_resolve_sysroot_result"
74205976 prev=
74295985 # Unknown arguments in both finalize_command and compile_command need
74305986 # to be aesthetically quoted because they are evaled later.
74315987 func_quote_for_eval "$arg"
7432 arg=$func_quote_for_eval_result
5988 arg="$func_quote_for_eval_result"
74335989 ;;
74345990 esac # arg
74355991
74415997 done # argument parsing loop
74425998
74435999 test -n "$prev" && \
7444 func_fatal_help "the '$prevarg' option requires an argument"
7445
7446 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
6000 func_fatal_help "the \`$prevarg' option requires an argument"
6001
6002 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
74476003 eval arg=\"$export_dynamic_flag_spec\"
74486004 func_append compile_command " $arg"
74496005 func_append finalize_command " $arg"
74526008 oldlibs=
74536009 # calculate the name of the file, without its directory
74546010 func_basename "$output"
7455 outputname=$func_basename_result
7456 libobjs_save=$libobjs
6011 outputname="$func_basename_result"
6012 libobjs_save="$libobjs"
74576013
74586014 if test -n "$shlibpath_var"; then
74596015 # get the directories listed in $shlibpath_var
7460 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
6016 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
74616017 else
74626018 shlib_search_path=
74636019 fi
74646020 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
74656021 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
74666022
7467 # Definition is injected by LT_CONFIG during libtool generation.
7468 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7469
74706023 func_dirname "$output" "/" ""
7471 output_objdir=$func_dirname_result$objdir
6024 output_objdir="$func_dirname_result$objdir"
74726025 func_to_tool_file "$output_objdir/"
74736026 tool_output_objdir=$func_to_tool_file_result
74746027 # Create the object directory.
74916044 # Find all interdependent deplibs by searching for libraries
74926045 # that are linked more than once (e.g. -la -lb -la)
74936046 for deplib in $deplibs; do
7494 if $opt_preserve_dup_deps; then
6047 if $opt_preserve_dup_deps ; then
74956048 case "$libs " in
74966049 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
74976050 esac
74996052 func_append libs " $deplib"
75006053 done
75016054
7502 if test lib = "$linkmode"; then
6055 if test "$linkmode" = lib; then
75036056 libs="$predeps $libs $compiler_lib_search_path $postdeps"
75046057
75056058 # Compute libraries that are listed more than once in $predeps
75316084 case $file in
75326085 *.la) ;;
75336086 *)
7534 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
6087 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
75356088 ;;
75366089 esac
75376090 done
75396092 prog)
75406093 compile_deplibs=
75416094 finalize_deplibs=
7542 alldeplibs=false
6095 alldeplibs=no
75436096 newdlfiles=
75446097 newdlprefiles=
75456098 passes="conv scan dlopen dlpreopen link"
75516104 for pass in $passes; do
75526105 # The preopen pass in lib mode reverses $deplibs; put it back here
75536106 # so that -L comes before libs that need it for instance...
7554 if test lib,link = "$linkmode,$pass"; then
6107 if test "$linkmode,$pass" = "lib,link"; then
75556108 ## FIXME: Find the place where the list is rebuilt in the wrong
75566109 ## order, and fix it there properly
75576110 tmp_deplibs=
75586111 for deplib in $deplibs; do
75596112 tmp_deplibs="$deplib $tmp_deplibs"
75606113 done
7561 deplibs=$tmp_deplibs
6114 deplibs="$tmp_deplibs"
75626115 fi
75636116
7564 if test lib,link = "$linkmode,$pass" ||
7565 test prog,scan = "$linkmode,$pass"; then
7566 libs=$deplibs
6117 if test "$linkmode,$pass" = "lib,link" ||
6118 test "$linkmode,$pass" = "prog,scan"; then
6119 libs="$deplibs"
75676120 deplibs=
75686121 fi
7569 if test prog = "$linkmode"; then
6122 if test "$linkmode" = prog; then
75706123 case $pass in
7571 dlopen) libs=$dlfiles ;;
7572 dlpreopen) libs=$dlprefiles ;;
6124 dlopen) libs="$dlfiles" ;;
6125 dlpreopen) libs="$dlprefiles" ;;
75736126 link)
75746127 libs="$deplibs %DEPLIBS%"
75756128 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
75766129 ;;
75776130 esac
75786131 fi
7579 if test lib,dlpreopen = "$linkmode,$pass"; then
6132 if test "$linkmode,$pass" = "lib,dlpreopen"; then
75806133 # Collect and forward deplibs of preopened libtool libs
75816134 for lib in $dlprefiles; do
75826135 # Ignore non-libtool-libs
75976150 esac
75986151 done
75996152 done
7600 libs=$dlprefiles
6153 libs="$dlprefiles"
76016154 fi
7602 if test dlopen = "$pass"; then
6155 if test "$pass" = dlopen; then
76036156 # Collect dlpreopened libraries
7604 save_deplibs=$deplibs
6157 save_deplibs="$deplibs"
76056158 deplibs=
76066159 fi
76076160
76086161 for deplib in $libs; do
76096162 lib=
7610 found=false
6163 found=no
76116164 case $deplib in
76126165 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
76136166 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7614 if test prog,link = "$linkmode,$pass"; then
6167 if test "$linkmode,$pass" = "prog,link"; then
76156168 compile_deplibs="$deplib $compile_deplibs"
76166169 finalize_deplibs="$deplib $finalize_deplibs"
76176170 else
76186171 func_append compiler_flags " $deplib"
7619 if test lib = "$linkmode"; then
6172 if test "$linkmode" = lib ; then
76206173 case "$new_inherited_linker_flags " in
76216174 *" $deplib "*) ;;
76226175 * ) func_append new_inherited_linker_flags " $deplib" ;;
76266179 continue
76276180 ;;
76286181 -l*)
7629 if test lib != "$linkmode" && test prog != "$linkmode"; then
7630 func_warning "'-l' is ignored for archives/objects"
6182 if test "$linkmode" != lib && test "$linkmode" != prog; then
6183 func_warning "\`-l' is ignored for archives/objects"
76316184 continue
76326185 fi
76336186 func_stripname '-l' '' "$deplib"
76346187 name=$func_stripname_result
7635 if test lib = "$linkmode"; then
6188 if test "$linkmode" = lib; then
76366189 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
76376190 else
76386191 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
76406193 for searchdir in $searchdirs; do
76416194 for search_ext in .la $std_shrext .so .a; do
76426195 # Search the libtool library
7643 lib=$searchdir/lib$name$search_ext
6196 lib="$searchdir/lib${name}${search_ext}"
76446197 if test -f "$lib"; then
7645 if test .la = "$search_ext"; then
7646 found=:
6198 if test "$search_ext" = ".la"; then
6199 found=yes
76476200 else
7648 found=false
6201 found=no
76496202 fi
76506203 break 2
76516204 fi
76526205 done
76536206 done
7654 if $found; then
7655 # deplib is a libtool library
6207 if test "$found" != yes; then
6208 # deplib doesn't seem to be a libtool library
6209 if test "$linkmode,$pass" = "prog,link"; then
6210 compile_deplibs="$deplib $compile_deplibs"
6211 finalize_deplibs="$deplib $finalize_deplibs"
6212 else
6213 deplibs="$deplib $deplibs"
6214 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6215 fi
6216 continue
6217 else # deplib is a libtool library
76566218 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
76576219 # We need to do some special things here, and not later.
7658 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
6220 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
76596221 case " $predeps $postdeps " in
76606222 *" $deplib "*)
76616223 if func_lalib_p "$lib"; then
76636225 old_library=
76646226 func_source "$lib"
76656227 for l in $old_library $library_names; do
7666 ll=$l
6228 ll="$l"
76676229 done
7668 if test "X$ll" = "X$old_library"; then # only static version available
7669 found=false
6230 if test "X$ll" = "X$old_library" ; then # only static version available
6231 found=no
76706232 func_dirname "$lib" "" "."
7671 ladir=$func_dirname_result
6233 ladir="$func_dirname_result"
76726234 lib=$ladir/$old_library
7673 if test prog,link = "$linkmode,$pass"; then
6235 if test "$linkmode,$pass" = "prog,link"; then
76746236 compile_deplibs="$deplib $compile_deplibs"
76756237 finalize_deplibs="$deplib $finalize_deplibs"
76766238 else
76776239 deplibs="$deplib $deplibs"
7678 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
6240 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
76796241 fi
76806242 continue
76816243 fi
76846246 *) ;;
76856247 esac
76866248 fi
7687 else
7688 # deplib doesn't seem to be a libtool library
7689 if test prog,link = "$linkmode,$pass"; then
7690 compile_deplibs="$deplib $compile_deplibs"
7691 finalize_deplibs="$deplib $finalize_deplibs"
7692 else
7693 deplibs="$deplib $deplibs"
7694 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7695 fi
7696 continue
76976249 fi
76986250 ;; # -l
76996251 *.ltframework)
7700 if test prog,link = "$linkmode,$pass"; then
6252 if test "$linkmode,$pass" = "prog,link"; then
77016253 compile_deplibs="$deplib $compile_deplibs"
77026254 finalize_deplibs="$deplib $finalize_deplibs"
77036255 else
77046256 deplibs="$deplib $deplibs"
7705 if test lib = "$linkmode"; then
6257 if test "$linkmode" = lib ; then
77066258 case "$new_inherited_linker_flags " in
77076259 *" $deplib "*) ;;
77086260 * ) func_append new_inherited_linker_flags " $deplib" ;;
77156267 case $linkmode in
77166268 lib)
77176269 deplibs="$deplib $deplibs"
7718 test conv = "$pass" && continue
6270 test "$pass" = conv && continue
77196271 newdependency_libs="$deplib $newdependency_libs"
77206272 func_stripname '-L' '' "$deplib"
77216273 func_resolve_sysroot "$func_stripname_result"
77226274 func_append newlib_search_path " $func_resolve_sysroot_result"
77236275 ;;
77246276 prog)
7725 if test conv = "$pass"; then
6277 if test "$pass" = conv; then
77266278 deplibs="$deplib $deplibs"
77276279 continue
77286280 fi
7729 if test scan = "$pass"; then
6281 if test "$pass" = scan; then
77306282 deplibs="$deplib $deplibs"
77316283 else
77326284 compile_deplibs="$deplib $compile_deplibs"
77376289 func_append newlib_search_path " $func_resolve_sysroot_result"
77386290 ;;
77396291 *)
7740 func_warning "'-L' is ignored for archives/objects"
6292 func_warning "\`-L' is ignored for archives/objects"
77416293 ;;
77426294 esac # linkmode
77436295 continue
77446296 ;; # -L
77456297 -R*)
7746 if test link = "$pass"; then
6298 if test "$pass" = link; then
77476299 func_stripname '-R' '' "$deplib"
77486300 func_resolve_sysroot "$func_stripname_result"
77496301 dir=$func_resolve_sysroot_result
77616313 lib=$func_resolve_sysroot_result
77626314 ;;
77636315 *.$libext)
7764 if test conv = "$pass"; then
6316 if test "$pass" = conv; then
77656317 deplibs="$deplib $deplibs"
77666318 continue
77676319 fi
77726324 case " $dlpreconveniencelibs " in
77736325 *" $deplib "*) ;;
77746326 *)
7775 valid_a_lib=false
6327 valid_a_lib=no
77766328 case $deplibs_check_method in
77776329 match_pattern*)
77786330 set dummy $deplibs_check_method; shift
77796331 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
77806332 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
77816333 | $EGREP "$match_pattern_regex" > /dev/null; then
7782 valid_a_lib=:
6334 valid_a_lib=yes
77836335 fi
77846336 ;;
77856337 pass_all)
7786 valid_a_lib=:
6338 valid_a_lib=yes
77876339 ;;
77886340 esac
7789 if $valid_a_lib; then
7790 echo
7791 $ECHO "*** Warning: Linking the shared library $output against the"
7792 $ECHO "*** static library $deplib is not portable!"
7793 deplibs="$deplib $deplibs"
7794 else
6341 if test "$valid_a_lib" != yes; then
77956342 echo
77966343 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
77976344 echo "*** I have the capability to make that library automatically link in when"
77996346 echo "*** shared version of the library, which you do not appear to have"
78006347 echo "*** because the file extensions .$libext of this argument makes me believe"
78016348 echo "*** that it is just a static archive that I should not use here."
6349 else
6350 echo
6351 $ECHO "*** Warning: Linking the shared library $output against the"
6352 $ECHO "*** static library $deplib is not portable!"
6353 deplibs="$deplib $deplibs"
78026354 fi
78036355 ;;
78046356 esac
78056357 continue
78066358 ;;
78076359 prog)
7808 if test link != "$pass"; then
6360 if test "$pass" != link; then
78096361 deplibs="$deplib $deplibs"
78106362 else
78116363 compile_deplibs="$deplib $compile_deplibs"
78166368 esac # linkmode
78176369 ;; # *.$libext
78186370 *.lo | *.$objext)
7819 if test conv = "$pass"; then
6371 if test "$pass" = conv; then
78206372 deplibs="$deplib $deplibs"
7821 elif test prog = "$linkmode"; then
7822 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
6373 elif test "$linkmode" = prog; then
6374 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
78236375 # If there is no dlopen support or we're linking statically,
78246376 # we need to preload.
78256377 func_append newdlprefiles " $deplib"
78326384 continue
78336385 ;;
78346386 %DEPLIBS%)
7835 alldeplibs=:
6387 alldeplibs=yes
78366388 continue
78376389 ;;
78386390 esac # case $deplib
78396391
7840 $found || test -f "$lib" \
7841 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
6392 if test "$found" = yes || test -f "$lib"; then :
6393 else
6394 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6395 fi
78426396
78436397 # Check to see that this really is a libtool archive.
78446398 func_lalib_unsafe_p "$lib" \
7845 || func_fatal_error "'$lib' is not a valid libtool archive"
6399 || func_fatal_error "\`$lib' is not a valid libtool archive"
78466400
78476401 func_dirname "$lib" "" "."
7848 ladir=$func_dirname_result
6402 ladir="$func_dirname_result"
78496403
78506404 dlname=
78516405 dlopen=
78756429 done
78766430 fi
78776431 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7878 if test lib,link = "$linkmode,$pass" ||
7879 test prog,scan = "$linkmode,$pass" ||
7880 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
6432 if test "$linkmode,$pass" = "lib,link" ||
6433 test "$linkmode,$pass" = "prog,scan" ||
6434 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
78816435 test -n "$dlopen" && func_append dlfiles " $dlopen"
78826436 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
78836437 fi
78846438
7885 if test conv = "$pass"; then
6439 if test "$pass" = conv; then
78866440 # Only check for convenience libraries
78876441 deplibs="$lib $deplibs"
78886442 if test -z "$libdir"; then
78896443 if test -z "$old_library"; then
7890 func_fatal_error "cannot find name of link library for '$lib'"
6444 func_fatal_error "cannot find name of link library for \`$lib'"
78916445 fi
78926446 # It is a libtool convenience library, so add in its objects.
78936447 func_append convenience " $ladir/$objdir/$old_library"
78956449 tmp_libs=
78966450 for deplib in $dependency_libs; do
78976451 deplibs="$deplib $deplibs"
7898 if $opt_preserve_dup_deps; then
6452 if $opt_preserve_dup_deps ; then
78996453 case "$tmp_libs " in
79006454 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
79016455 esac
79026456 fi
79036457 func_append tmp_libs " $deplib"
79046458 done
7905 elif test prog != "$linkmode" && test lib != "$linkmode"; then
7906 func_fatal_error "'$lib' is not a convenience library"
6459 elif test "$linkmode" != prog && test "$linkmode" != lib; then
6460 func_fatal_error "\`$lib' is not a convenience library"
79076461 fi
79086462 continue
79096463 fi # $pass = conv
79126466 # Get the name of the library we link against.
79136467 linklib=
79146468 if test -n "$old_library" &&
7915 { test yes = "$prefer_static_libs" ||
7916 test built,no = "$prefer_static_libs,$installed"; }; then
6469 { test "$prefer_static_libs" = yes ||
6470 test "$prefer_static_libs,$installed" = "built,no"; }; then
79176471 linklib=$old_library
79186472 else
79196473 for l in $old_library $library_names; do
7920 linklib=$l
6474 linklib="$l"
79216475 done
79226476 fi
79236477 if test -z "$linklib"; then
7924 func_fatal_error "cannot find name of link library for '$lib'"
6478 func_fatal_error "cannot find name of link library for \`$lib'"
79256479 fi
79266480
79276481 # This library was specified with -dlopen.
7928 if test dlopen = "$pass"; then
7929 test -z "$libdir" \
7930 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
6482 if test "$pass" = dlopen; then
6483 if test -z "$libdir"; then
6484 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6485 fi
79316486 if test -z "$dlname" ||
7932 test yes != "$dlopen_support" ||
7933 test no = "$build_libtool_libs"
7934 then
6487 test "$dlopen_support" != yes ||
6488 test "$build_libtool_libs" = no; then
79356489 # If there is no dlname, no dlopen support or we're linking
79366490 # statically, we need to preload. We also need to preload any
79376491 # dependent libraries so libltdl's deplib preloader doesn't
79456499
79466500 # We need an absolute path.
79476501 case $ladir in
7948 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
6502 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
79496503 *)
79506504 abs_ladir=`cd "$ladir" && pwd`
79516505 if test -z "$abs_ladir"; then
7952 func_warning "cannot determine absolute directory name of '$ladir'"
6506 func_warning "cannot determine absolute directory name of \`$ladir'"
79536507 func_warning "passing it literally to the linker, although it might fail"
7954 abs_ladir=$ladir
6508 abs_ladir="$ladir"
79556509 fi
79566510 ;;
79576511 esac
79586512 func_basename "$lib"
7959 laname=$func_basename_result
6513 laname="$func_basename_result"
79606514
79616515 # Find the relevant object directory and library name.
7962 if test yes = "$installed"; then
6516 if test "X$installed" = Xyes; then
79636517 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
7964 func_warning "library '$lib' was moved."
7965 dir=$ladir
7966 absdir=$abs_ladir
7967 libdir=$abs_ladir
6518 func_warning "library \`$lib' was moved."
6519 dir="$ladir"
6520 absdir="$abs_ladir"
6521 libdir="$abs_ladir"
79686522 else
7969 dir=$lt_sysroot$libdir
7970 absdir=$lt_sysroot$libdir
6523 dir="$lt_sysroot$libdir"
6524 absdir="$lt_sysroot$libdir"
79716525 fi
7972 test yes = "$hardcode_automatic" && avoidtemprpath=yes
6526 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
79736527 else
79746528 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
7975 dir=$ladir
7976 absdir=$abs_ladir
6529 dir="$ladir"
6530 absdir="$abs_ladir"
79776531 # Remove this search path later
79786532 func_append notinst_path " $abs_ladir"
79796533 else
7980 dir=$ladir/$objdir
7981 absdir=$abs_ladir/$objdir
6534 dir="$ladir/$objdir"
6535 absdir="$abs_ladir/$objdir"
79826536 # Remove this search path later
79836537 func_append notinst_path " $abs_ladir"
79846538 fi
79876541 name=$func_stripname_result
79886542
79896543 # This library was specified with -dlpreopen.
7990 if test dlpreopen = "$pass"; then
7991 if test -z "$libdir" && test prog = "$linkmode"; then
7992 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
6544 if test "$pass" = dlpreopen; then
6545 if test -z "$libdir" && test "$linkmode" = prog; then
6546 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
79936547 fi
7994 case $host in
6548 case "$host" in
79956549 # special handling for platforms with PE-DLLs.
79966550 *cygwin* | *mingw* | *cegcc* )
79976551 # Linker will automatically link against shared library if both
80356589
80366590 if test -z "$libdir"; then
80376591 # Link the convenience library
8038 if test lib = "$linkmode"; then
6592 if test "$linkmode" = lib; then
80396593 deplibs="$dir/$old_library $deplibs"
8040 elif test prog,link = "$linkmode,$pass"; then
6594 elif test "$linkmode,$pass" = "prog,link"; then
80416595 compile_deplibs="$dir/$old_library $compile_deplibs"
80426596 finalize_deplibs="$dir/$old_library $finalize_deplibs"
80436597 else
80476601 fi
80486602
80496603
8050 if test prog = "$linkmode" && test link != "$pass"; then
6604 if test "$linkmode" = prog && test "$pass" != link; then
80516605 func_append newlib_search_path " $ladir"
80526606 deplibs="$lib $deplibs"
80536607
8054 linkalldeplibs=false
8055 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8056 test no = "$build_libtool_libs"; then
8057 linkalldeplibs=:
6608 linkalldeplibs=no
6609 if test "$link_all_deplibs" != no || test -z "$library_names" ||
6610 test "$build_libtool_libs" = no; then
6611 linkalldeplibs=yes
80586612 fi
80596613
80606614 tmp_libs=
80666620 ;;
80676621 esac
80686622 # Need to link against all dependency_libs?
8069 if $linkalldeplibs; then
6623 if test "$linkalldeplibs" = yes; then
80706624 deplibs="$deplib $deplibs"
80716625 else
80726626 # Need to hardcode shared library paths
80736627 # or/and link against static libraries
80746628 newdependency_libs="$deplib $newdependency_libs"
80756629 fi
8076 if $opt_preserve_dup_deps; then
6630 if $opt_preserve_dup_deps ; then
80776631 case "$tmp_libs " in
80786632 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
80796633 esac
80836637 continue
80846638 fi # $linkmode = prog...
80856639
8086 if test prog,link = "$linkmode,$pass"; then
6640 if test "$linkmode,$pass" = "prog,link"; then
80876641 if test -n "$library_names" &&
8088 { { test no = "$prefer_static_libs" ||
8089 test built,yes = "$prefer_static_libs,$installed"; } ||
6642 { { test "$prefer_static_libs" = no ||
6643 test "$prefer_static_libs,$installed" = "built,yes"; } ||
80906644 test -z "$old_library"; }; then
80916645 # We need to hardcode the library path
8092 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
6646 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
80936647 # Make sure the rpath contains only unique directories.
8094 case $temp_rpath: in
6648 case "$temp_rpath:" in
80956649 *"$absdir:"*) ;;
80966650 *) func_append temp_rpath "$absdir:" ;;
80976651 esac
81206674 esac
81216675 fi # $linkmode,$pass = prog,link...
81226676
8123 if $alldeplibs &&
8124 { test pass_all = "$deplibs_check_method" ||
8125 { test yes = "$build_libtool_libs" &&
6677 if test "$alldeplibs" = yes &&
6678 { test "$deplibs_check_method" = pass_all ||
6679 { test "$build_libtool_libs" = yes &&
81266680 test -n "$library_names"; }; }; then
81276681 # We only need to search for static libraries
81286682 continue
81316685
81326686 link_static=no # Whether the deplib will be linked statically
81336687 use_static_libs=$prefer_static_libs
8134 if test built = "$use_static_libs" && test yes = "$installed"; then
6688 if test "$use_static_libs" = built && test "$installed" = yes; then
81356689 use_static_libs=no
81366690 fi
81376691 if test -n "$library_names" &&
8138 { test no = "$use_static_libs" || test -z "$old_library"; }; then
6692 { test "$use_static_libs" = no || test -z "$old_library"; }; then
81396693 case $host in
8140 *cygwin* | *mingw* | *cegcc* | *os2*)
6694 *cygwin* | *mingw* | *cegcc*)
81416695 # No point in relinking DLLs because paths are not encoded
81426696 func_append notinst_deplibs " $lib"
81436697 need_relink=no
81446698 ;;
81456699 *)
8146 if test no = "$installed"; then
6700 if test "$installed" = no; then
81476701 func_append notinst_deplibs " $lib"
81486702 need_relink=yes
81496703 fi
81536707
81546708 # Warn about portability, can't link against -module's on some
81556709 # systems (darwin). Don't bleat about dlopened modules though!
8156 dlopenmodule=
6710 dlopenmodule=""
81576711 for dlpremoduletest in $dlprefiles; do
81586712 if test "X$dlpremoduletest" = "X$lib"; then
8159 dlopenmodule=$dlpremoduletest
6713 dlopenmodule="$dlpremoduletest"
81606714 break
81616715 fi
81626716 done
8163 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
6717 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
81646718 echo
8165 if test prog = "$linkmode"; then
6719 if test "$linkmode" = prog; then
81666720 $ECHO "*** Warning: Linking the executable $output against the loadable module"
81676721 else
81686722 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
81696723 fi
81706724 $ECHO "*** $linklib is not portable!"
81716725 fi
8172 if test lib = "$linkmode" &&
8173 test yes = "$hardcode_into_libs"; then
6726 if test "$linkmode" = lib &&
6727 test "$hardcode_into_libs" = yes; then
81746728 # Hardcode the library path.
81756729 # Skip directories that are in the system default run-time
81766730 # search path.
81986752 # figure out the soname
81996753 set dummy $library_names
82006754 shift
8201 realname=$1
6755 realname="$1"
82026756 shift
82036757 libname=`eval "\\$ECHO \"$libname_spec\""`
82046758 # use dlname if we got it. it's perfectly good, no?
82056759 if test -n "$dlname"; then
8206 soname=$dlname
6760 soname="$dlname"
82076761 elif test -n "$soname_spec"; then
82086762 # bleh windows
82096763 case $host in
8210 *cygwin* | mingw* | *cegcc* | *os2*)
6764 *cygwin* | mingw* | *cegcc*)
82116765 func_arith $current - $age
82126766 major=$func_arith_result
8213 versuffix=-$major
6767 versuffix="-$major"
82146768 ;;
82156769 esac
82166770 eval soname=\"$soname_spec\"
82176771 else
8218 soname=$realname
6772 soname="$realname"
82196773 fi
82206774
82216775 # Make a new name for the extract_expsyms_cmds to use
8222 soroot=$soname
6776 soroot="$soname"
82236777 func_basename "$soroot"
8224 soname=$func_basename_result
6778 soname="$func_basename_result"
82256779 func_stripname 'lib' '.dll' "$soname"
82266780 newlib=libimp-$func_stripname_result.a
82276781
82286782 # If the library has no export list, then create one now
82296783 if test -f "$output_objdir/$soname-def"; then :
82306784 else
8231 func_verbose "extracting exported symbol list from '$soname'"
6785 func_verbose "extracting exported symbol list from \`$soname'"
82326786 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
82336787 fi
82346788
82356789 # Create $newlib
82366790 if test -f "$output_objdir/$newlib"; then :; else
8237 func_verbose "generating import library for '$soname'"
6791 func_verbose "generating import library for \`$soname'"
82386792 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
82396793 fi
82406794 # make sure the library variables are pointing to the new library
82426796 linklib=$newlib
82436797 fi # test -n "$old_archive_from_expsyms_cmds"
82446798
8245 if test prog = "$linkmode" || test relink != "$opt_mode"; then
6799 if test "$linkmode" = prog || test "$opt_mode" != relink; then
82466800 add_shlibpath=
82476801 add_dir=
82486802 add=
82496803 lib_linked=yes
82506804 case $hardcode_action in
82516805 immediate | unsupported)
8252 if test no = "$hardcode_direct"; then
8253 add=$dir/$linklib
6806 if test "$hardcode_direct" = no; then
6807 add="$dir/$linklib"
82546808 case $host in
8255 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8256 *-*-sysv4*uw2*) add_dir=-L$dir ;;
6809 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6810 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
82576811 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8258 *-*-unixware7*) add_dir=-L$dir ;;
6812 *-*-unixware7*) add_dir="-L$dir" ;;
82596813 *-*-darwin* )
8260 # if the lib is a (non-dlopened) module then we cannot
6814 # if the lib is a (non-dlopened) module then we can not
82616815 # link against it, someone is ignoring the earlier warnings
82626816 if /usr/bin/file -L $add 2> /dev/null |
8263 $GREP ": [^:]* bundle" >/dev/null; then
6817 $GREP ": [^:]* bundle" >/dev/null ; then
82646818 if test "X$dlopenmodule" != "X$lib"; then
82656819 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8266 if test -z "$old_library"; then
6820 if test -z "$old_library" ; then
82676821 echo
82686822 echo "*** And there doesn't seem to be a static archive available"
82696823 echo "*** The link will probably fail, sorry"
82706824 else
8271 add=$dir/$old_library
6825 add="$dir/$old_library"
82726826 fi
82736827 elif test -n "$old_library"; then
8274 add=$dir/$old_library
6828 add="$dir/$old_library"
82756829 fi
82766830 fi
82776831 esac
8278 elif test no = "$hardcode_minus_L"; then
6832 elif test "$hardcode_minus_L" = no; then
82796833 case $host in
8280 *-*-sunos*) add_shlibpath=$dir ;;
6834 *-*-sunos*) add_shlibpath="$dir" ;;
82816835 esac
8282 add_dir=-L$dir
8283 add=-l$name
8284 elif test no = "$hardcode_shlibpath_var"; then
8285 add_shlibpath=$dir
8286 add=-l$name
6836 add_dir="-L$dir"
6837 add="-l$name"
6838 elif test "$hardcode_shlibpath_var" = no; then
6839 add_shlibpath="$dir"
6840 add="-l$name"
82876841 else
82886842 lib_linked=no
82896843 fi
82906844 ;;
82916845 relink)
8292 if test yes = "$hardcode_direct" &&
8293 test no = "$hardcode_direct_absolute"; then
8294 add=$dir/$linklib
8295 elif test yes = "$hardcode_minus_L"; then
8296 add_dir=-L$absdir
6846 if test "$hardcode_direct" = yes &&
6847 test "$hardcode_direct_absolute" = no; then
6848 add="$dir/$linklib"
6849 elif test "$hardcode_minus_L" = yes; then
6850 add_dir="-L$absdir"
82976851 # Try looking first in the location we're being installed to.
82986852 if test -n "$inst_prefix_dir"; then
82996853 case $libdir in
83026856 ;;
83036857 esac
83046858 fi
8305 add=-l$name
8306 elif test yes = "$hardcode_shlibpath_var"; then
8307 add_shlibpath=$dir
8308 add=-l$name
6859 add="-l$name"
6860 elif test "$hardcode_shlibpath_var" = yes; then
6861 add_shlibpath="$dir"
6862 add="-l$name"
83096863 else
83106864 lib_linked=no
83116865 fi
83136867 *) lib_linked=no ;;
83146868 esac
83156869
8316 if test yes != "$lib_linked"; then
6870 if test "$lib_linked" != yes; then
83176871 func_fatal_configuration "unsupported hardcode properties"
83186872 fi
83196873
83236877 *) func_append compile_shlibpath "$add_shlibpath:" ;;
83246878 esac
83256879 fi
8326 if test prog = "$linkmode"; then
6880 if test "$linkmode" = prog; then
83276881 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
83286882 test -n "$add" && compile_deplibs="$add $compile_deplibs"
83296883 else
83306884 test -n "$add_dir" && deplibs="$add_dir $deplibs"
83316885 test -n "$add" && deplibs="$add $deplibs"
8332 if test yes != "$hardcode_direct" &&
8333 test yes != "$hardcode_minus_L" &&
8334 test yes = "$hardcode_shlibpath_var"; then
6886 if test "$hardcode_direct" != yes &&
6887 test "$hardcode_minus_L" != yes &&
6888 test "$hardcode_shlibpath_var" = yes; then
83356889 case :$finalize_shlibpath: in
83366890 *":$libdir:"*) ;;
83376891 *) func_append finalize_shlibpath "$libdir:" ;;
83406894 fi
83416895 fi
83426896
8343 if test prog = "$linkmode" || test relink = "$opt_mode"; then
6897 if test "$linkmode" = prog || test "$opt_mode" = relink; then
83446898 add_shlibpath=
83456899 add_dir=
83466900 add=
83476901 # Finalize command for both is simple: just hardcode it.
8348 if test yes = "$hardcode_direct" &&
8349 test no = "$hardcode_direct_absolute"; then
8350 add=$libdir/$linklib
8351 elif test yes = "$hardcode_minus_L"; then
8352 add_dir=-L$libdir
8353 add=-l$name
8354 elif test yes = "$hardcode_shlibpath_var"; then
6902 if test "$hardcode_direct" = yes &&
6903 test "$hardcode_direct_absolute" = no; then
6904 add="$libdir/$linklib"
6905 elif test "$hardcode_minus_L" = yes; then
6906 add_dir="-L$libdir"
6907 add="-l$name"
6908 elif test "$hardcode_shlibpath_var" = yes; then
83556909 case :$finalize_shlibpath: in
83566910 *":$libdir:"*) ;;
83576911 *) func_append finalize_shlibpath "$libdir:" ;;
83586912 esac
8359 add=-l$name
8360 elif test yes = "$hardcode_automatic"; then
6913 add="-l$name"
6914 elif test "$hardcode_automatic" = yes; then
83616915 if test -n "$inst_prefix_dir" &&
8362 test -f "$inst_prefix_dir$libdir/$linklib"; then
8363 add=$inst_prefix_dir$libdir/$linklib
6916 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6917 add="$inst_prefix_dir$libdir/$linklib"
83646918 else
8365 add=$libdir/$linklib
6919 add="$libdir/$linklib"
83666920 fi
83676921 else
83686922 # We cannot seem to hardcode it, guess we'll fake it.
8369 add_dir=-L$libdir
6923 add_dir="-L$libdir"
83706924 # Try looking first in the location we're being installed to.
83716925 if test -n "$inst_prefix_dir"; then
83726926 case $libdir in
83756929 ;;
83766930 esac
83776931 fi
8378 add=-l$name
6932 add="-l$name"
83796933 fi
83806934
8381 if test prog = "$linkmode"; then
6935 if test "$linkmode" = prog; then
83826936 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
83836937 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
83846938 else
83866940 test -n "$add" && deplibs="$add $deplibs"
83876941 fi
83886942 fi
8389 elif test prog = "$linkmode"; then
6943 elif test "$linkmode" = prog; then
83906944 # Here we assume that one of hardcode_direct or hardcode_minus_L
83916945 # is not unsupported. This is valid on all known static and
83926946 # shared platforms.
8393 if test unsupported != "$hardcode_direct"; then
8394 test -n "$old_library" && linklib=$old_library
6947 if test "$hardcode_direct" != unsupported; then
6948 test -n "$old_library" && linklib="$old_library"
83956949 compile_deplibs="$dir/$linklib $compile_deplibs"
83966950 finalize_deplibs="$dir/$linklib $finalize_deplibs"
83976951 else
83986952 compile_deplibs="-l$name -L$dir $compile_deplibs"
83996953 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
84006954 fi
8401 elif test yes = "$build_libtool_libs"; then
6955 elif test "$build_libtool_libs" = yes; then
84026956 # Not a shared library
8403 if test pass_all != "$deplibs_check_method"; then
6957 if test "$deplibs_check_method" != pass_all; then
84046958 # We're trying link a shared library against a static one
84056959 # but the system doesn't support it.
84066960
84076961 # Just print a warning and add the library to dependency_libs so
84086962 # that the program can be linked against the static library.
84096963 echo
8410 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
6964 $ECHO "*** Warning: This system can not link to static lib archive $lib."
84116965 echo "*** I have the capability to make that library automatically link in when"
84126966 echo "*** you link to this library. But I can only do this if you have a"
84136967 echo "*** shared version of the library, which you do not appear to have."
8414 if test yes = "$module"; then
6968 if test "$module" = yes; then
84156969 echo "*** But as you try to build a module library, libtool will still create "
84166970 echo "*** a static module, that should work as long as the dlopening application"
84176971 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
84186972 if test -z "$global_symbol_pipe"; then
84196973 echo
84206974 echo "*** However, this would only work if libtool was able to extract symbol"
8421 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
6975 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
84226976 echo "*** not find such a program. So, this module is probably useless."
8423 echo "*** 'nm' from GNU binutils and a full rebuild may help."
6977 echo "*** \`nm' from GNU binutils and a full rebuild may help."
84246978 fi
8425 if test no = "$build_old_libs"; then
6979 if test "$build_old_libs" = no; then
84266980 build_libtool_libs=module
84276981 build_old_libs=yes
84286982 else
84356989 fi
84366990 fi # link shared/static library?
84376991
8438 if test lib = "$linkmode"; then
6992 if test "$linkmode" = lib; then
84396993 if test -n "$dependency_libs" &&
8440 { test yes != "$hardcode_into_libs" ||
8441 test yes = "$build_old_libs" ||
8442 test yes = "$link_static"; }; then
6994 { test "$hardcode_into_libs" != yes ||
6995 test "$build_old_libs" = yes ||
6996 test "$link_static" = yes; }; then
84436997 # Extract -R from dependency_libs
84446998 temp_deplibs=
84456999 for libdir in $dependency_libs; do
84537007 *) func_append temp_deplibs " $libdir";;
84547008 esac
84557009 done
8456 dependency_libs=$temp_deplibs
7010 dependency_libs="$temp_deplibs"
84577011 fi
84587012
84597013 func_append newlib_search_path " $absdir"
84607014 # Link against this library
8461 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
7015 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
84627016 # ... and its dependency_libs
84637017 tmp_libs=
84647018 for deplib in $dependency_libs; do
84687022 func_resolve_sysroot "$func_stripname_result";;
84697023 *) func_resolve_sysroot "$deplib" ;;
84707024 esac
8471 if $opt_preserve_dup_deps; then
7025 if $opt_preserve_dup_deps ; then
84727026 case "$tmp_libs " in
84737027 *" $func_resolve_sysroot_result "*)
84747028 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
84777031 func_append tmp_libs " $func_resolve_sysroot_result"
84787032 done
84797033
8480 if test no != "$link_all_deplibs"; then
7034 if test "$link_all_deplibs" != no; then
84817035 # Add the search paths of all dependency libraries
84827036 for deplib in $dependency_libs; do
84837037 path=
84847038 case $deplib in
8485 -L*) path=$deplib ;;
7039 -L*) path="$deplib" ;;
84867040 *.la)
84877041 func_resolve_sysroot "$deplib"
84887042 deplib=$func_resolve_sysroot_result
84907044 dir=$func_dirname_result
84917045 # We need an absolute path.
84927046 case $dir in
8493 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
7047 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
84947048 *)
84957049 absdir=`cd "$dir" && pwd`
84967050 if test -z "$absdir"; then
8497 func_warning "cannot determine absolute directory name of '$dir'"
8498 absdir=$dir
7051 func_warning "cannot determine absolute directory name of \`$dir'"
7052 absdir="$dir"
84997053 fi
85007054 ;;
85017055 esac
85037057 case $host in
85047058 *-*-darwin*)
85057059 depdepl=
8506 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8507 if test -n "$deplibrary_names"; then
8508 for tmp in $deplibrary_names; do
7060 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7061 if test -n "$deplibrary_names" ; then
7062 for tmp in $deplibrary_names ; do
85097063 depdepl=$tmp
85107064 done
8511 if test -f "$absdir/$objdir/$depdepl"; then
8512 depdepl=$absdir/$objdir/$depdepl
8513 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7065 if test -f "$absdir/$objdir/$depdepl" ; then
7066 depdepl="$absdir/$objdir/$depdepl"
7067 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
85147068 if test -z "$darwin_install_name"; then
8515 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7069 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
85167070 fi
8517 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8518 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
7071 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
7072 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
85197073 path=
85207074 fi
85217075 fi
85227076 ;;
85237077 *)
8524 path=-L$absdir/$objdir
7078 path="-L$absdir/$objdir"
85257079 ;;
85267080 esac
85277081 else
8528 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7082 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
85297083 test -z "$libdir" && \
8530 func_fatal_error "'$deplib' is not a valid libtool archive"
7084 func_fatal_error "\`$deplib' is not a valid libtool archive"
85317085 test "$absdir" != "$libdir" && \
8532 func_warning "'$deplib' seems to be moved"
8533
8534 path=-L$absdir
7086 func_warning "\`$deplib' seems to be moved"
7087
7088 path="-L$absdir"
85357089 fi
85367090 ;;
85377091 esac
85437097 fi # link_all_deplibs != no
85447098 fi # linkmode = lib
85457099 done # for deplib in $libs
8546 if test link = "$pass"; then
8547 if test prog = "$linkmode"; then
7100 if test "$pass" = link; then
7101 if test "$linkmode" = "prog"; then
85487102 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
85497103 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
85507104 else
85517105 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
85527106 fi
85537107 fi
8554 dependency_libs=$newdependency_libs
8555 if test dlpreopen = "$pass"; then
7108 dependency_libs="$newdependency_libs"
7109 if test "$pass" = dlpreopen; then
85567110 # Link the dlpreopened libraries before other libraries
85577111 for deplib in $save_deplibs; do
85587112 deplibs="$deplib $deplibs"
85597113 done
85607114 fi
8561 if test dlopen != "$pass"; then
8562 test conv = "$pass" || {
7115 if test "$pass" != dlopen; then
7116 if test "$pass" != conv; then
85637117 # Make sure lib_search_path contains only unique directories.
85647118 lib_search_path=
85657119 for dir in $newlib_search_path; do
85697123 esac
85707124 done
85717125 newlib_search_path=
8572 }
8573
8574 if test prog,link = "$linkmode,$pass"; then
7126 fi
7127
7128 if test "$linkmode,$pass" != "prog,link"; then
7129 vars="deplibs"
7130 else
85757131 vars="compile_deplibs finalize_deplibs"
8576 else
8577 vars=deplibs
85787132 fi
85797133 for var in $vars dependency_libs; do
85807134 # Add libraries to $var in reverse order
86327186 eval $var=\"$tmp_libs\"
86337187 done # for var
86347188 fi
8635
8636 # Add Sun CC postdeps if required:
8637 test CXX = "$tagname" && {
8638 case $host_os in
8639 linux*)
8640 case `$CC -V 2>&1 | sed 5q` in
8641 *Sun\ C*) # Sun C++ 5.9
8642 func_suncc_cstd_abi
8643
8644 if test no != "$suncc_use_cstd_abi"; then
8645 func_append postdeps ' -library=Cstd -library=Crun'
8646 fi
8647 ;;
8648 esac
8649 ;;
8650
8651 solaris*)
8652 func_cc_basename "$CC"
8653 case $func_cc_basename_result in
8654 CC* | sunCC*)
8655 func_suncc_cstd_abi
8656
8657 if test no != "$suncc_use_cstd_abi"; then
8658 func_append postdeps ' -library=Cstd -library=Crun'
8659 fi
8660 ;;
8661 esac
8662 ;;
8663 esac
8664 }
8665
86667189 # Last step: remove runtime libs from dependency_libs
86677190 # (they stay in deplibs)
86687191 tmp_libs=
8669 for i in $dependency_libs; do
7192 for i in $dependency_libs ; do
86707193 case " $predeps $postdeps $compiler_lib_search_path " in
86717194 *" $i "*)
8672 i=
7195 i=""
86737196 ;;
86747197 esac
8675 if test -n "$i"; then
7198 if test -n "$i" ; then
86767199 func_append tmp_libs " $i"
86777200 fi
86787201 done
86797202 dependency_libs=$tmp_libs
86807203 done # for pass
8681 if test prog = "$linkmode"; then
8682 dlfiles=$newdlfiles
7204 if test "$linkmode" = prog; then
7205 dlfiles="$newdlfiles"
86837206 fi
8684 if test prog = "$linkmode" || test lib = "$linkmode"; then
8685 dlprefiles=$newdlprefiles
7207 if test "$linkmode" = prog || test "$linkmode" = lib; then
7208 dlprefiles="$newdlprefiles"
86867209 fi
86877210
86887211 case $linkmode in
86897212 oldlib)
8690 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8691 func_warning "'-dlopen' is ignored for archives"
7213 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7214 func_warning "\`-dlopen' is ignored for archives"
86927215 fi
86937216
86947217 case " $deplibs" in
86957218 *\ -l* | *\ -L*)
8696 func_warning "'-l' and '-L' are ignored for archives" ;;
7219 func_warning "\`-l' and \`-L' are ignored for archives" ;;
86977220 esac
86987221
86997222 test -n "$rpath" && \
8700 func_warning "'-rpath' is ignored for archives"
7223 func_warning "\`-rpath' is ignored for archives"
87017224
87027225 test -n "$xrpath" && \
8703 func_warning "'-R' is ignored for archives"
7226 func_warning "\`-R' is ignored for archives"
87047227
87057228 test -n "$vinfo" && \
8706 func_warning "'-version-info/-version-number' is ignored for archives"
7229 func_warning "\`-version-info/-version-number' is ignored for archives"
87077230
87087231 test -n "$release" && \
8709 func_warning "'-release' is ignored for archives"
7232 func_warning "\`-release' is ignored for archives"
87107233
87117234 test -n "$export_symbols$export_symbols_regex" && \
8712 func_warning "'-export-symbols' is ignored for archives"
7235 func_warning "\`-export-symbols' is ignored for archives"
87137236
87147237 # Now set the variables for building old libraries.
87157238 build_libtool_libs=no
8716 oldlibs=$output
7239 oldlibs="$output"
87177240 func_append objs "$old_deplibs"
87187241 ;;
87197242
87207243 lib)
8721 # Make sure we only generate libraries of the form 'libNAME.la'.
7244 # Make sure we only generate libraries of the form `libNAME.la'.
87227245 case $outputname in
87237246 lib*)
87247247 func_stripname 'lib' '.la' "$outputname"
87277250 eval libname=\"$libname_spec\"
87287251 ;;
87297252 *)
8730 test no = "$module" \
8731 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8732
8733 if test no != "$need_lib_prefix"; then
7253 test "$module" = no && \
7254 func_fatal_help "libtool library \`$output' must begin with \`lib'"
7255
7256 if test "$need_lib_prefix" != no; then
87347257 # Add the "lib" prefix for modules if required
87357258 func_stripname '' '.la' "$outputname"
87367259 name=$func_stripname_result
87447267 esac
87457268
87467269 if test -n "$objs"; then
8747 if test pass_all != "$deplibs_check_method"; then
8748 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
7270 if test "$deplibs_check_method" != pass_all; then
7271 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
87497272 else
87507273 echo
87517274 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
87547277 fi
87557278 fi
87567279
8757 test no = "$dlself" \
8758 || func_warning "'-dlopen self' is ignored for libtool libraries"
7280 test "$dlself" != no && \
7281 func_warning "\`-dlopen self' is ignored for libtool libraries"
87597282
87607283 set dummy $rpath
87617284 shift
8762 test 1 -lt "$#" \
8763 && func_warning "ignoring multiple '-rpath's for a libtool library"
8764
8765 install_libdir=$1
7285 test "$#" -gt 1 && \
7286 func_warning "ignoring multiple \`-rpath's for a libtool library"
7287
7288 install_libdir="$1"
87667289
87677290 oldlibs=
87687291 if test -z "$rpath"; then
8769 if test yes = "$build_libtool_libs"; then
7292 if test "$build_libtool_libs" = yes; then
87707293 # Building a libtool convenience library.
8771 # Some compilers have problems with a '.al' extension so
7294 # Some compilers have problems with a `.al' extension so
87727295 # convenience libraries should have the same extension an
87737296 # archive normally would.
87747297 oldlibs="$output_objdir/$libname.$libext $oldlibs"
87777300 fi
87787301
87797302 test -n "$vinfo" && \
8780 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
7303 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
87817304
87827305 test -n "$release" && \
8783 func_warning "'-release' is ignored for convenience libraries"
7306 func_warning "\`-release' is ignored for convenience libraries"
87847307 else
87857308
87867309 # Parse the version information argument.
8787 save_ifs=$IFS; IFS=:
7310 save_ifs="$IFS"; IFS=':'
87887311 set dummy $vinfo 0 0 0
87897312 shift
8790 IFS=$save_ifs
7313 IFS="$save_ifs"
87917314
87927315 test -n "$7" && \
8793 func_fatal_help "too many parameters to '-version-info'"
7316 func_fatal_help "too many parameters to \`-version-info'"
87947317
87957318 # convert absolute version numbers to libtool ages
87967319 # this retains compatibility with .la files and attempts
87987321
87997322 case $vinfo_number in
88007323 yes)
8801 number_major=$1
8802 number_minor=$2
8803 number_revision=$3
7324 number_major="$1"
7325 number_minor="$2"
7326 number_revision="$3"
88047327 #
88057328 # There are really only two kinds -- those that
88067329 # use the current revision as the major version
88077330 # and those that subtract age and use age as
88087331 # a minor version. But, then there is irix
8809 # that has an extra 1 added just for fun
7332 # which has an extra 1 added just for fun
88107333 #
88117334 case $version_type in
88127335 # correct linux to gnu/linux during the next big refactor
8813 darwin|freebsd-elf|linux|osf|windows|none)
7336 darwin|linux|osf|windows|none)
88147337 func_arith $number_major + $number_minor
88157338 current=$func_arith_result
8816 age=$number_minor
8817 revision=$number_revision
7339 age="$number_minor"
7340 revision="$number_revision"
88187341 ;;
8819 freebsd-aout|qnx|sunos)
8820 current=$number_major
8821 revision=$number_minor
8822 age=0
7342 freebsd-aout|freebsd-elf|qnx|sunos)
7343 current="$number_major"
7344 revision="$number_minor"
7345 age="0"
88237346 ;;
88247347 irix|nonstopux)
88257348 func_arith $number_major + $number_minor
88267349 current=$func_arith_result
8827 age=$number_minor
8828 revision=$number_minor
7350 age="$number_minor"
7351 revision="$number_minor"
88297352 lt_irix_increment=no
88307353 ;;
88317354 *)
8832 func_fatal_configuration "$modename: unknown library version type '$version_type'"
7355 func_fatal_configuration "$modename: unknown library version type \`$version_type'"
88337356 ;;
88347357 esac
88357358 ;;
88367359 no)
8837 current=$1
8838 revision=$2
8839 age=$3
7360 current="$1"
7361 revision="$2"
7362 age="$3"
88407363 ;;
88417364 esac
88427365
88447367 case $current in
88457368 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
88467369 *)
8847 func_error "CURRENT '$current' must be a nonnegative integer"
8848 func_fatal_error "'$vinfo' is not valid version information"
7370 func_error "CURRENT \`$current' must be a nonnegative integer"
7371 func_fatal_error "\`$vinfo' is not valid version information"
88497372 ;;
88507373 esac
88517374
88527375 case $revision in
88537376 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
88547377 *)
8855 func_error "REVISION '$revision' must be a nonnegative integer"
8856 func_fatal_error "'$vinfo' is not valid version information"
7378 func_error "REVISION \`$revision' must be a nonnegative integer"
7379 func_fatal_error "\`$vinfo' is not valid version information"
88577380 ;;
88587381 esac
88597382
88607383 case $age in
88617384 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
88627385 *)
8863 func_error "AGE '$age' must be a nonnegative integer"
8864 func_fatal_error "'$vinfo' is not valid version information"
7386 func_error "AGE \`$age' must be a nonnegative integer"
7387 func_fatal_error "\`$vinfo' is not valid version information"
88657388 ;;
88667389 esac
88677390
88687391 if test "$age" -gt "$current"; then
8869 func_error "AGE '$age' is greater than the current interface number '$current'"
8870 func_fatal_error "'$vinfo' is not valid version information"
7392 func_error "AGE \`$age' is greater than the current interface number \`$current'"
7393 func_fatal_error "\`$vinfo' is not valid version information"
88717394 fi
88727395
88737396 # Calculate the version variables.
88827405 # verstring for coding it into the library header
88837406 func_arith $current - $age
88847407 major=.$func_arith_result
8885 versuffix=$major.$age.$revision
7408 versuffix="$major.$age.$revision"
88867409 # Darwin ld doesn't like 0 for these options...
88877410 func_arith $current + 1
88887411 minor_current=$func_arith_result
8889 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
7412 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
88907413 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8891 # On Darwin other compilers
8892 case $CC in
8893 nagfor*)
8894 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8895 ;;
8896 *)
8897 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8898 ;;
8899 esac
89007414 ;;
89017415
89027416 freebsd-aout)
8903 major=.$current
8904 versuffix=.$current.$revision
7417 major=".$current"
7418 versuffix=".$current.$revision";
89057419 ;;
89067420
89077421 freebsd-elf)
8908 func_arith $current - $age
8909 major=.$func_arith_result
8910 versuffix=$major.$age.$revision
7422 major=".$current"
7423 versuffix=".$current"
89117424 ;;
89127425
89137426 irix | nonstopux)
8914 if test no = "$lt_irix_increment"; then
7427 if test "X$lt_irix_increment" = "Xno"; then
89157428 func_arith $current - $age
89167429 else
89177430 func_arith $current - $age + 1
89227435 nonstopux) verstring_prefix=nonstopux ;;
89237436 *) verstring_prefix=sgi ;;
89247437 esac
8925 verstring=$verstring_prefix$major.$revision
7438 verstring="$verstring_prefix$major.$revision"
89267439
89277440 # Add in all the interfaces that we are compatible with.
89287441 loop=$revision
8929 while test 0 -ne "$loop"; do
7442 while test "$loop" -ne 0; do
89307443 func_arith $revision - $loop
89317444 iface=$func_arith_result
89327445 func_arith $loop - 1
89337446 loop=$func_arith_result
8934 verstring=$verstring_prefix$major.$iface:$verstring
7447 verstring="$verstring_prefix$major.$iface:$verstring"
89357448 done
89367449
8937 # Before this point, $major must not contain '.'.
7450 # Before this point, $major must not contain `.'.
89387451 major=.$major
8939 versuffix=$major.$revision
7452 versuffix="$major.$revision"
89407453 ;;
89417454
89427455 linux) # correct to gnu/linux during the next big refactor
89437456 func_arith $current - $age
89447457 major=.$func_arith_result
8945 versuffix=$major.$age.$revision
7458 versuffix="$major.$age.$revision"
89467459 ;;
89477460
89487461 osf)
89497462 func_arith $current - $age
89507463 major=.$func_arith_result
8951 versuffix=.$current.$age.$revision
8952 verstring=$current.$age.$revision
7464 versuffix=".$current.$age.$revision"
7465 verstring="$current.$age.$revision"
89537466
89547467 # Add in all the interfaces that we are compatible with.
89557468 loop=$age
8956 while test 0 -ne "$loop"; do
7469 while test "$loop" -ne 0; do
89577470 func_arith $current - $loop
89587471 iface=$func_arith_result
89597472 func_arith $loop - 1
89607473 loop=$func_arith_result
8961 verstring=$verstring:$iface.0
7474 verstring="$verstring:${iface}.0"
89627475 done
89637476
89647477 # Make executables depend on our current version.
8965 func_append verstring ":$current.0"
7478 func_append verstring ":${current}.0"
89667479 ;;
89677480
89687481 qnx)
8969 major=.$current
8970 versuffix=.$current
7482 major=".$current"
7483 versuffix=".$current"
89717484 ;;
89727485
8973 sco)
8974 major=.$current
8975 versuffix=.$current
8976 ;;
8977
89787486 sunos)
8979 major=.$current
8980 versuffix=.$current.$revision
7487 major=".$current"
7488 versuffix=".$current.$revision"
89817489 ;;
89827490
89837491 windows)
89847492 # Use '-' rather than '.', since we only want one
8985 # extension on DOS 8.3 file systems.
7493 # extension on DOS 8.3 filesystems.
89867494 func_arith $current - $age
89877495 major=$func_arith_result
8988 versuffix=-$major
7496 versuffix="-$major"
89897497 ;;
89907498
89917499 *)
8992 func_fatal_configuration "unknown library version type '$version_type'"
7500 func_fatal_configuration "unknown library version type \`$version_type'"
89937501 ;;
89947502 esac
89957503
90037511 verstring=
90047512 ;;
90057513 *)
9006 verstring=0.0
7514 verstring="0.0"
90077515 ;;
90087516 esac
9009 if test no = "$need_version"; then
7517 if test "$need_version" = no; then
90107518 versuffix=
90117519 else
9012 versuffix=.0.0
7520 versuffix=".0.0"
90137521 fi
90147522 fi
90157523
90167524 # Remove version info from name if versioning should be avoided
9017 if test yes,no = "$avoid_version,$need_version"; then
7525 if test "$avoid_version" = yes && test "$need_version" = no; then
90187526 major=
90197527 versuffix=
9020 verstring=
7528 verstring=""
90217529 fi
90227530
90237531 # Check to see if the archive will have undefined symbols.
9024 if test yes = "$allow_undefined"; then
9025 if test unsupported = "$allow_undefined_flag"; then
9026 if test yes = "$build_old_libs"; then
9027 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9028 build_libtool_libs=no
9029 else
9030 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9031 fi
7532 if test "$allow_undefined" = yes; then
7533 if test "$allow_undefined_flag" = unsupported; then
7534 func_warning "undefined symbols not allowed in $host shared libraries"
7535 build_libtool_libs=no
7536 build_old_libs=yes
90327537 fi
90337538 else
90347539 # Don't allow undefined symbols.
9035 allow_undefined_flag=$no_undefined_flag
7540 allow_undefined_flag="$no_undefined_flag"
90367541 fi
90377542
90387543 fi
90397544
9040 func_generate_dlsyms "$libname" "$libname" :
7545 func_generate_dlsyms "$libname" "$libname" "yes"
90417546 func_append libobjs " $symfileobj"
9042 test " " = "$libobjs" && libobjs=
9043
9044 if test relink != "$opt_mode"; then
7547 test "X$libobjs" = "X " && libobjs=
7548
7549 if test "$opt_mode" != relink; then
90457550 # Remove our outputs, but don't remove object files since they
90467551 # may have been created when compiling PIC objects.
90477552 removelist=
90507555 case $p in
90517556 *.$objext | *.gcno)
90527557 ;;
9053 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9054 if test -n "$precious_files_regex"; then
7558 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7559 if test "X$precious_files_regex" != "X"; then
90557560 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
90567561 then
90577562 continue
90677572 fi
90687573
90697574 # Now set the variables for building old libraries.
9070 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
7575 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
90717576 func_append oldlibs " $output_objdir/$libname.$libext"
90727577
90737578 # Transform .lo files to .o files.
9074 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
7579 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
90757580 fi
90767581
90777582 # Eliminate all temporary directories.
90927597 *) func_append finalize_rpath " $libdir" ;;
90937598 esac
90947599 done
9095 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
7600 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
90967601 dependency_libs="$temp_xrpath $dependency_libs"
90977602 fi
90987603 fi
90997604
91007605 # Make sure dlfiles contains only unique files that won't be dlpreopened
9101 old_dlfiles=$dlfiles
7606 old_dlfiles="$dlfiles"
91027607 dlfiles=
91037608 for lib in $old_dlfiles; do
91047609 case " $dlprefiles $dlfiles " in
91087613 done
91097614
91107615 # Make sure dlprefiles contains only unique files
9111 old_dlprefiles=$dlprefiles
7616 old_dlprefiles="$dlprefiles"
91127617 dlprefiles=
91137618 for lib in $old_dlprefiles; do
91147619 case "$dlprefiles " in
91177622 esac
91187623 done
91197624
9120 if test yes = "$build_libtool_libs"; then
7625 if test "$build_libtool_libs" = yes; then
91217626 if test -n "$rpath"; then
91227627 case $host in
91237628 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
91417646 ;;
91427647 *)
91437648 # Add libc to deplibs on all other systems if necessary.
9144 if test yes = "$build_libtool_need_lc"; then
7649 if test "$build_libtool_need_lc" = "yes"; then
91457650 func_append deplibs " -lc"
91467651 fi
91477652 ;;
91577662 # I'm not sure if I'm treating the release correctly. I think
91587663 # release should show up in the -l (ie -lgmp5) so we don't want to
91597664 # add it in twice. Is that correct?
9160 release=
9161 versuffix=
9162 major=
7665 release=""
7666 versuffix=""
7667 major=""
91637668 newdeplibs=
91647669 droppeddeps=no
91657670 case $deplibs_check_method in
91887693 -l*)
91897694 func_stripname -l '' "$i"
91907695 name=$func_stripname_result
9191 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7696 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
91927697 case " $predeps $postdeps " in
91937698 *" $i "*)
91947699 func_append newdeplibs " $i"
9195 i=
7700 i=""
91967701 ;;
91977702 esac
91987703 fi
9199 if test -n "$i"; then
7704 if test -n "$i" ; then
92007705 libname=`eval "\\$ECHO \"$libname_spec\""`
92017706 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
92027707 set dummy $deplib_matches; shift
92037708 deplib_match=$1
9204 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
7709 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
92057710 func_append newdeplibs " $i"
92067711 else
92077712 droppeddeps=yes
92317736 $opt_dry_run || $RM conftest
92327737 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
92337738 ldd_output=`ldd conftest`
9234 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7739 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
92357740 case " $predeps $postdeps " in
92367741 *" $i "*)
92377742 func_append newdeplibs " $i"
9238 i=
7743 i=""
92397744 ;;
92407745 esac
92417746 fi
9242 if test -n "$i"; then
7747 if test -n "$i" ; then
92437748 libname=`eval "\\$ECHO \"$libname_spec\""`
92447749 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
92457750 set dummy $deplib_matches; shift
92467751 deplib_match=$1
9247 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
7752 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
92487753 func_append newdeplibs " $i"
92497754 else
92507755 droppeddeps=yes
92817786 -l*)
92827787 func_stripname -l '' "$a_deplib"
92837788 name=$func_stripname_result
9284 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7789 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
92857790 case " $predeps $postdeps " in
92867791 *" $a_deplib "*)
92877792 func_append newdeplibs " $a_deplib"
9288 a_deplib=
7793 a_deplib=""
92897794 ;;
92907795 esac
92917796 fi
9292 if test -n "$a_deplib"; then
7797 if test -n "$a_deplib" ; then
92937798 libname=`eval "\\$ECHO \"$libname_spec\""`
92947799 if test -n "$file_magic_glob"; then
92957800 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
92967801 else
92977802 libnameglob=$libname
92987803 fi
9299 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
7804 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
93007805 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9301 if test yes = "$want_nocaseglob"; then
7806 if test "$want_nocaseglob" = yes; then
93027807 shopt -s nocaseglob
93037808 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
93047809 $nocaseglob
93167821 # We might still enter an endless loop, since a link
93177822 # loop can be closed while we follow links,
93187823 # but so what?
9319 potlib=$potent_lib
7824 potlib="$potent_lib"
93207825 while test -h "$potlib" 2>/dev/null; do
9321 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
7826 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
93227827 case $potliblink in
9323 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9324 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
7828 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7829 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
93257830 esac
93267831 done
93277832 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
93287833 $SED -e 10q |
93297834 $EGREP "$file_magic_regex" > /dev/null; then
93307835 func_append newdeplibs " $a_deplib"
9331 a_deplib=
7836 a_deplib=""
93327837 break 2
93337838 fi
93347839 done
93357840 done
93367841 fi
9337 if test -n "$a_deplib"; then
7842 if test -n "$a_deplib" ; then
93387843 droppeddeps=yes
93397844 echo
93407845 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
93427847 echo "*** you link to this library. But I can only do this if you have a"
93437848 echo "*** shared version of the library, which you do not appear to have"
93447849 echo "*** because I did check the linker path looking for a file starting"
9345 if test -z "$potlib"; then
7850 if test -z "$potlib" ; then
93467851 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
93477852 else
93487853 $ECHO "*** with $libname and none of the candidates passed a file format test"
93657870 -l*)
93667871 func_stripname -l '' "$a_deplib"
93677872 name=$func_stripname_result
9368 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7873 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
93697874 case " $predeps $postdeps " in
93707875 *" $a_deplib "*)
93717876 func_append newdeplibs " $a_deplib"
9372 a_deplib=
7877 a_deplib=""
93737878 ;;
93747879 esac
93757880 fi
9376 if test -n "$a_deplib"; then
7881 if test -n "$a_deplib" ; then
93777882 libname=`eval "\\$ECHO \"$libname_spec\""`
93787883 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
93797884 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
93807885 for potent_lib in $potential_libs; do
9381 potlib=$potent_lib # see symlink-check above in file_magic test
7886 potlib="$potent_lib" # see symlink-check above in file_magic test
93827887 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
93837888 $EGREP "$match_pattern_regex" > /dev/null; then
93847889 func_append newdeplibs " $a_deplib"
9385 a_deplib=
7890 a_deplib=""
93867891 break 2
93877892 fi
93887893 done
93897894 done
93907895 fi
9391 if test -n "$a_deplib"; then
7896 if test -n "$a_deplib" ; then
93927897 droppeddeps=yes
93937898 echo
93947899 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
93967901 echo "*** you link to this library. But I can only do this if you have a"
93977902 echo "*** shared version of the library, which you do not appear to have"
93987903 echo "*** because I did check the linker path looking for a file starting"
9399 if test -z "$potlib"; then
7904 if test -z "$potlib" ; then
94007905 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
94017906 else
94027907 $ECHO "*** with $libname and none of the candidates passed a file format test"
94127917 done # Gone through all deplibs.
94137918 ;;
94147919 none | unknown | *)
9415 newdeplibs=
7920 newdeplibs=""
94167921 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9417 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9418 for i in $predeps $postdeps; do
7922 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7923 for i in $predeps $postdeps ; do
94197924 # can't use Xsed below, because $i might contain '/'
9420 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
7925 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
94217926 done
94227927 fi
94237928 case $tmp_deplibs in
94247929 *[!\ \ ]*)
94257930 echo
9426 if test none = "$deplibs_check_method"; then
7931 if test "X$deplibs_check_method" = "Xnone"; then
94277932 echo "*** Warning: inter-library dependencies are not supported in this platform."
94287933 else
94297934 echo "*** Warning: inter-library dependencies are not known to be supported."
94477952 ;;
94487953 esac
94497954
9450 if test yes = "$droppeddeps"; then
9451 if test yes = "$module"; then
7955 if test "$droppeddeps" = yes; then
7956 if test "$module" = yes; then
94527957 echo
94537958 echo "*** Warning: libtool could not satisfy all declared inter-library"
94547959 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
94577962 if test -z "$global_symbol_pipe"; then
94587963 echo
94597964 echo "*** However, this would only work if libtool was able to extract symbol"
9460 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
7965 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
94617966 echo "*** not find such a program. So, this module is probably useless."
9462 echo "*** 'nm' from GNU binutils and a full rebuild may help."
7967 echo "*** \`nm' from GNU binutils and a full rebuild may help."
94637968 fi
9464 if test no = "$build_old_libs"; then
9465 oldlibs=$output_objdir/$libname.$libext
7969 if test "$build_old_libs" = no; then
7970 oldlibs="$output_objdir/$libname.$libext"
94667971 build_libtool_libs=module
94677972 build_old_libs=yes
94687973 else
94737978 echo "*** automatically added whenever a program is linked with this library"
94747979 echo "*** or is declared to -dlopen it."
94757980
9476 if test no = "$allow_undefined"; then
7981 if test "$allow_undefined" = no; then
94777982 echo
94787983 echo "*** Since this library must not contain undefined symbols,"
94797984 echo "*** because either the platform does not support them or"
94807985 echo "*** it was explicitly requested with -no-undefined,"
94817986 echo "*** libtool will only create a static version of it."
9482 if test no = "$build_old_libs"; then
9483 oldlibs=$output_objdir/$libname.$libext
7987 if test "$build_old_libs" = no; then
7988 oldlibs="$output_objdir/$libname.$libext"
94847989 build_libtool_libs=module
94857990 build_old_libs=yes
94867991 else
95268031 *) func_append new_libs " $deplib" ;;
95278032 esac
95288033 done
9529 deplibs=$new_libs
8034 deplibs="$new_libs"
95308035
95318036 # All the library-specific variables (install_libdir is set above).
95328037 library_names=
95348039 dlname=
95358040
95368041 # Test again, we may have decided not to build it any more
9537 if test yes = "$build_libtool_libs"; then
9538 # Remove $wl instances when linking with ld.
8042 if test "$build_libtool_libs" = yes; then
8043 # Remove ${wl} instances when linking with ld.
95398044 # FIXME: should test the right _cmds variable.
95408045 case $archive_cmds in
95418046 *\$LD\ *) wl= ;;
95428047 esac
9543 if test yes = "$hardcode_into_libs"; then
8048 if test "$hardcode_into_libs" = yes; then
95448049 # Hardcode the library paths
95458050 hardcode_libdirs=
95468051 dep_rpath=
9547 rpath=$finalize_rpath
9548 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
8052 rpath="$finalize_rpath"
8053 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
95498054 for libdir in $rpath; do
95508055 if test -n "$hardcode_libdir_flag_spec"; then
95518056 if test -n "$hardcode_libdir_separator"; then
95528057 func_replace_sysroot "$libdir"
95538058 libdir=$func_replace_sysroot_result
95548059 if test -z "$hardcode_libdirs"; then
9555 hardcode_libdirs=$libdir
8060 hardcode_libdirs="$libdir"
95568061 else
95578062 # Just accumulate the unique libdirs.
95588063 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
95778082 # Substitute the hardcoded libdirs into the rpath.
95788083 if test -n "$hardcode_libdir_separator" &&
95798084 test -n "$hardcode_libdirs"; then
9580 libdir=$hardcode_libdirs
8085 libdir="$hardcode_libdirs"
95818086 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
95828087 fi
95838088 if test -n "$runpath_var" && test -n "$perm_rpath"; then
95918096 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
95928097 fi
95938098
9594 shlibpath=$finalize_shlibpath
9595 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
8099 shlibpath="$finalize_shlibpath"
8100 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
95968101 if test -n "$shlibpath"; then
95978102 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
95988103 fi
96028107 eval library_names=\"$library_names_spec\"
96038108 set dummy $library_names
96048109 shift
9605 realname=$1
8110 realname="$1"
96068111 shift
96078112
96088113 if test -n "$soname_spec"; then
96098114 eval soname=\"$soname_spec\"
96108115 else
9611 soname=$realname
8116 soname="$realname"
96128117 fi
96138118 if test -z "$dlname"; then
96148119 dlname=$soname
96158120 fi
96168121
9617 lib=$output_objdir/$realname
8122 lib="$output_objdir/$realname"
96188123 linknames=
96198124 for link
96208125 do
96288133 delfiles=
96298134 if test -n "$export_symbols" && test -n "$include_expsyms"; then
96308135 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
9631 export_symbols=$output_objdir/$libname.uexp
8136 export_symbols="$output_objdir/$libname.uexp"
96328137 func_append delfiles " $export_symbols"
96338138 fi
96348139
96378142 cygwin* | mingw* | cegcc*)
96388143 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
96398144 # exporting using user supplied symfile
9640 func_dll_def_p "$export_symbols" || {
8145 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
96418146 # and it's NOT already a .def file. Must figure out
96428147 # which of the given symbols are data symbols and tag
96438148 # them as such. So, trigger use of export_symbols_cmds.
96448149 # export_symbols gets reassigned inside the "prepare
96458150 # the list of exported symbols" if statement, so the
96468151 # include_expsyms logic still works.
9647 orig_export_symbols=$export_symbols
8152 orig_export_symbols="$export_symbols"
96488153 export_symbols=
96498154 always_export_symbols=yes
9650 }
8155 fi
96518156 fi
96528157 ;;
96538158 esac
96548159
96558160 # Prepare the list of exported symbols
96568161 if test -z "$export_symbols"; then
9657 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
9658 func_verbose "generating symbol list for '$libname.la'"
9659 export_symbols=$output_objdir/$libname.exp
8162 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8163 func_verbose "generating symbol list for \`$libname.la'"
8164 export_symbols="$output_objdir/$libname.exp"
96608165 $opt_dry_run || $RM $export_symbols
96618166 cmds=$export_symbols_cmds
9662 save_ifs=$IFS; IFS='~'
8167 save_ifs="$IFS"; IFS='~'
96638168 for cmd1 in $cmds; do
9664 IFS=$save_ifs
8169 IFS="$save_ifs"
96658170 # Take the normal branch if the nm_file_list_spec branch
96668171 # doesn't work or if tool conversion is not needed.
96678172 case $nm_file_list_spec~$to_tool_file_cmd in
96758180 try_normal_branch=no
96768181 ;;
96778182 esac
9678 if test yes = "$try_normal_branch" \
8183 if test "$try_normal_branch" = yes \
96798184 && { test "$len" -lt "$max_cmd_len" \
96808185 || test "$max_cmd_len" -le -1; }
96818186 then
96868191 output_la=$func_basename_result
96878192 save_libobjs=$libobjs
96888193 save_output=$output
9689 output=$output_objdir/$output_la.nm
8194 output=${output_objdir}/${output_la}.nm
96908195 func_to_tool_file "$output"
96918196 libobjs=$nm_file_list_spec$func_to_tool_file_result
96928197 func_append delfiles " $output"
97098214 break
97108215 fi
97118216 done
9712 IFS=$save_ifs
9713 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
8217 IFS="$save_ifs"
8218 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
97148219 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
97158220 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
97168221 fi
97188223 fi
97198224
97208225 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9721 tmp_export_symbols=$export_symbols
9722 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
8226 tmp_export_symbols="$export_symbols"
8227 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
97238228 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
97248229 fi
97258230
9726 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
8231 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
97278232 # The given exports_symbols file has to be filtered, so filter it.
9728 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
8233 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
97298234 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9730 # 's' commands, which not all seds can handle. GNU sed should be fine
8235 # 's' commands which not all seds can handle. GNU sed should be fine
97318236 # though. Also, the filter scales superlinearly with the number of
97328237 # global variables. join(1) would be nice here, but unfortunately
97338238 # isn't a blessed tool.
97468251 ;;
97478252 esac
97488253 done
9749 deplibs=$tmp_deplibs
8254 deplibs="$tmp_deplibs"
97508255
97518256 if test -n "$convenience"; then
97528257 if test -n "$whole_archive_flag_spec" &&
9753 test yes = "$compiler_needs_object" &&
8258 test "$compiler_needs_object" = yes &&
97548259 test -z "$libobjs"; then
97558260 # extract the archives, so we have objects to list.
97568261 # TODO: could optimize this to just extract one archive.
97618266 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
97628267 test "X$libobjs" = "X " && libobjs=
97638268 else
9764 gentop=$output_objdir/${outputname}x
8269 gentop="$output_objdir/${outputname}x"
97658270 func_append generated " $gentop"
97668271
97678272 func_extract_archives $gentop $convenience
97708275 fi
97718276 fi
97728277
9773 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
8278 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
97748279 eval flag=\"$thread_safe_flag_spec\"
97758280 func_append linker_flags " $flag"
97768281 fi
97778282
97788283 # Make a backup of the uninstalled library when relinking
9779 if test relink = "$opt_mode"; then
8284 if test "$opt_mode" = relink; then
97808285 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
97818286 fi
97828287
97838288 # Do each of the archive commands.
9784 if test yes = "$module" && test -n "$module_cmds"; then
8289 if test "$module" = yes && test -n "$module_cmds" ; then
97858290 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
97868291 eval test_cmds=\"$module_expsym_cmds\"
97878292 cmds=$module_expsym_cmds
97998304 fi
98008305 fi
98018306
9802 if test : != "$skipped_export" &&
8307 if test "X$skipped_export" != "X:" &&
98038308 func_len " $test_cmds" &&
98048309 len=$func_len_result &&
98058310 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
98328337 last_robj=
98338338 k=1
98348339
9835 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
9836 output=$output_objdir/$output_la.lnkscript
8340 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8341 output=${output_objdir}/${output_la}.lnkscript
98378342 func_verbose "creating GNU ld script: $output"
98388343 echo 'INPUT (' > $output
98398344 for obj in $save_libobjs
98458350 func_append delfiles " $output"
98468351 func_to_tool_file "$output"
98478352 output=$func_to_tool_file_result
9848 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
9849 output=$output_objdir/$output_la.lnk
8353 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
8354 output=${output_objdir}/${output_la}.lnk
98508355 func_verbose "creating linker input file list: $output"
98518356 : > $output
98528357 set x $save_libobjs
98538358 shift
98548359 firstobj=
9855 if test yes = "$compiler_needs_object"; then
8360 if test "$compiler_needs_object" = yes; then
98568361 firstobj="$1 "
98578362 shift
98588363 fi
98678372 else
98688373 if test -n "$save_libobjs"; then
98698374 func_verbose "creating reloadable object files..."
9870 output=$output_objdir/$output_la-$k.$objext
8375 output=$output_objdir/$output_la-${k}.$objext
98718376 eval test_cmds=\"$reload_cmds\"
98728377 func_len " $test_cmds"
98738378 len0=$func_len_result
98798384 func_len " $obj"
98808385 func_arith $len + $func_len_result
98818386 len=$func_arith_result
9882 if test -z "$objlist" ||
8387 if test "X$objlist" = X ||
98838388 test "$len" -lt "$max_cmd_len"; then
98848389 func_append objlist " $obj"
98858390 else
98868391 # The command $test_cmds is almost too long, add a
98878392 # command to the queue.
9888 if test 1 -eq "$k"; then
8393 if test "$k" -eq 1 ; then
98898394 # The first file doesn't have a previous command to add.
98908395 reload_objs=$objlist
98918396 eval concat_cmds=\"$reload_cmds\"
98958400 reload_objs="$objlist $last_robj"
98968401 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
98978402 fi
9898 last_robj=$output_objdir/$output_la-$k.$objext
8403 last_robj=$output_objdir/$output_la-${k}.$objext
98998404 func_arith $k + 1
99008405 k=$func_arith_result
9901 output=$output_objdir/$output_la-$k.$objext
8406 output=$output_objdir/$output_la-${k}.$objext
99028407 objlist=" $obj"
99038408 func_len " $last_robj"
99048409 func_arith $len0 + $func_len_result
99108415 # files will link in the last one created.
99118416 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
99128417 reload_objs="$objlist $last_robj"
9913 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
8418 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
99148419 if test -n "$last_robj"; then
9915 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8420 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
99168421 fi
99178422 func_append delfiles " $output"
99188423
99208425 output=
99218426 fi
99228427
9923 ${skipped_export-false} && {
9924 func_verbose "generating symbol list for '$libname.la'"
9925 export_symbols=$output_objdir/$libname.exp
8428 if ${skipped_export-false}; then
8429 func_verbose "generating symbol list for \`$libname.la'"
8430 export_symbols="$output_objdir/$libname.exp"
99268431 $opt_dry_run || $RM $export_symbols
99278432 libobjs=$output
99288433 # Append the command to create the export file.
99318436 if test -n "$last_robj"; then
99328437 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
99338438 fi
9934 }
8439 fi
99358440
99368441 test -n "$save_libobjs" &&
99378442 func_verbose "creating a temporary reloadable object file: $output"
99388443
99398444 # Loop through the commands generated above and execute them.
9940 save_ifs=$IFS; IFS='~'
8445 save_ifs="$IFS"; IFS='~'
99418446 for cmd in $concat_cmds; do
9942 IFS=$save_ifs
9943 $opt_quiet || {
8447 IFS="$save_ifs"
8448 $opt_silent || {
99448449 func_quote_for_expand "$cmd"
99458450 eval "func_echo $func_quote_for_expand_result"
99468451 }
99488453 lt_exit=$?
99498454
99508455 # Restore the uninstalled library and exit
9951 if test relink = "$opt_mode"; then
8456 if test "$opt_mode" = relink; then
99528457 ( cd "$output_objdir" && \
99538458 $RM "${realname}T" && \
99548459 $MV "${realname}U" "$realname" )
99578462 exit $lt_exit
99588463 }
99598464 done
9960 IFS=$save_ifs
8465 IFS="$save_ifs"
99618466
99628467 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
99638468 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
99658470 fi
99668471 fi
99678472
9968 ${skipped_export-false} && {
8473 if ${skipped_export-false}; then
99698474 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9970 tmp_export_symbols=$export_symbols
9971 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
8475 tmp_export_symbols="$export_symbols"
8476 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
99728477 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
99738478 fi
99748479
99758480 if test -n "$orig_export_symbols"; then
99768481 # The given exports_symbols file has to be filtered, so filter it.
9977 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
8482 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
99788483 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9979 # 's' commands, which not all seds can handle. GNU sed should be fine
8484 # 's' commands which not all seds can handle. GNU sed should be fine
99808485 # though. Also, the filter scales superlinearly with the number of
99818486 # global variables. join(1) would be nice here, but unfortunately
99828487 # isn't a blessed tool.
99858490 export_symbols=$output_objdir/$libname.def
99868491 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
99878492 fi
9988 }
8493 fi
99898494
99908495 libobjs=$output
99918496 # Restore the value of output.
99998504 # value of $libobjs for piecewise linking.
100008505
100018506 # Do each of the archive commands.
10002 if test yes = "$module" && test -n "$module_cmds"; then
8507 if test "$module" = yes && test -n "$module_cmds" ; then
100038508 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
100048509 cmds=$module_expsym_cmds
100058510 else
100218526
100228527 # Add any objects from preloaded convenience libraries
100238528 if test -n "$dlprefiles"; then
10024 gentop=$output_objdir/${outputname}x
8529 gentop="$output_objdir/${outputname}x"
100258530 func_append generated " $gentop"
100268531
100278532 func_extract_archives $gentop $dlprefiles
100298534 test "X$libobjs" = "X " && libobjs=
100308535 fi
100318536
10032 save_ifs=$IFS; IFS='~'
8537 save_ifs="$IFS"; IFS='~'
100338538 for cmd in $cmds; do
10034 IFS=$sp$nl
8539 IFS="$save_ifs"
100358540 eval cmd=\"$cmd\"
10036 IFS=$save_ifs
10037 $opt_quiet || {
8541 $opt_silent || {
100388542 func_quote_for_expand "$cmd"
100398543 eval "func_echo $func_quote_for_expand_result"
100408544 }
100428546 lt_exit=$?
100438547
100448548 # Restore the uninstalled library and exit
10045 if test relink = "$opt_mode"; then
8549 if test "$opt_mode" = relink; then
100468550 ( cd "$output_objdir" && \
100478551 $RM "${realname}T" && \
100488552 $MV "${realname}U" "$realname" )
100518555 exit $lt_exit
100528556 }
100538557 done
10054 IFS=$save_ifs
8558 IFS="$save_ifs"
100558559
100568560 # Restore the uninstalled library and exit
10057 if test relink = "$opt_mode"; then
8561 if test "$opt_mode" = relink; then
100588562 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
100598563
100608564 if test -n "$convenience"; then
100748578 done
100758579
100768580 # If -module or -export-dynamic was specified, set the dlname.
10077 if test yes = "$module" || test yes = "$export_dynamic"; then
8581 if test "$module" = yes || test "$export_dynamic" = yes; then
100788582 # On all known operating systems, these are identical.
10079 dlname=$soname
8583 dlname="$soname"
100808584 fi
100818585 fi
100828586 ;;
100838587
100848588 obj)
10085 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10086 func_warning "'-dlopen' is ignored for objects"
8589 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8590 func_warning "\`-dlopen' is ignored for objects"
100878591 fi
100888592
100898593 case " $deplibs" in
100908594 *\ -l* | *\ -L*)
10091 func_warning "'-l' and '-L' are ignored for objects" ;;
8595 func_warning "\`-l' and \`-L' are ignored for objects" ;;
100928596 esac
100938597
100948598 test -n "$rpath" && \
10095 func_warning "'-rpath' is ignored for objects"
8599 func_warning "\`-rpath' is ignored for objects"
100968600
100978601 test -n "$xrpath" && \
10098 func_warning "'-R' is ignored for objects"
8602 func_warning "\`-R' is ignored for objects"
100998603
101008604 test -n "$vinfo" && \
10101 func_warning "'-version-info' is ignored for objects"
8605 func_warning "\`-version-info' is ignored for objects"
101028606
101038607 test -n "$release" && \
10104 func_warning "'-release' is ignored for objects"
8608 func_warning "\`-release' is ignored for objects"
101058609
101068610 case $output in
101078611 *.lo)
101088612 test -n "$objs$old_deplibs" && \
10109 func_fatal_error "cannot build library object '$output' from non-libtool objects"
8613 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
101108614
101118615 libobj=$output
101128616 func_lo2o "$libobj"
101148618 ;;
101158619 *)
101168620 libobj=
10117 obj=$output
8621 obj="$output"
101188622 ;;
101198623 esac
101208624
101278631 # the extraction.
101288632 reload_conv_objs=
101298633 gentop=
10130 # if reload_cmds runs $LD directly, get rid of -Wl from
10131 # whole_archive_flag_spec and hope we can get by with turning comma
10132 # into space.
10133 case $reload_cmds in
10134 *\$LD[\ \$]*) wl= ;;
10135 esac
8634 # reload_cmds runs $LD directly, so let us get rid of
8635 # -Wl from whole_archive_flag_spec and hope we can get by with
8636 # turning comma into space..
8637 wl=
8638
101368639 if test -n "$convenience"; then
101378640 if test -n "$whole_archive_flag_spec"; then
101388641 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10139 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10140 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
8642 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
101418643 else
10142 gentop=$output_objdir/${obj}x
8644 gentop="$output_objdir/${obj}x"
101438645 func_append generated " $gentop"
101448646
101458647 func_extract_archives $gentop $convenience
101488650 fi
101498651
101508652 # If we're not building shared, we need to use non_pic_objs
10151 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
8653 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
101528654
101538655 # Create the old-style object.
10154 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10155
10156 output=$obj
8656 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
8657
8658 output="$obj"
101578659 func_execute_cmds "$reload_cmds" 'exit $?'
101588660
101598661 # Exit if we aren't doing a library object file.
101658667 exit $EXIT_SUCCESS
101668668 fi
101678669
10168 test yes = "$build_libtool_libs" || {
8670 if test "$build_libtool_libs" != yes; then
101698671 if test -n "$gentop"; then
101708672 func_show_eval '${RM}r "$gentop"'
101718673 fi
101758677 # $show "echo timestamp > $libobj"
101768678 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
101778679 exit $EXIT_SUCCESS
10178 }
10179
10180 if test -n "$pic_flag" || test default != "$pic_mode"; then
8680 fi
8681
8682 if test -n "$pic_flag" || test "$pic_mode" != default; then
101818683 # Only do commands if we really have different PIC objects.
101828684 reload_objs="$libobjs $reload_conv_objs"
10183 output=$libobj
8685 output="$libobj"
101848686 func_execute_cmds "$reload_cmds" 'exit $?'
101858687 fi
101868688
101978699 output=$func_stripname_result.exe;;
101988700 esac
101998701 test -n "$vinfo" && \
10200 func_warning "'-version-info' is ignored for programs"
8702 func_warning "\`-version-info' is ignored for programs"
102018703
102028704 test -n "$release" && \
10203 func_warning "'-release' is ignored for programs"
10204
10205 $preload \
10206 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10207 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
8705 func_warning "\`-release' is ignored for programs"
8706
8707 test "$preload" = yes \
8708 && test "$dlopen_support" = unknown \
8709 && test "$dlopen_self" = unknown \
8710 && test "$dlopen_self_static" = unknown && \
8711 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
102088712
102098713 case $host in
102108714 *-*-rhapsody* | *-*-darwin1.[012])
102188722 *-*-darwin*)
102198723 # Don't allow lazy linking, it breaks C++ global constructors
102208724 # But is supposedly fixed on 10.4 or later (yay!).
10221 if test CXX = "$tagname"; then
8725 if test "$tagname" = CXX ; then
102228726 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
102238727 10.[0123])
10224 func_append compile_command " $wl-bind_at_load"
10225 func_append finalize_command " $wl-bind_at_load"
8728 func_append compile_command " ${wl}-bind_at_load"
8729 func_append finalize_command " ${wl}-bind_at_load"
102268730 ;;
102278731 esac
102288732 fi
102588762 *) func_append new_libs " $deplib" ;;
102598763 esac
102608764 done
10261 compile_deplibs=$new_libs
8765 compile_deplibs="$new_libs"
102628766
102638767
102648768 func_append compile_command " $compile_deplibs"
102828786 if test -n "$hardcode_libdir_flag_spec"; then
102838787 if test -n "$hardcode_libdir_separator"; then
102848788 if test -z "$hardcode_libdirs"; then
10285 hardcode_libdirs=$libdir
8789 hardcode_libdirs="$libdir"
102868790 else
102878791 # Just accumulate the unique libdirs.
102888792 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
103058809 fi
103068810 case $host in
103078811 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10308 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
8812 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
103098813 case :$dllsearchpath: in
103108814 *":$libdir:"*) ;;
103118815 ::) dllsearchpath=$libdir;;
103228826 # Substitute the hardcoded libdirs into the rpath.
103238827 if test -n "$hardcode_libdir_separator" &&
103248828 test -n "$hardcode_libdirs"; then
10325 libdir=$hardcode_libdirs
8829 libdir="$hardcode_libdirs"
103268830 eval rpath=\" $hardcode_libdir_flag_spec\"
103278831 fi
10328 compile_rpath=$rpath
8832 compile_rpath="$rpath"
103298833
103308834 rpath=
103318835 hardcode_libdirs=
103338837 if test -n "$hardcode_libdir_flag_spec"; then
103348838 if test -n "$hardcode_libdir_separator"; then
103358839 if test -z "$hardcode_libdirs"; then
10336 hardcode_libdirs=$libdir
8840 hardcode_libdirs="$libdir"
103378841 else
103388842 # Just accumulate the unique libdirs.
103398843 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
103588862 # Substitute the hardcoded libdirs into the rpath.
103598863 if test -n "$hardcode_libdir_separator" &&
103608864 test -n "$hardcode_libdirs"; then
10361 libdir=$hardcode_libdirs
8865 libdir="$hardcode_libdirs"
103628866 eval rpath=\" $hardcode_libdir_flag_spec\"
103638867 fi
10364 finalize_rpath=$rpath
10365
10366 if test -n "$libobjs" && test yes = "$build_old_libs"; then
8868 finalize_rpath="$rpath"
8869
8870 if test -n "$libobjs" && test "$build_old_libs" = yes; then
103678871 # Transform all the library objects into standard objects.
103688872 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
103698873 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
103708874 fi
103718875
10372 func_generate_dlsyms "$outputname" "@PROGRAM@" false
8876 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
103738877
103748878 # template prelinking step
103758879 if test -n "$prelink_cmds"; then
103768880 func_execute_cmds "$prelink_cmds" 'exit $?'
103778881 fi
103788882
10379 wrappers_required=:
8883 wrappers_required=yes
103808884 case $host in
103818885 *cegcc* | *mingw32ce*)
103828886 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10383 wrappers_required=false
8887 wrappers_required=no
103848888 ;;
103858889 *cygwin* | *mingw* )
10386 test yes = "$build_libtool_libs" || wrappers_required=false
8890 if test "$build_libtool_libs" != yes; then
8891 wrappers_required=no
8892 fi
103878893 ;;
103888894 *)
10389 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10390 wrappers_required=false
8895 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8896 wrappers_required=no
103918897 fi
103928898 ;;
103938899 esac
10394 $wrappers_required || {
8900 if test "$wrappers_required" = no; then
103958901 # Replace the output file specification.
103968902 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10397 link_command=$compile_command$compile_rpath
8903 link_command="$compile_command$compile_rpath"
103988904
103998905 # We have no uninstalled library dependencies, so finalize right now.
104008906 exit_status=0
104078913 fi
104088914
104098915 # Delete the generated files.
10410 if test -f "$output_objdir/${outputname}S.$objext"; then
10411 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
8916 if test -f "$output_objdir/${outputname}S.${objext}"; then
8917 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
104128918 fi
104138919
104148920 exit $exit_status
10415 }
8921 fi
104168922
104178923 if test -n "$compile_shlibpath$finalize_shlibpath"; then
104188924 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
104428948 fi
104438949 fi
104448950
10445 if test yes = "$no_install"; then
8951 if test "$no_install" = yes; then
104468952 # We don't need to create a wrapper script.
10447 link_command=$compile_var$compile_command$compile_rpath
8953 link_command="$compile_var$compile_command$compile_rpath"
104488954 # Replace the output file specification.
104498955 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
104508956 # Delete the old output file.
104618967 exit $EXIT_SUCCESS
104628968 fi
104638969
10464 case $hardcode_action,$fast_install in
10465 relink,*)
10466 # Fast installation is not supported
10467 link_command=$compile_var$compile_command$compile_rpath
10468 relink_command=$finalize_var$finalize_command$finalize_rpath
10469
10470 func_warning "this platform does not like uninstalled shared libraries"
10471 func_warning "'$output' will be relinked during installation"
10472 ;;
10473 *,yes)
10474 link_command=$finalize_var$compile_command$finalize_rpath
10475 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10476 ;;
10477 *,no)
10478 link_command=$compile_var$compile_command$compile_rpath
10479 relink_command=$finalize_var$finalize_command$finalize_rpath
10480 ;;
10481 *,needless)
10482 link_command=$finalize_var$compile_command$finalize_rpath
10483 relink_command=
10484 ;;
10485 esac
8970 if test "$hardcode_action" = relink; then
8971 # Fast installation is not supported
8972 link_command="$compile_var$compile_command$compile_rpath"
8973 relink_command="$finalize_var$finalize_command$finalize_rpath"
8974
8975 func_warning "this platform does not like uninstalled shared libraries"
8976 func_warning "\`$output' will be relinked during installation"
8977 else
8978 if test "$fast_install" != no; then
8979 link_command="$finalize_var$compile_command$finalize_rpath"
8980 if test "$fast_install" = yes; then
8981 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
8982 else
8983 # fast_install is set to needless
8984 relink_command=
8985 fi
8986 else
8987 link_command="$compile_var$compile_command$compile_rpath"
8988 relink_command="$finalize_var$finalize_command$finalize_rpath"
8989 fi
8990 fi
104868991
104878992 # Replace the output file specification.
104888993 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
105399044 func_dirname_and_basename "$output" "" "."
105409045 output_name=$func_basename_result
105419046 output_path=$func_dirname_result
10542 cwrappersource=$output_path/$objdir/lt-$output_name.c
10543 cwrapper=$output_path/$output_name.exe
9047 cwrappersource="$output_path/$objdir/lt-$output_name.c"
9048 cwrapper="$output_path/$output_name.exe"
105449049 $RM $cwrappersource $cwrapper
105459050 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
105469051
105619066 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
105629067 $opt_dry_run || {
105639068 # note: this script will not be executed, so do not chmod.
10564 if test "x$build" = "x$host"; then
9069 if test "x$build" = "x$host" ; then
105659070 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
105669071 else
105679072 func_emit_wrapper no > $func_ltwrapper_scriptname_result
105849089 # See if we need to build an old-fashioned archive.
105859090 for oldlib in $oldlibs; do
105869091
10587 case $build_libtool_libs in
10588 convenience)
10589 oldobjs="$libobjs_save $symfileobj"
10590 addlibs=$convenience
9092 if test "$build_libtool_libs" = convenience; then
9093 oldobjs="$libobjs_save $symfileobj"
9094 addlibs="$convenience"
9095 build_libtool_libs=no
9096 else
9097 if test "$build_libtool_libs" = module; then
9098 oldobjs="$libobjs_save"
105919099 build_libtool_libs=no
10592 ;;
10593 module)
10594 oldobjs=$libobjs_save
10595 addlibs=$old_convenience
10596 build_libtool_libs=no
10597 ;;
10598 *)
9100 else
105999101 oldobjs="$old_deplibs $non_pic_objects"
10600 $preload && test -f "$symfileobj" \
10601 && func_append oldobjs " $symfileobj"
10602 addlibs=$old_convenience
10603 ;;
10604 esac
9102 if test "$preload" = yes && test -f "$symfileobj"; then
9103 func_append oldobjs " $symfileobj"
9104 fi
9105 fi
9106 addlibs="$old_convenience"
9107 fi
106059108
106069109 if test -n "$addlibs"; then
10607 gentop=$output_objdir/${outputname}x
9110 gentop="$output_objdir/${outputname}x"
106089111 func_append generated " $gentop"
106099112
106109113 func_extract_archives $gentop $addlibs
106129115 fi
106139116
106149117 # Do each command in the archive commands.
10615 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
9118 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
106169119 cmds=$old_archive_from_new_cmds
106179120 else
106189121
106199122 # Add any objects from preloaded convenience libraries
106209123 if test -n "$dlprefiles"; then
10621 gentop=$output_objdir/${outputname}x
9124 gentop="$output_objdir/${outputname}x"
106229125 func_append generated " $gentop"
106239126
106249127 func_extract_archives $gentop $dlprefiles
106399142 :
106409143 else
106419144 echo "copying selected object files to avoid basename conflicts..."
10642 gentop=$output_objdir/${outputname}x
9145 gentop="$output_objdir/${outputname}x"
106439146 func_append generated " $gentop"
106449147 func_mkdir_p "$gentop"
106459148 save_oldobjs=$oldobjs
106489151 for obj in $save_oldobjs
106499152 do
106509153 func_basename "$obj"
10651 objbase=$func_basename_result
9154 objbase="$func_basename_result"
106529155 case " $oldobjs " in
106539156 " ") oldobjs=$obj ;;
106549157 *[\ /]"$objbase "*)
107179220 else
107189221 # the above command should be used before it gets too long
107199222 oldobjs=$objlist
10720 if test "$obj" = "$last_oldobj"; then
9223 if test "$obj" = "$last_oldobj" ; then
107219224 RANLIB=$save_RANLIB
107229225 fi
107239226 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10724 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
9227 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
107259228 objlist=
107269229 len=$len0
107279230 fi
107289231 done
107299232 RANLIB=$save_RANLIB
107309233 oldobjs=$objlist
10731 if test -z "$oldobjs"; then
9234 if test "X$oldobjs" = "X" ; then
107329235 eval cmds=\"\$concat_cmds\"
107339236 else
107349237 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
107459248 case $output in
107469249 *.la)
107479250 old_library=
10748 test yes = "$build_old_libs" && old_library=$libname.$libext
9251 test "$build_old_libs" = yes && old_library="$libname.$libext"
107499252 func_verbose "creating $output"
107509253
107519254 # Preserve any variables that may affect compiler behavior
107609263 fi
107619264 done
107629265 # Quote the link command for shipping.
10763 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9266 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
107649267 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10765 if test yes = "$hardcode_automatic"; then
9268 if test "$hardcode_automatic" = yes ; then
107669269 relink_command=
107679270 fi
107689271
107699272 # Only create the output if not a dry run.
107709273 $opt_dry_run || {
107719274 for installed in no yes; do
10772 if test yes = "$installed"; then
9275 if test "$installed" = yes; then
107739276 if test -z "$install_libdir"; then
107749277 break
107759278 fi
10776 output=$output_objdir/${outputname}i
9279 output="$output_objdir/$outputname"i
107779280 # Replace all uninstalled libtool libraries with the installed ones
107789281 newdependency_libs=
107799282 for deplib in $dependency_libs; do
107809283 case $deplib in
107819284 *.la)
107829285 func_basename "$deplib"
10783 name=$func_basename_result
9286 name="$func_basename_result"
107849287 func_resolve_sysroot "$deplib"
10785 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9288 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
107869289 test -z "$libdir" && \
10787 func_fatal_error "'$deplib' is not a valid libtool archive"
9290 func_fatal_error "\`$deplib' is not a valid libtool archive"
107889291 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
107899292 ;;
107909293 -L*)
108009303 *) func_append newdependency_libs " $deplib" ;;
108019304 esac
108029305 done
10803 dependency_libs=$newdependency_libs
9306 dependency_libs="$newdependency_libs"
108049307 newdlfiles=
108059308
108069309 for lib in $dlfiles; do
108079310 case $lib in
108089311 *.la)
108099312 func_basename "$lib"
10810 name=$func_basename_result
10811 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9313 name="$func_basename_result"
9314 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
108129315 test -z "$libdir" && \
10813 func_fatal_error "'$lib' is not a valid libtool archive"
9316 func_fatal_error "\`$lib' is not a valid libtool archive"
108149317 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
108159318 ;;
108169319 *) func_append newdlfiles " $lib" ;;
108179320 esac
108189321 done
10819 dlfiles=$newdlfiles
9322 dlfiles="$newdlfiles"
108209323 newdlprefiles=
108219324 for lib in $dlprefiles; do
108229325 case $lib in
108269329 # didn't already link the preopened objects directly into
108279330 # the library:
108289331 func_basename "$lib"
10829 name=$func_basename_result
10830 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9332 name="$func_basename_result"
9333 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
108319334 test -z "$libdir" && \
10832 func_fatal_error "'$lib' is not a valid libtool archive"
9335 func_fatal_error "\`$lib' is not a valid libtool archive"
108339336 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
108349337 ;;
108359338 esac
108369339 done
10837 dlprefiles=$newdlprefiles
9340 dlprefiles="$newdlprefiles"
108389341 else
108399342 newdlfiles=
108409343 for lib in $dlfiles; do
108419344 case $lib in
10842 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
9345 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
108439346 *) abs=`pwd`"/$lib" ;;
108449347 esac
108459348 func_append newdlfiles " $abs"
108469349 done
10847 dlfiles=$newdlfiles
9350 dlfiles="$newdlfiles"
108489351 newdlprefiles=
108499352 for lib in $dlprefiles; do
108509353 case $lib in
10851 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
9354 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
108529355 *) abs=`pwd`"/$lib" ;;
108539356 esac
108549357 func_append newdlprefiles " $abs"
108559358 done
10856 dlprefiles=$newdlprefiles
9359 dlprefiles="$newdlprefiles"
108579360 fi
108589361 $RM $output
108599362 # place dlname in correct position for cygwin
108699372 case $host,$output,$installed,$module,$dlname in
108709373 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
108719374 # If a -bindir argument was supplied, place the dll there.
10872 if test -n "$bindir"; then
9375 if test "x$bindir" != x ;
9376 then
108739377 func_relative_path "$install_libdir" "$bindir"
10874 tdlname=$func_relative_path_result/$dlname
9378 tdlname=$func_relative_path_result$dlname
108759379 else
108769380 # Otherwise fall back on heuristic.
108779381 tdlname=../bin/$dlname
108809384 esac
108819385 $ECHO > $output "\
108829386 # $outputname - a libtool library file
10883 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
9387 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
108849388 #
108859389 # Please DO NOT delete this file!
108869390 # It is necessary for linking the library.
108949398 # The name of the static archive.
108959399 old_library='$old_library'
108969400
10897 # Linker flags that cannot go in dependency_libs.
9401 # Linker flags that can not go in dependency_libs.
108989402 inherited_linker_flags='$new_inherited_linker_flags'
108999403
109009404 # Libraries that this one depends upon.
109209424
109219425 # Directory that this library needs to be installed in:
109229426 libdir='$install_libdir'"
10923 if test no,yes = "$installed,$need_relink"; then
9427 if test "$installed" = no && test "$need_relink" = yes; then
109249428 $ECHO >> $output "\
109259429 relink_command=\"$relink_command\""
109269430 fi
109359439 exit $EXIT_SUCCESS
109369440 }
109379441
10938 if test link = "$opt_mode" || test relink = "$opt_mode"; then
10939 func_mode_link ${1+"$@"}
10940 fi
9442 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
9443 func_mode_link ${1+"$@"}
109419444
109429445
109439446 # func_mode_uninstall arg...
109449447 func_mode_uninstall ()
109459448 {
10946 $debug_cmd
10947
10948 RM=$nonopt
9449 $opt_debug
9450 RM="$nonopt"
109499451 files=
10950 rmforce=false
9452 rmforce=
109519453 exit_status=0
109529454
109539455 # This variable tells wrapper scripts just to set variables rather
109549456 # than running their programs.
10955 libtool_install_magic=$magic
9457 libtool_install_magic="$magic"
109569458
109579459 for arg
109589460 do
109599461 case $arg in
10960 -f) func_append RM " $arg"; rmforce=: ;;
9462 -f) func_append RM " $arg"; rmforce=yes ;;
109619463 -*) func_append RM " $arg" ;;
109629464 *) func_append files " $arg" ;;
109639465 esac
109709472
109719473 for file in $files; do
109729474 func_dirname "$file" "" "."
10973 dir=$func_dirname_result
10974 if test . = "$dir"; then
10975 odir=$objdir
9475 dir="$func_dirname_result"
9476 if test "X$dir" = X.; then
9477 odir="$objdir"
109769478 else
10977 odir=$dir/$objdir
9479 odir="$dir/$objdir"
109789480 fi
109799481 func_basename "$file"
10980 name=$func_basename_result
10981 test uninstall = "$opt_mode" && odir=$dir
9482 name="$func_basename_result"
9483 test "$opt_mode" = uninstall && odir="$dir"
109829484
109839485 # Remember odir for removal later, being careful to avoid duplicates
10984 if test clean = "$opt_mode"; then
9486 if test "$opt_mode" = clean; then
109859487 case " $rmdirs " in
109869488 *" $odir "*) ;;
109879489 *) func_append rmdirs " $odir" ;;
109969498 elif test -d "$file"; then
109979499 exit_status=1
109989500 continue
10999 elif $rmforce; then
9501 elif test "$rmforce" = yes; then
110009502 continue
110019503 fi
110029504
11003 rmfiles=$file
9505 rmfiles="$file"
110049506
110059507 case $name in
110069508 *.la)
110149516 done
110159517 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
110169518
11017 case $opt_mode in
9519 case "$opt_mode" in
110189520 clean)
110199521 case " $library_names " in
110209522 *" $dlname "*) ;;
110259527 uninstall)
110269528 if test -n "$library_names"; then
110279529 # Do each command in the postuninstall commands.
11028 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
9530 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
110299531 fi
110309532
110319533 if test -n "$old_library"; then
110329534 # Do each command in the old_postuninstall commands.
11033 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
9535 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
110349536 fi
110359537 # FIXME: should reinstall the best remaining shared library.
110369538 ;;
110469548 func_source $dir/$name
110479549
110489550 # Add PIC object to the list of files to remove.
11049 if test -n "$pic_object" && test none != "$pic_object"; then
9551 if test -n "$pic_object" &&
9552 test "$pic_object" != none; then
110509553 func_append rmfiles " $dir/$pic_object"
110519554 fi
110529555
110539556 # Add non-PIC object to the list of files to remove.
11054 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
9557 if test -n "$non_pic_object" &&
9558 test "$non_pic_object" != none; then
110559559 func_append rmfiles " $dir/$non_pic_object"
110569560 fi
110579561 fi
110589562 ;;
110599563
110609564 *)
11061 if test clean = "$opt_mode"; then
9565 if test "$opt_mode" = clean ; then
110629566 noexename=$name
110639567 case $file in
110649568 *.exe)
110859589
110869590 # note $name still contains .exe if it was in $file originally
110879591 # as does the version of $file that was added into $rmfiles
11088 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11089 if test yes = "$fast_install" && test -n "$relink_command"; then
9592 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
9593 if test "$fast_install" = yes && test -n "$relink_command"; then
110909594 func_append rmfiles " $odir/lt-$name"
110919595 fi
11092 if test "X$noexename" != "X$name"; then
11093 func_append rmfiles " $odir/lt-$noexename.c"
9596 if test "X$noexename" != "X$name" ; then
9597 func_append rmfiles " $odir/lt-${noexename}.c"
110949598 fi
110959599 fi
110969600 fi
110999603 func_show_eval "$RM $rmfiles" 'exit_status=1'
111009604 done
111019605
11102 # Try to remove the $objdir's in the directories where we deleted files
9606 # Try to remove the ${objdir}s in the directories where we deleted files
111039607 for dir in $rmdirs; do
111049608 if test -d "$dir"; then
111059609 func_show_eval "rmdir $dir >/dev/null 2>&1"
111099613 exit $exit_status
111109614 }
111119615
11112 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11113 func_mode_uninstall ${1+"$@"}
11114 fi
9616 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
9617 func_mode_uninstall ${1+"$@"}
111159618
111169619 test -z "$opt_mode" && {
11117 help=$generic_help
9620 help="$generic_help"
111189621 func_fatal_help "you must specify a MODE"
111199622 }
111209623
111219624 test -z "$exec_cmd" && \
11122 func_fatal_help "invalid operation mode '$opt_mode'"
9625 func_fatal_help "invalid operation mode \`$opt_mode'"
111239626
111249627 if test -n "$exec_cmd"; then
111259628 eval exec "$exec_cmd"
111309633
111319634
111329635 # The TAGs below are defined such that we never get into a situation
11133 # where we disable both kinds of libraries. Given conflicting
9636 # in which we disable both kinds of libraries. Given conflicting
111349637 # choices, we go for a static library, that is the most portable,
111359638 # since we can't tell whether shared libraries were disabled because
111369639 # the user asked for that or because the platform doesn't support
111539656 # mode:shell-script
111549657 # sh-indentation:2
111559658 # End:
9659 # vi:sw=2
9660
0 AC_DEFUN([AC_C_CXX_COMPILE_FLAGS],[
1 NEW_CFLAGS="$CFLAGS"
2 NEW_CXXFLAGS="$CXXFLAGS"
3 for ac_flag in $1
4 do
5 AC_MSG_CHECKING(whether compiler supports $ac_flag)
6 CXXFLAGS="$NEW_CXXFLAGS $ac_flag"
7 AC_LANG(C++)
8 AC_TRY_COMPILE(,[
9 ;
10 ],[
11
12 NEW_CFLAGS="$NEW_CFLAGS $ac_flag"
13 NEW_CXXFLAGS="$NEW_CXXFLAGS $ac_flag"
14
15 AC_MSG_RESULT(yes)
16 ],AC_MSG_RESULT(no))
17 done
18
19 CFLAGS=$NEW_CFLAGS
20 CXXFLAGS=$NEW_CXXFLAGS
21 ])
00 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
11 #
2 # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc.
2 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
3 # 2006, 2007, 2008, 2009, 2010, 2011 Free Software
4 # Foundation, Inc.
35 # Written by Gordon Matzigkeit, 1996
46 #
57 # This file is free software; the Free Software Foundation gives
79 # modifications, as long as this notice is preserved.
810
911 m4_define([_LT_COPYING], [dnl
10 # Copyright (C) 2014 Free Software Foundation, Inc.
11 # This is free software; see the source for copying conditions. There is NO
12 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14 # GNU Libtool is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of of the License, or
17 # (at your option) any later version.
12 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
13 # 2006, 2007, 2008, 2009, 2010, 2011 Free Software
14 # Foundation, Inc.
15 # Written by Gordon Matzigkeit, 1996
1816 #
19 # As a special exception to the GNU General Public License, if you
20 # distribute this file as part of a program or library that is built
21 # using GNU Libtool, you may include this file under the same
22 # distribution terms that you use for the rest of that program.
17 # This file is part of GNU Libtool.
2318 #
24 # GNU Libtool is distributed in the hope that it will be useful, but
25 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # GNU Libtool is free software; you can redistribute it and/or
20 # modify it under the terms of the GNU General Public License as
21 # published by the Free Software Foundation; either version 2 of
22 # the License, or (at your option) any later version.
23 #
24 # As a special exception to the GNU General Public License,
25 # if you distribute this file as part of a program or library that
26 # is built using GNU Libtool, you may include this file under the
27 # same distribution terms that you use for the rest of that program.
28 #
29 # GNU Libtool is distributed in the hope that it will be useful,
30 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2631 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2732 # GNU General Public License for more details.
2833 #
2934 # You should have received a copy of the GNU General Public License
30 # along with this program. If not, see <http://www.gnu.org/licenses/>.
35 # along with GNU Libtool; see the file COPYING. If not, a copy
36 # can be downloaded from http://www.gnu.org/licenses/gpl.html, or
37 # obtained by writing to the Free Software Foundation, Inc.,
38 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
3139 ])
3240
33 # serial 58 LT_INIT
41 # serial 57 LT_INIT
3442
3543
3644 # LT_PREREQ(VERSION)
5866 # LT_INIT([OPTIONS])
5967 # ------------------
6068 AC_DEFUN([LT_INIT],
61 [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK
69 [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
6270 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
6371 AC_BEFORE([$0], [LT_LANG])dnl
6472 AC_BEFORE([$0], [LT_OUTPUT])dnl
8290 _LT_SET_OPTIONS([$0], [$1])
8391
8492 # This can be used to rebuild libtool when needed
85 LIBTOOL_DEPS=$ltmain
93 LIBTOOL_DEPS="$ltmain"
8694
8795 # Always use our own libtool.
8896 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
102110 dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
103111
104112
105 # _LT_PREPARE_CC_BASENAME
106 # -----------------------
107 m4_defun([_LT_PREPARE_CC_BASENAME], [
108 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
109 func_cc_basename ()
110 {
111 for cc_temp in @S|@*""; do
112 case $cc_temp in
113 compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
114 distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
115 \-*) ;;
116 *) break;;
117 esac
118 done
119 func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
120 }
121 ])# _LT_PREPARE_CC_BASENAME
122
123
124113 # _LT_CC_BASENAME(CC)
125114 # -------------------
126 # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME,
127 # but that macro is also expanded into generated libtool script, which
128 # arranges for $SED and $ECHO to be set by different means.
115 # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
129116 m4_defun([_LT_CC_BASENAME],
130 [m4_require([_LT_PREPARE_CC_BASENAME])dnl
131 AC_REQUIRE([_LT_DECL_SED])dnl
132 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
133 func_cc_basename $1
134 cc_basename=$func_cc_basename_result
117 [for cc_temp in $1""; do
118 case $cc_temp in
119 compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
120 distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
121 \-*) ;;
122 *) break;;
123 esac
124 done
125 cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
135126 ])
136127
137128
138129 # _LT_FILEUTILS_DEFAULTS
139130 # ----------------------
140131 # It is okay to use these file commands and assume they have been set
141 # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'.
132 # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
142133 m4_defun([_LT_FILEUTILS_DEFAULTS],
143134 [: ${CP="cp -f"}
144135 : ${MV="mv -f"}
185176 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
186177 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
187178 m4_require([_LT_WITH_SYSROOT])dnl
188 m4_require([_LT_CMD_TRUNCATE])dnl
189179
190180 _LT_CONFIG_LIBTOOL_INIT([
191 # See if we are running on zsh, and set the options that allow our
181 # See if we are running on zsh, and set the options which allow our
192182 # commands through without removal of \ escapes INIT.
193 if test -n "\${ZSH_VERSION+set}"; then
183 if test -n "\${ZSH_VERSION+set}" ; then
194184 setopt NO_GLOB_SUBST
195185 fi
196186 ])
197 if test -n "${ZSH_VERSION+set}"; then
187 if test -n "${ZSH_VERSION+set}" ; then
198188 setopt NO_GLOB_SUBST
199189 fi
200190
207197 # AIX sometimes has problems with the GCC collect2 program. For some
208198 # reason, if we set the COLLECT_NAMES environment variable, the problems
209199 # vanish in a puff of smoke.
210 if test set != "${COLLECT_NAMES+set}"; then
200 if test "X${COLLECT_NAMES+set}" != Xset; then
211201 COLLECT_NAMES=
212202 export COLLECT_NAMES
213203 fi
218208 ofile=libtool
219209 can_build_shared=yes
220210
221 # All known linkers require a '.a' archive for static linking (except MSVC,
211 # All known linkers require a `.a' archive for static linking (except MSVC,
222212 # which needs '.lib').
223213 libext=a
224214
225 with_gnu_ld=$lt_cv_prog_gnu_ld
226
227 old_CC=$CC
228 old_CFLAGS=$CFLAGS
215 with_gnu_ld="$lt_cv_prog_gnu_ld"
216
217 old_CC="$CC"
218 old_CFLAGS="$CFLAGS"
229219
230220 # Set sane defaults for various variables
231221 test -z "$CC" && CC=cc
278268
279269 # _LT_PROG_LTMAIN
280270 # ---------------
281 # Note that this code is called both from 'configure', and 'config.status'
271 # Note that this code is called both from `configure', and `config.status'
282272 # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
283 # 'config.status' has no value for ac_aux_dir unless we are using Automake,
273 # `config.status' has no value for ac_aux_dir unless we are using Automake,
284274 # so we pass a copy along to make sure it has a sensible value anyway.
285275 m4_defun([_LT_PROG_LTMAIN],
286276 [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
287277 _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
288 ltmain=$ac_aux_dir/ltmain.sh
278 ltmain="$ac_aux_dir/ltmain.sh"
289279 ])# _LT_PROG_LTMAIN
290280
291281
295285
296286 # So that we can recreate a full libtool script including additional
297287 # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
298 # in macros and then make a single call at the end using the 'libtool'
288 # in macros and then make a single call at the end using the `libtool'
299289 # label.
300290
301291
430420
431421 # _LT_CONFIG_STATUS_DECLARE([VARNAME])
432422 # ------------------------------------
433 # Quote a variable value, and forward it to 'config.status' so that its
434 # declaration there will have the same value as in 'configure'. VARNAME
423 # Quote a variable value, and forward it to `config.status' so that its
424 # declaration there will have the same value as in `configure'. VARNAME
435425 # must have a single quote delimited value for this to work.
436426 m4_define([_LT_CONFIG_STATUS_DECLARE],
437427 [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
455445 # Output comment and list of tags supported by the script
456446 m4_defun([_LT_LIBTOOL_TAGS],
457447 [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
458 available_tags='_LT_TAGS'dnl
448 available_tags="_LT_TAGS"dnl
459449 ])
460450
461451
483473 # _LT_LIBTOOL_CONFIG_VARS
484474 # -----------------------
485475 # Produce commented declarations of non-tagged libtool config variables
486 # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool'
476 # suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
487477 # script. Tagged libtool config variables (even for the LIBTOOL CONFIG
488478 # section) are produced by _LT_LIBTOOL_TAG_VARS.
489479 m4_defun([_LT_LIBTOOL_CONFIG_VARS],
509499 # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
510500 # variables for single and double quote escaping we saved from calls
511501 # to _LT_DECL, we can put quote escaped variables declarations
512 # into 'config.status', and then the shell code to quote escape them in
513 # for loops in 'config.status'. Finally, any additional code accumulated
502 # into `config.status', and then the shell code to quote escape them in
503 # for loops in `config.status'. Finally, any additional code accumulated
514504 # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
515505 m4_defun([_LT_CONFIG_COMMANDS],
516506 [AC_PROVIDE_IFELSE([LT_OUTPUT],
556546 ]], lt_decl_quote_varnames); do
557547 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
558548 *[[\\\\\\\`\\"\\\$]]*)
559 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
549 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
560550 ;;
561551 *)
562552 eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
569559 ]], lt_decl_dquote_varnames); do
570560 case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
571561 *[[\\\\\\\`\\"\\\$]]*)
572 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
562 eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
573563 ;;
574564 *)
575565 eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
585575 # Generate a child script FILE with all initialization necessary to
586576 # reuse the environment learned by the parent script, and make the
587577 # file executable. If COMMENT is supplied, it is inserted after the
588 # '#!' sequence but before initialization text begins. After this
578 # `#!' sequence but before initialization text begins. After this
589579 # macro, additional text can be appended to FILE to form the body of
590580 # the child script. The macro ends with non-zero status if the
591581 # file could not be fully written (such as if the disk is full).
607597 _AS_PREPARE
608598 exec AS_MESSAGE_FD>&1
609599 _ASEOF
610 test 0 = "$lt_write_fail" && chmod +x $1[]dnl
600 test $lt_write_fail = 0 && chmod +x $1[]dnl
611601 m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
612602
613603 # LT_OUTPUT
630620 } >&AS_MESSAGE_LOG_FD
631621
632622 lt_cl_help="\
633 '$as_me' creates a local libtool stub from the current configuration,
623 \`$as_me' creates a local libtool stub from the current configuration,
634624 for use in further configure time tests before the real libtool is
635625 generated.
636626
652642 This config.lt script is free software; the Free Software Foundation
653643 gives unlimited permision to copy, distribute and modify it."
654644
655 while test 0 != $[#]
645 while test $[#] != 0
656646 do
657647 case $[1] in
658648 --version | --v* | -V )
665655 lt_cl_silent=: ;;
666656
667657 -*) AC_MSG_ERROR([unrecognized option: $[1]
668 Try '$[0] --help' for more information.]) ;;
658 Try \`$[0] --help' for more information.]) ;;
669659
670660 *) AC_MSG_ERROR([unrecognized argument: $[1]
671 Try '$[0] --help' for more information.]) ;;
661 Try \`$[0] --help' for more information.]) ;;
672662 esac
673663 shift
674664 done
694684 # open by configure. Here we exec the FD to /dev/null, effectively closing
695685 # config.log, so it can be properly (re)opened and appended to by config.lt.
696686 lt_cl_success=:
697 test yes = "$silent" &&
687 test "$silent" = yes &&
698688 lt_config_lt_args="$lt_config_lt_args --quiet"
699689 exec AS_MESSAGE_LOG_FD>/dev/null
700690 $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
714704 _LT_CONFIG_SAVE_COMMANDS([
715705 m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
716706 m4_if(_LT_TAG, [C], [
717 # See if we are running on zsh, and set the options that allow our
707 # See if we are running on zsh, and set the options which allow our
718708 # commands through without removal of \ escapes.
719 if test -n "${ZSH_VERSION+set}"; then
709 if test -n "${ZSH_VERSION+set}" ; then
720710 setopt NO_GLOB_SUBST
721711 fi
722712
723 cfgfile=${ofile}T
713 cfgfile="${ofile}T"
724714 trap "$RM \"$cfgfile\"; exit 1" 1 2 15
725715 $RM "$cfgfile"
726716
727717 cat <<_LT_EOF >> "$cfgfile"
728718 #! $SHELL
729 # Generated automatically by $as_me ($PACKAGE) $VERSION
719
720 # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
721 # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
722 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
730723 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
731
732 # Provide generalized library-building support services.
733 # Written by Gordon Matzigkeit, 1996
734
724 #
735725 _LT_COPYING
736726 _LT_LIBTOOL_TAGS
737
738 # Configured defaults for sys_lib_dlsearch_path munging.
739 : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
740727
741728 # ### BEGIN LIBTOOL CONFIG
742729 _LT_LIBTOOL_CONFIG_VARS
743730 _LT_LIBTOOL_TAG_VARS
744731 # ### END LIBTOOL CONFIG
745
746 _LT_EOF
747
748 cat <<'_LT_EOF' >> "$cfgfile"
749
750 # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
751
752 _LT_PREPARE_MUNGE_PATH_LIST
753 _LT_PREPARE_CC_BASENAME
754
755 # ### END FUNCTIONS SHARED WITH CONFIGURE
756732
757733 _LT_EOF
758734
762738 # AIX sometimes has problems with the GCC collect2 program. For some
763739 # reason, if we set the COLLECT_NAMES environment variable, the problems
764740 # vanish in a puff of smoke.
765 if test set != "${COLLECT_NAMES+set}"; then
741 if test "X${COLLECT_NAMES+set}" != Xset; then
766742 COLLECT_NAMES=
767743 export COLLECT_NAMES
768744 fi
778754 # is reportedly fixed, but why not run on old versions too?
779755 sed '$q' "$ltmain" >> "$cfgfile" \
780756 || (rm -f "$cfgfile"; exit 1)
757
758 _LT_PROG_REPLACE_SHELLFNS
781759
782760 mv -f "$cfgfile" "$ofile" ||
783761 (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
796774 [m4_if([$1], [], [
797775 PACKAGE='$PACKAGE'
798776 VERSION='$VERSION'
777 TIMESTAMP='$TIMESTAMP'
799778 RM='$RM'
800779 ofile='$ofile'], [])
801780 ])dnl /_LT_CONFIG_SAVE_COMMANDS
994973
995974 AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
996975 [lt_cv_apple_cc_single_mod=no
997 if test -z "$LT_MULTI_MODULE"; then
976 if test -z "${LT_MULTI_MODULE}"; then
998977 # By default we will add the -single_module flag. You can override
999978 # by either setting the environment variable LT_MULTI_MODULE
1000979 # non-empty at configure time, or by adding -multi_module to the
1012991 cat conftest.err >&AS_MESSAGE_LOG_FD
1013992 # Otherwise, if the output was created with a 0 exit code from
1014993 # the compiler, it worked.
1015 elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
994 elif test -f libconftest.dylib && test $_lt_result -eq 0; then
1016995 lt_cv_apple_cc_single_mod=yes
1017996 else
1018997 cat conftest.err >&AS_MESSAGE_LOG_FD
10301009 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
10311010 [lt_cv_ld_exported_symbols_list=yes],
10321011 [lt_cv_ld_exported_symbols_list=no])
1033 LDFLAGS=$save_LDFLAGS
1012 LDFLAGS="$save_LDFLAGS"
10341013 ])
10351014
10361015 AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
10521031 _lt_result=$?
10531032 if test -s conftest.err && $GREP force_load conftest.err; then
10541033 cat conftest.err >&AS_MESSAGE_LOG_FD
1055 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
1034 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
10561035 lt_cv_ld_force_load=yes
10571036 else
10581037 cat conftest.err >&AS_MESSAGE_LOG_FD
10621041 ])
10631042 case $host_os in
10641043 rhapsody* | darwin1.[[012]])
1065 _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
1044 _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
10661045 darwin1.*)
1067 _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
1046 _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
10681047 darwin*) # darwin 5.x on
10691048 # if running on 10.5 or later, the deployment target defaults
10701049 # to the OS version, if on x86, and 10.4, the deployment
10711050 # target defaults to 10.4. Don't you love it?
10721051 case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
10731052 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
1074 _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
1075 10.[[012]][[,.]]*)
1076 _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
1053 _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
1054 10.[[012]]*)
1055 _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
10771056 10.*)
1078 _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
1057 _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
10791058 esac
10801059 ;;
10811060 esac
1082 if test yes = "$lt_cv_apple_cc_single_mod"; then
1061 if test "$lt_cv_apple_cc_single_mod" = "yes"; then
10831062 _lt_dar_single_mod='$single_module'
10841063 fi
1085 if test yes = "$lt_cv_ld_exported_symbols_list"; then
1086 _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
1064 if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
1065 _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
10871066 else
1088 _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
1067 _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
10891068 fi
1090 if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
1069 if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
10911070 _lt_dsymutil='~$DSYMUTIL $lib || :'
10921071 else
10931072 _lt_dsymutil=
11071086 _LT_TAGVAR(hardcode_direct, $1)=no
11081087 _LT_TAGVAR(hardcode_automatic, $1)=yes
11091088 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
1110 if test yes = "$lt_cv_ld_force_load"; then
1111 _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\"`'
1089 if test "$lt_cv_ld_force_load" = "yes"; then
1090 _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\"`'
11121091 m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
11131092 [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
11141093 else
11151094 _LT_TAGVAR(whole_archive_flag_spec, $1)=''
11161095 fi
11171096 _LT_TAGVAR(link_all_deplibs, $1)=yes
1118 _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined
1097 _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
11191098 case $cc_basename in
1120 ifort*|nagfor*) _lt_dar_can_shared=yes ;;
1099 ifort*) _lt_dar_can_shared=yes ;;
11211100 *) _lt_dar_can_shared=$GCC ;;
11221101 esac
1123 if test yes = "$_lt_dar_can_shared"; then
1102 if test "$_lt_dar_can_shared" = "yes"; then
11241103 output_verbose_link_cmd=func_echo_all
1125 _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"
1126 _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
1127 _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"
1128 _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"
1104 _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}"
1105 _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
1106 _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}"
1107 _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}"
11291108 m4_if([$1], [CXX],
1130 [ if test yes != "$lt_cv_apple_cc_single_mod"; then
1131 _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"
1132 _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"
1109 [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
1110 _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}"
1111 _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}"
11331112 fi
11341113 ],[])
11351114 else
11491128 # Allow to override them for all tags through lt_cv_aix_libpath.
11501129 m4_defun([_LT_SYS_MODULE_PATH_AIX],
11511130 [m4_require([_LT_DECL_SED])dnl
1152 if test set = "${lt_cv_aix_libpath+set}"; then
1131 if test "${lt_cv_aix_libpath+set}" = set; then
11531132 aix_libpath=$lt_cv_aix_libpath
11541133 else
11551134 AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
11671146 _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
11681147 fi],[])
11691148 if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
1170 _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib
1149 _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
11711150 fi
11721151 ])
11731152 aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
11871166 # -----------------------
11881167 # Find how we can fake an echo command that does not interpret backslash.
11891168 # In particular, with Autoconf 2.60 or later we add some code to the start
1190 # of the generated configure script that will find a shell with a builtin
1191 # printf (that we can use as an echo command).
1169 # of the generated configure script which will find a shell with a builtin
1170 # printf (which we can use as an echo command).
11921171 m4_defun([_LT_PROG_ECHO_BACKSLASH],
11931172 [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
11941173 ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
12161195 # Invoke $ECHO with all args, space-separated.
12171196 func_echo_all ()
12181197 {
1219 $ECHO "$*"
1198 $ECHO "$*"
12201199 }
12211200
1222 case $ECHO in
1201 case "$ECHO" in
12231202 printf*) AC_MSG_RESULT([printf]) ;;
12241203 print*) AC_MSG_RESULT([print -r]) ;;
12251204 *) AC_MSG_RESULT([cat]) ;;
12451224 AC_DEFUN([_LT_WITH_SYSROOT],
12461225 [AC_MSG_CHECKING([for sysroot])
12471226 AC_ARG_WITH([sysroot],
1248 [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
1249 [Search for dependent libraries within DIR (or the compiler's sysroot
1250 if not specified).])],
1227 [ --with-sysroot[=DIR] Search for dependent libraries within DIR
1228 (or the compiler's sysroot if not specified).],
12511229 [], [with_sysroot=no])
12521230
12531231 dnl lt_sysroot will always be passed unquoted. We quote it here
12541232 dnl in case the user passed a directory name.
12551233 lt_sysroot=
1256 case $with_sysroot in #(
1234 case ${with_sysroot} in #(
12571235 yes)
1258 if test yes = "$GCC"; then
1236 if test "$GCC" = yes; then
12591237 lt_sysroot=`$CC --print-sysroot 2>/dev/null`
12601238 fi
12611239 ;; #(
12651243 no|'')
12661244 ;; #(
12671245 *)
1268 AC_MSG_RESULT([$with_sysroot])
1246 AC_MSG_RESULT([${with_sysroot}])
12691247 AC_MSG_ERROR([The sysroot must be an absolute path.])
12701248 ;;
12711249 esac
12721250
12731251 AC_MSG_RESULT([${lt_sysroot:-no}])
12741252 _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
1275 [dependent libraries, and where our libraries should be installed.])])
1253 [dependent libraries, and in which our libraries should be installed.])])
12761254
12771255 # _LT_ENABLE_LOCK
12781256 # ---------------
12801258 [AC_ARG_ENABLE([libtool-lock],
12811259 [AS_HELP_STRING([--disable-libtool-lock],
12821260 [avoid locking (might break parallel builds)])])
1283 test no = "$enable_libtool_lock" || enable_libtool_lock=yes
1261 test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
12841262
12851263 # Some flags need to be propagated to the compiler or linker for good
12861264 # libtool support.
12871265 case $host in
12881266 ia64-*-hpux*)
1289 # Find out what ABI is being produced by ac_compile, and set mode
1290 # options accordingly.
1267 # Find out which ABI we are using.
12911268 echo 'int i;' > conftest.$ac_ext
12921269 if AC_TRY_EVAL(ac_compile); then
12931270 case `/usr/bin/file conftest.$ac_objext` in
12941271 *ELF-32*)
1295 HPUX_IA64_MODE=32
1272 HPUX_IA64_MODE="32"
12961273 ;;
12971274 *ELF-64*)
1298 HPUX_IA64_MODE=64
1275 HPUX_IA64_MODE="64"
12991276 ;;
13001277 esac
13011278 fi
13021279 rm -rf conftest*
13031280 ;;
13041281 *-*-irix6*)
1305 # Find out what ABI is being produced by ac_compile, and set linker
1306 # options accordingly.
1282 # Find out which ABI we are using.
13071283 echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
13081284 if AC_TRY_EVAL(ac_compile); then
1309 if test yes = "$lt_cv_prog_gnu_ld"; then
1285 if test "$lt_cv_prog_gnu_ld" = yes; then
13101286 case `/usr/bin/file conftest.$ac_objext` in
13111287 *32-bit*)
13121288 LD="${LD-ld} -melf32bsmip"
13351311 rm -rf conftest*
13361312 ;;
13371313
1338 mips64*-*linux*)
1339 # Find out what ABI is being produced by ac_compile, and set linker
1340 # options accordingly.
1341 echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
1342 if AC_TRY_EVAL(ac_compile); then
1343 emul=elf
1344 case `/usr/bin/file conftest.$ac_objext` in
1345 *32-bit*)
1346 emul="${emul}32"
1347 ;;
1348 *64-bit*)
1349 emul="${emul}64"
1350 ;;
1351 esac
1352 case `/usr/bin/file conftest.$ac_objext` in
1353 *MSB*)
1354 emul="${emul}btsmip"
1355 ;;
1356 *LSB*)
1357 emul="${emul}ltsmip"
1358 ;;
1359 esac
1360 case `/usr/bin/file conftest.$ac_objext` in
1361 *N32*)
1362 emul="${emul}n32"
1363 ;;
1364 esac
1365 LD="${LD-ld} -m $emul"
1366 fi
1367 rm -rf conftest*
1368 ;;
1369
13701314 x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
13711315 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
1372 # Find out what ABI is being produced by ac_compile, and set linker
1373 # options accordingly. Note that the listed cases only cover the
1374 # situations where additional linker options are needed (such as when
1375 # doing 32-bit compilation for a host where ld defaults to 64-bit, or
1376 # vice versa); the common cases where no linker options are needed do
1377 # not appear in the list.
1316 # Find out which ABI we are using.
13781317 echo 'int i;' > conftest.$ac_ext
13791318 if AC_TRY_EVAL(ac_compile); then
13801319 case `/usr/bin/file conftest.o` in
13931332 ;;
13941333 esac
13951334 ;;
1396 powerpc64le-*linux*)
1335 powerpc64le-*)
13971336 LD="${LD-ld} -m elf32lppclinux"
13981337 ;;
1399 powerpc64-*linux*)
1338 powerpc64-*)
14001339 LD="${LD-ld} -m elf32ppclinux"
14011340 ;;
14021341 s390x-*linux*)
14151354 x86_64-*linux*)
14161355 LD="${LD-ld} -m elf_x86_64"
14171356 ;;
1418 powerpcle-*linux*)
1357 powerpcle-*)
14191358 LD="${LD-ld} -m elf64lppc"
14201359 ;;
1421 powerpc-*linux*)
1360 powerpc-*)
14221361 LD="${LD-ld} -m elf64ppc"
14231362 ;;
14241363 s390*-*linux*|s390*-*tpf*)
14361375
14371376 *-*-sco3.2v5*)
14381377 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1439 SAVE_CFLAGS=$CFLAGS
1378 SAVE_CFLAGS="$CFLAGS"
14401379 CFLAGS="$CFLAGS -belf"
14411380 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
14421381 [AC_LANG_PUSH(C)
14431382 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
14441383 AC_LANG_POP])
1445 if test yes != "$lt_cv_cc_needs_belf"; then
1384 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
14461385 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
1447 CFLAGS=$SAVE_CFLAGS
1386 CFLAGS="$SAVE_CFLAGS"
14481387 fi
14491388 ;;
14501389 *-*solaris*)
1451 # Find out what ABI is being produced by ac_compile, and set linker
1452 # options accordingly.
1390 # Find out which ABI we are using.
14531391 echo 'int i;' > conftest.$ac_ext
14541392 if AC_TRY_EVAL(ac_compile); then
14551393 case `/usr/bin/file conftest.o` in
14571395 case $lt_cv_prog_gnu_ld in
14581396 yes*)
14591397 case $host in
1460 i?86-*-solaris*|x86_64-*-solaris*)
1398 i?86-*-solaris*)
14611399 LD="${LD-ld} -m elf_x86_64"
14621400 ;;
14631401 sparc*-*-solaris*)
14661404 esac
14671405 # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
14681406 if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
1469 LD=${LD-ld}_sol2
1407 LD="${LD-ld}_sol2"
14701408 fi
14711409 ;;
14721410 *)
14821420 ;;
14831421 esac
14841422
1485 need_locks=$enable_libtool_lock
1423 need_locks="$enable_libtool_lock"
14861424 ])# _LT_ENABLE_LOCK
14871425
14881426
15011439 [echo conftest.$ac_objext > conftest.lst
15021440 lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
15031441 AC_TRY_EVAL([lt_ar_try])
1504 if test 0 -eq "$ac_status"; then
1442 if test "$ac_status" -eq 0; then
15051443 # Ensure the archiver fails upon bogus file names.
15061444 rm -f conftest.$ac_objext libconftest.a
15071445 AC_TRY_EVAL([lt_ar_try])
1508 if test 0 -ne "$ac_status"; then
1446 if test "$ac_status" -ne 0; then
15091447 lt_cv_ar_at_file=@
15101448 fi
15111449 fi
15131451 ])
15141452 ])
15151453
1516 if test no = "$lt_cv_ar_at_file"; then
1454 if test "x$lt_cv_ar_at_file" = xno; then
15171455 archiver_list_spec=
15181456 else
15191457 archiver_list_spec=$lt_cv_ar_at_file
15441482
15451483 if test -n "$RANLIB"; then
15461484 case $host_os in
1547 bitrig* | openbsd*)
1485 openbsd*)
15481486 old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
15491487 ;;
15501488 *)
15801518 [$2=no
15811519 m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
15821520 echo "$lt_simple_compile_test_code" > conftest.$ac_ext
1583 lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment
1521 lt_compiler_flag="$3"
15841522 # Insert the option either (1) after the last *FLAGS variable, or
15851523 # (2) before a word containing "conftest.", or (3) at the end.
15861524 # Note that $ac_compile itself does not contain backslashes and begins
16071545 $RM conftest*
16081546 ])
16091547
1610 if test yes = "[$]$2"; then
1548 if test x"[$]$2" = xyes; then
16111549 m4_if([$5], , :, [$5])
16121550 else
16131551 m4_if([$6], , :, [$6])
16291567 m4_require([_LT_DECL_SED])dnl
16301568 AC_CACHE_CHECK([$1], [$2],
16311569 [$2=no
1632 save_LDFLAGS=$LDFLAGS
1570 save_LDFLAGS="$LDFLAGS"
16331571 LDFLAGS="$LDFLAGS $3"
16341572 echo "$lt_simple_link_test_code" > conftest.$ac_ext
16351573 if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
16481586 fi
16491587 fi
16501588 $RM -r conftest*
1651 LDFLAGS=$save_LDFLAGS
1589 LDFLAGS="$save_LDFLAGS"
16521590 ])
16531591
1654 if test yes = "[$]$2"; then
1592 if test x"[$]$2" = xyes; then
16551593 m4_if([$4], , :, [$4])
16561594 else
16571595 m4_if([$5], , :, [$5])
16721610 AC_MSG_CHECKING([the maximum length of command line arguments])
16731611 AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
16741612 i=0
1675 teststring=ABCD
1613 teststring="ABCD"
16761614
16771615 case $build_os in
16781616 msdosdjgpp*)
17121650 lt_cv_sys_max_cmd_len=8192;
17131651 ;;
17141652
1715 bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
1653 netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
17161654 # This has been around since 386BSD, at least. Likely further.
17171655 if test -x /sbin/sysctl; then
17181656 lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
17631701 *)
17641702 lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
17651703 if test -n "$lt_cv_sys_max_cmd_len" && \
1766 test undefined != "$lt_cv_sys_max_cmd_len"; then
1704 test undefined != "$lt_cv_sys_max_cmd_len"; then
17671705 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
17681706 lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
17691707 else
17701708 # Make teststring a little bigger before we do anything with it.
17711709 # a 1K string should be a reasonable start.
1772 for i in 1 2 3 4 5 6 7 8; do
1710 for i in 1 2 3 4 5 6 7 8 ; do
17731711 teststring=$teststring$teststring
17741712 done
17751713 SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
17761714 # If test is not a shell built-in, we'll probably end up computing a
17771715 # maximum length that is only half of the actual maximum length, but
17781716 # we can't tell.
1779 while { test X`env echo "$teststring$teststring" 2>/dev/null` \
1717 while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
17801718 = "X$teststring$teststring"; } >/dev/null 2>&1 &&
1781 test 17 != "$i" # 1/2 MB should be enough
1719 test $i != 17 # 1/2 MB should be enough
17821720 do
17831721 i=`expr $i + 1`
17841722 teststring=$teststring$teststring
17941732 ;;
17951733 esac
17961734 ])
1797 if test -n "$lt_cv_sys_max_cmd_len"; then
1735 if test -n $lt_cv_sys_max_cmd_len ; then
17981736 AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
17991737 else
18001738 AC_MSG_RESULT(none)
18221760 # ----------------------------------------------------------------
18231761 m4_defun([_LT_TRY_DLOPEN_SELF],
18241762 [m4_require([_LT_HEADER_DLFCN])dnl
1825 if test yes = "$cross_compiling"; then :
1763 if test "$cross_compiling" = yes; then :
18261764 [$4]
18271765 else
18281766 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
18691807 # endif
18701808 #endif
18711809
1872 /* When -fvisibility=hidden is used, assume the code has been annotated
1810 /* When -fvisbility=hidden is used, assume the code has been annotated
18731811 correspondingly for the symbols needed. */
1874 #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
1812 #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
18751813 int fnord () __attribute__((visibility("default")));
18761814 #endif
18771815
18971835 return status;
18981836 }]
18991837 _LT_EOF
1900 if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then
1838 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
19011839 (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
19021840 lt_status=$?
19031841 case x$lt_status in
19181856 # ------------------
19191857 AC_DEFUN([LT_SYS_DLOPEN_SELF],
19201858 [m4_require([_LT_HEADER_DLFCN])dnl
1921 if test yes != "$enable_dlopen"; then
1859 if test "x$enable_dlopen" != xyes; then
19221860 enable_dlopen=unknown
19231861 enable_dlopen_self=unknown
19241862 enable_dlopen_self_static=unknown
19281866
19291867 case $host_os in
19301868 beos*)
1931 lt_cv_dlopen=load_add_on
1869 lt_cv_dlopen="load_add_on"
19321870 lt_cv_dlopen_libs=
19331871 lt_cv_dlopen_self=yes
19341872 ;;
19351873
19361874 mingw* | pw32* | cegcc*)
1937 lt_cv_dlopen=LoadLibrary
1875 lt_cv_dlopen="LoadLibrary"
19381876 lt_cv_dlopen_libs=
19391877 ;;
19401878
19411879 cygwin*)
1942 lt_cv_dlopen=dlopen
1880 lt_cv_dlopen="dlopen"
19431881 lt_cv_dlopen_libs=
19441882 ;;
19451883
19461884 darwin*)
1947 # if libdl is installed we need to link against it
1885 # if libdl is installed we need to link against it
19481886 AC_CHECK_LIB([dl], [dlopen],
1949 [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[
1950 lt_cv_dlopen=dyld
1887 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
1888 lt_cv_dlopen="dyld"
19511889 lt_cv_dlopen_libs=
19521890 lt_cv_dlopen_self=yes
19531891 ])
19541892 ;;
19551893
1956 tpf*)
1957 # Don't try to run any link tests for TPF. We know it's impossible
1958 # because TPF is a cross-compiler, and we know how we open DSOs.
1959 lt_cv_dlopen=dlopen
1960 lt_cv_dlopen_libs=
1961 lt_cv_dlopen_self=no
1962 ;;
1963
19641894 *)
19651895 AC_CHECK_FUNC([shl_load],
1966 [lt_cv_dlopen=shl_load],
1896 [lt_cv_dlopen="shl_load"],
19671897 [AC_CHECK_LIB([dld], [shl_load],
1968 [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld],
1898 [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
19691899 [AC_CHECK_FUNC([dlopen],
1970 [lt_cv_dlopen=dlopen],
1900 [lt_cv_dlopen="dlopen"],
19711901 [AC_CHECK_LIB([dl], [dlopen],
1972 [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],
1902 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
19731903 [AC_CHECK_LIB([svld], [dlopen],
1974 [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld],
1904 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
19751905 [AC_CHECK_LIB([dld], [dld_link],
1976 [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld])
1906 [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
19771907 ])
19781908 ])
19791909 ])
19821912 ;;
19831913 esac
19841914
1985 if test no = "$lt_cv_dlopen"; then
1915 if test "x$lt_cv_dlopen" != xno; then
1916 enable_dlopen=yes
1917 else
19861918 enable_dlopen=no
1987 else
1988 enable_dlopen=yes
19891919 fi
19901920
19911921 case $lt_cv_dlopen in
19921922 dlopen)
1993 save_CPPFLAGS=$CPPFLAGS
1994 test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
1995
1996 save_LDFLAGS=$LDFLAGS
1923 save_CPPFLAGS="$CPPFLAGS"
1924 test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
1925
1926 save_LDFLAGS="$LDFLAGS"
19971927 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
19981928
1999 save_LIBS=$LIBS
1929 save_LIBS="$LIBS"
20001930 LIBS="$lt_cv_dlopen_libs $LIBS"
20011931
20021932 AC_CACHE_CHECK([whether a program can dlopen itself],
20061936 lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
20071937 ])
20081938
2009 if test yes = "$lt_cv_dlopen_self"; then
1939 if test "x$lt_cv_dlopen_self" = xyes; then
20101940 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
20111941 AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
20121942 lt_cv_dlopen_self_static, [dnl
20161946 ])
20171947 fi
20181948
2019 CPPFLAGS=$save_CPPFLAGS
2020 LDFLAGS=$save_LDFLAGS
2021 LIBS=$save_LIBS
1949 CPPFLAGS="$save_CPPFLAGS"
1950 LDFLAGS="$save_LDFLAGS"
1951 LIBS="$save_LIBS"
20221952 ;;
20231953 esac
20241954
21102040 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
21112041 _LT_COMPILER_C_O([$1])
21122042
2113 hard_links=nottested
2114 if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then
2043 hard_links="nottested"
2044 if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
21152045 # do not overwrite the value of need_locks provided by the user
21162046 AC_MSG_CHECKING([if we can lock with hard links])
21172047 hard_links=yes
21212051 ln conftest.a conftest.b 2>&5 || hard_links=no
21222052 ln conftest.a conftest.b 2>/dev/null && hard_links=no
21232053 AC_MSG_RESULT([$hard_links])
2124 if test no = "$hard_links"; then
2125 AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe])
2054 if test "$hard_links" = no; then
2055 AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
21262056 need_locks=warn
21272057 fi
21282058 else
21492079 _LT_DECL([], [objdir], [0],
21502080 [The name of the directory that contains temporary libtool files])dnl
21512081 m4_pattern_allow([LT_OBJDIR])dnl
2152 AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/",
2153 [Define to the sub-directory where libtool stores uninstalled libraries.])
2082 AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
2083 [Define to the sub-directory in which libtool stores uninstalled libraries.])
21542084 ])# _LT_CHECK_OBJDIR
21552085
21562086
21622092 _LT_TAGVAR(hardcode_action, $1)=
21632093 if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
21642094 test -n "$_LT_TAGVAR(runpath_var, $1)" ||
2165 test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then
2095 test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
21662096
21672097 # We can hardcode non-existent directories.
2168 if test no != "$_LT_TAGVAR(hardcode_direct, $1)" &&
2098 if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
21692099 # If the only mechanism to avoid hardcoding is shlibpath_var, we
21702100 # have to relink, otherwise we might link with an installed library
21712101 # when we should be linking with a yet-to-be-installed one
2172 ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" &&
2173 test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then
2102 ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
2103 test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
21742104 # Linking always hardcodes the temporary library directory.
21752105 _LT_TAGVAR(hardcode_action, $1)=relink
21762106 else
21842114 fi
21852115 AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
21862116
2187 if test relink = "$_LT_TAGVAR(hardcode_action, $1)" ||
2188 test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then
2117 if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
2118 test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
21892119 # Fast installation is not supported
21902120 enable_fast_install=no
2191 elif test yes = "$shlibpath_overrides_runpath" ||
2192 test no = "$enable_shared"; then
2121 elif test "$shlibpath_overrides_runpath" = yes ||
2122 test "$enable_shared" = no; then
21932123 # Fast installation is not necessary
21942124 enable_fast_install=needless
21952125 fi
22132143 # FIXME - insert some real tests, host_os isn't really good enough
22142144 case $host_os in
22152145 darwin*)
2216 if test -n "$STRIP"; then
2146 if test -n "$STRIP" ; then
22172147 striplib="$STRIP -x"
22182148 old_striplib="$STRIP -S"
22192149 AC_MSG_RESULT([yes])
22312161 ])# _LT_CMD_STRIPLIB
22322162
22332163
2234 # _LT_PREPARE_MUNGE_PATH_LIST
2235 # ---------------------------
2236 # Make sure func_munge_path_list() is defined correctly.
2237 m4_defun([_LT_PREPARE_MUNGE_PATH_LIST],
2238 [[# func_munge_path_list VARIABLE PATH
2239 # -----------------------------------
2240 # VARIABLE is name of variable containing _space_ separated list of
2241 # directories to be munged by the contents of PATH, which is string
2242 # having a format:
2243 # "DIR[:DIR]:"
2244 # string "DIR[ DIR]" will be prepended to VARIABLE
2245 # ":DIR[:DIR]"
2246 # string "DIR[ DIR]" will be appended to VARIABLE
2247 # "DIRP[:DIRP]::[DIRA:]DIRA"
2248 # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
2249 # "DIRA[ DIRA]" will be appended to VARIABLE
2250 # "DIR[:DIR]"
2251 # VARIABLE will be replaced by "DIR[ DIR]"
2252 func_munge_path_list ()
2253 {
2254 case x@S|@2 in
2255 x)
2256 ;;
2257 *:)
2258 eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\"
2259 ;;
2260 x:*)
2261 eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\"
2262 ;;
2263 *::*)
2264 eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
2265 eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\"
2266 ;;
2267 *)
2268 eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\"
2269 ;;
2270 esac
2271 }
2272 ]])# _LT_PREPARE_PATH_LIST
2273
2274
22752164 # _LT_SYS_DYNAMIC_LINKER([TAG])
22762165 # -----------------------------
22772166 # PORTME Fill in your ld.so characteristics
22822171 m4_require([_LT_DECL_OBJDUMP])dnl
22832172 m4_require([_LT_DECL_SED])dnl
22842173 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
2285 m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl
22862174 AC_MSG_CHECKING([dynamic linker characteristics])
22872175 m4_if([$1],
22882176 [], [
2289 if test yes = "$GCC"; then
2177 if test "$GCC" = yes; then
22902178 case $host_os in
2291 darwin*) lt_awk_arg='/^libraries:/,/LR/' ;;
2292 *) lt_awk_arg='/^libraries:/' ;;
2179 darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
2180 *) lt_awk_arg="/^libraries:/" ;;
22932181 esac
22942182 case $host_os in
2295 mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;;
2296 *) lt_sed_strip_eq='s|=/|/|g' ;;
2183 mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
2184 *) lt_sed_strip_eq="s,=/,/,g" ;;
22972185 esac
22982186 lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
22992187 case $lt_search_path_spec in
23092197 ;;
23102198 esac
23112199 # Ok, now we have the path, separated by spaces, we can step through it
2312 # and add multilib dir if necessary...
2200 # and add multilib dir if necessary.
23132201 lt_tmp_lt_search_path_spec=
2314 lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
2315 # ...but if some path component already ends with the multilib dir we assume
2316 # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer).
2317 case "$lt_multi_os_dir; $lt_search_path_spec " in
2318 "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*)
2319 lt_multi_os_dir=
2320 ;;
2321 esac
2202 lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
23222203 for lt_sys_path in $lt_search_path_spec; do
2323 if test -d "$lt_sys_path$lt_multi_os_dir"; then
2324 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir"
2325 elif test -n "$lt_multi_os_dir"; then
2204 if test -d "$lt_sys_path/$lt_multi_os_dir"; then
2205 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
2206 else
23262207 test -d "$lt_sys_path" && \
23272208 lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
23282209 fi
23292210 done
23302211 lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
2331 BEGIN {RS = " "; FS = "/|\n";} {
2332 lt_foo = "";
2333 lt_count = 0;
2212 BEGIN {RS=" "; FS="/|\n";} {
2213 lt_foo="";
2214 lt_count=0;
23342215 for (lt_i = NF; lt_i > 0; lt_i--) {
23352216 if ($lt_i != "" && $lt_i != ".") {
23362217 if ($lt_i == "..") {
23372218 lt_count++;
23382219 } else {
23392220 if (lt_count == 0) {
2340 lt_foo = "/" $lt_i lt_foo;
2221 lt_foo="/" $lt_i lt_foo;
23412222 } else {
23422223 lt_count--;
23432224 }
23512232 # for these hosts.
23522233 case $host_os in
23532234 mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
2354 $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;;
2235 $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
23552236 esac
23562237 sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
23572238 else
23602241 library_names_spec=
23612242 libname_spec='lib$name'
23622243 soname_spec=
2363 shrext_cmds=.so
2244 shrext_cmds=".so"
23642245 postinstall_cmds=
23652246 postuninstall_cmds=
23662247 finish_cmds=
23772258 # flags to be left without arguments
23782259 need_version=unknown
23792260
2380 AC_ARG_VAR([LT_SYS_LIBRARY_PATH],
2381 [User-defined run-time library search path.])
2382
23832261 case $host_os in
23842262 aix3*)
23852263 version_type=linux # correct to gnu/linux during the next big refactor
2386 library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
2264 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
23872265 shlibpath_var=LIBPATH
23882266
23892267 # AIX 3 has no versioning support, so we append a major version to the name.
2390 soname_spec='$libname$release$shared_ext$major'
2268 soname_spec='${libname}${release}${shared_ext}$major'
23912269 ;;
23922270
23932271 aix[[4-9]]*)
23952273 need_lib_prefix=no
23962274 need_version=no
23972275 hardcode_into_libs=yes
2398 if test ia64 = "$host_cpu"; then
2276 if test "$host_cpu" = ia64; then
23992277 # AIX 5 supports IA64
2400 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
2278 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
24012279 shlibpath_var=LD_LIBRARY_PATH
24022280 else
24032281 # With GCC up to 2.95.x, collect2 would create an import file
24042282 # for dependence libraries. The import file would start with
2405 # the line '#! .'. This would cause the generated library to
2406 # depend on '.', always an invalid library. This was fixed in
2283 # the line `#! .'. This would cause the generated library to
2284 # depend on `.', always an invalid library. This was fixed in
24072285 # development snapshots of GCC prior to 3.0.
24082286 case $host_os in
24092287 aix4 | aix4.[[01]] | aix4.[[01]].*)
24102288 if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
24112289 echo ' yes '
2412 echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
2290 echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
24132291 :
24142292 else
24152293 can_build_shared=no
24162294 fi
24172295 ;;
24182296 esac
2419 # Using Import Files as archive members, it is possible to support
2420 # filename-based versioning of shared library archives on AIX. While
2421 # this would work for both with and without runtime linking, it will
2422 # prevent static linking of such archives. So we do filename-based
2423 # shared library versioning with .so extension only, which is used
2424 # when both runtime linking and shared linking is enabled.
2425 # Unfortunately, runtime linking may impact performance, so we do
2426 # not want this to be the default eventually. Also, we use the
2427 # versioned .so libs for executables only if there is the -brtl
2428 # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
2429 # To allow for filename-based versioning support, we need to create
2430 # libNAME.so.V as an archive file, containing:
2431 # *) an Import File, referring to the versioned filename of the
2432 # archive as well as the shared archive member, telling the
2433 # bitwidth (32 or 64) of that shared object, and providing the
2434 # list of exported symbols of that shared object, eventually
2435 # decorated with the 'weak' keyword
2436 # *) the shared object with the F_LOADONLY flag set, to really avoid
2437 # it being seen by the linker.
2438 # At run time we better use the real file rather than another symlink,
2439 # but for link time we create the symlink libNAME.so -> libNAME.so.V
2440
2441 case $with_aix_soname,$aix_use_runtimelinking in
2442 # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
2297 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
24432298 # soname into executable. Probably we can add versioning support to
24442299 # collect2, so additional links can be useful in future.
2445 aix,yes) # traditional libtool
2446 dynamic_linker='AIX unversionable lib.so'
2300 if test "$aix_use_runtimelinking" = yes; then
24472301 # If using run time linking (on AIX 4.2 or later) use lib<name>.so
24482302 # instead of lib<name>.a to let people know that these are not
24492303 # typical AIX shared libraries.
2450 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2451 ;;
2452 aix,no) # traditional AIX only
2453 dynamic_linker='AIX lib.a[(]lib.so.V[)]'
2304 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2305 else
24542306 # We preserve .a as extension for shared libraries through AIX4.2
24552307 # and later when we are not doing run time linking.
2456 library_names_spec='$libname$release.a $libname.a'
2457 soname_spec='$libname$release$shared_ext$major'
2458 ;;
2459 svr4,*) # full svr4 only
2460 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]"
2461 library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
2462 # We do not specify a path in Import Files, so LIBPATH fires.
2463 shlibpath_overrides_runpath=yes
2464 ;;
2465 *,yes) # both, prefer svr4
2466 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]"
2467 library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
2468 # unpreferred sharedlib libNAME.a needs extra handling
2469 postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
2470 postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
2471 # We do not specify a path in Import Files, so LIBPATH fires.
2472 shlibpath_overrides_runpath=yes
2473 ;;
2474 *,no) # both, prefer aix
2475 dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]"
2476 library_names_spec='$libname$release.a $libname.a'
2477 soname_spec='$libname$release$shared_ext$major'
2478 # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
2479 postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
2480 postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
2481 ;;
2482 esac
2308 library_names_spec='${libname}${release}.a $libname.a'
2309 soname_spec='${libname}${release}${shared_ext}$major'
2310 fi
24832311 shlibpath_var=LIBPATH
24842312 fi
24852313 ;;
24892317 powerpc)
24902318 # Since July 2007 AmigaOS4 officially supports .so libraries.
24912319 # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
2492 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2320 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
24932321 ;;
24942322 m68k)
24952323 library_names_spec='$libname.ixlibrary $libname.a'
24962324 # Create ${libname}_ixlibrary.a entries in /sys/libs.
2497 finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
2325 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'
24982326 ;;
24992327 esac
25002328 ;;
25012329
25022330 beos*)
2503 library_names_spec='$libname$shared_ext'
2331 library_names_spec='${libname}${shared_ext}'
25042332 dynamic_linker="$host_os ld.so"
25052333 shlibpath_var=LIBRARY_PATH
25062334 ;;
25082336 bsdi[[45]]*)
25092337 version_type=linux # correct to gnu/linux during the next big refactor
25102338 need_version=no
2511 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2512 soname_spec='$libname$release$shared_ext$major'
2339 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2340 soname_spec='${libname}${release}${shared_ext}$major'
25132341 finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
25142342 shlibpath_var=LD_LIBRARY_PATH
25152343 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
25212349
25222350 cygwin* | mingw* | pw32* | cegcc*)
25232351 version_type=windows
2524 shrext_cmds=.dll
2352 shrext_cmds=".dll"
25252353 need_version=no
25262354 need_lib_prefix=no
25272355
25302358 # gcc
25312359 library_names_spec='$libname.dll.a'
25322360 # DLL is installed to $(libdir)/../bin by postinstall_cmds
2533 postinstall_cmds='base_file=`basename \$file`~
2534 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
2361 postinstall_cmds='base_file=`basename \${file}`~
2362 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
25352363 dldir=$destdir/`dirname \$dlpath`~
25362364 test -d \$dldir || mkdir -p \$dldir~
25372365 $install_prog $dir/$dlname \$dldir/$dlname~
25472375 case $host_os in
25482376 cygwin*)
25492377 # Cygwin DLLs use 'cyg' prefix rather than 'lib'
2550 soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
2378 soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
25512379 m4_if([$1], [],[
25522380 sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
25532381 ;;
25542382 mingw* | cegcc*)
25552383 # MinGW DLLs use traditional 'lib' prefix
2556 soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
2384 soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
25572385 ;;
25582386 pw32*)
25592387 # pw32 DLLs use 'pw' prefix rather than 'lib'
2560 library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
2388 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
25612389 ;;
25622390 esac
25632391 dynamic_linker='Win32 ld.exe'
25662394 *,cl*)
25672395 # Native MSVC
25682396 libname_spec='$name'
2569 soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
2570 library_names_spec='$libname.dll.lib'
2397 soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
2398 library_names_spec='${libname}.dll.lib'
25712399
25722400 case $build_os in
25732401 mingw*)
25942422 sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
25952423 ;;
25962424 *)
2597 sys_lib_search_path_spec=$LIB
2425 sys_lib_search_path_spec="$LIB"
25982426 if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
25992427 # It is most probably a Windows format PATH.
26002428 sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
26072435 esac
26082436
26092437 # DLL is installed to $(libdir)/../bin by postinstall_cmds
2610 postinstall_cmds='base_file=`basename \$file`~
2611 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
2438 postinstall_cmds='base_file=`basename \${file}`~
2439 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
26122440 dldir=$destdir/`dirname \$dlpath`~
26132441 test -d \$dldir || mkdir -p \$dldir~
26142442 $install_prog $dir/$dlname \$dldir/$dlname'
26212449
26222450 *)
26232451 # Assume MSVC wrapper
2624 library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib'
2452 library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
26252453 dynamic_linker='Win32 ld.exe'
26262454 ;;
26272455 esac
26342462 version_type=darwin
26352463 need_lib_prefix=no
26362464 need_version=no
2637 library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
2638 soname_spec='$libname$release$major$shared_ext'
2465 library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
2466 soname_spec='${libname}${release}${major}$shared_ext'
26392467 shlibpath_overrides_runpath=yes
26402468 shlibpath_var=DYLD_LIBRARY_PATH
26412469 shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
26482476 version_type=linux # correct to gnu/linux during the next big refactor
26492477 need_lib_prefix=no
26502478 need_version=no
2651 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2652 soname_spec='$libname$release$shared_ext$major'
2479 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
2480 soname_spec='${libname}${release}${shared_ext}$major'
26532481 shlibpath_var=LD_LIBRARY_PATH
26542482 ;;
26552483
26672495 version_type=freebsd-$objformat
26682496 case $version_type in
26692497 freebsd-elf*)
2670 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2671 soname_spec='$libname$release$shared_ext$major'
2498 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
26722499 need_version=no
26732500 need_lib_prefix=no
26742501 ;;
26752502 freebsd-*)
2676 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
2503 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
26772504 need_version=yes
26782505 ;;
26792506 esac
27032530 need_lib_prefix=no
27042531 need_version=no
27052532 dynamic_linker="$host_os runtime_loader"
2706 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2707 soname_spec='$libname$release$shared_ext$major'
2533 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
2534 soname_spec='${libname}${release}${shared_ext}$major'
27082535 shlibpath_var=LIBRARY_PATH
2709 shlibpath_overrides_runpath=no
2536 shlibpath_overrides_runpath=yes
27102537 sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
27112538 hardcode_into_libs=yes
27122539 ;;
27242551 dynamic_linker="$host_os dld.so"
27252552 shlibpath_var=LD_LIBRARY_PATH
27262553 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
2727 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2728 soname_spec='$libname$release$shared_ext$major'
2729 if test 32 = "$HPUX_IA64_MODE"; then
2554 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2555 soname_spec='${libname}${release}${shared_ext}$major'
2556 if test "X$HPUX_IA64_MODE" = X32; then
27302557 sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
2731 sys_lib_dlsearch_path_spec=/usr/lib/hpux32
27322558 else
27332559 sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
2734 sys_lib_dlsearch_path_spec=/usr/lib/hpux64
27352560 fi
2561 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
27362562 ;;
27372563 hppa*64*)
27382564 shrext_cmds='.sl'
27402566 dynamic_linker="$host_os dld.sl"
27412567 shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
27422568 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
2743 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2744 soname_spec='$libname$release$shared_ext$major'
2569 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2570 soname_spec='${libname}${release}${shared_ext}$major'
27452571 sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
27462572 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
27472573 ;;
27502576 dynamic_linker="$host_os dld.sl"
27512577 shlibpath_var=SHLIB_PATH
27522578 shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
2753 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2754 soname_spec='$libname$release$shared_ext$major'
2579 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2580 soname_spec='${libname}${release}${shared_ext}$major'
27552581 ;;
27562582 esac
27572583 # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
27642590 version_type=linux # correct to gnu/linux during the next big refactor
27652591 need_lib_prefix=no
27662592 need_version=no
2767 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2768 soname_spec='$libname$release$shared_ext$major'
2593 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
2594 soname_spec='${libname}${release}${shared_ext}$major'
27692595 dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
27702596 shlibpath_var=LD_LIBRARY_PATH
27712597 shlibpath_overrides_runpath=no
27762602 case $host_os in
27772603 nonstopux*) version_type=nonstopux ;;
27782604 *)
2779 if test yes = "$lt_cv_prog_gnu_ld"; then
2605 if test "$lt_cv_prog_gnu_ld" = yes; then
27802606 version_type=linux # correct to gnu/linux during the next big refactor
27812607 else
27822608 version_type=irix
27842610 esac
27852611 need_lib_prefix=no
27862612 need_version=no
2787 soname_spec='$libname$release$shared_ext$major'
2788 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
2613 soname_spec='${libname}${release}${shared_ext}$major'
2614 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
27892615 case $host_os in
27902616 irix5* | nonstopux*)
27912617 libsuff= shlibsuff=
28042630 esac
28052631 shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
28062632 shlibpath_overrides_runpath=no
2807 sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
2808 sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
2633 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
2634 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
28092635 hardcode_into_libs=yes
28102636 ;;
28112637
28122638 # No shared lib support for Linux oldld, aout, or coff.
28132639 linux*oldld* | linux*aout* | linux*coff*)
28142640 dynamic_linker=no
2815 ;;
2816
2817 linux*android*)
2818 version_type=none # Android doesn't support versioned libraries.
2819 need_lib_prefix=no
2820 need_version=no
2821 library_names_spec='$libname$release$shared_ext'
2822 soname_spec='$libname$release$shared_ext'
2823 finish_cmds=
2824 shlibpath_var=LD_LIBRARY_PATH
2825 shlibpath_overrides_runpath=yes
2826
2827 # This implies no fast_install, which is unacceptable.
2828 # Some rework will be needed to allow for fast_install
2829 # before this can be enabled.
2830 hardcode_into_libs=yes
2831
2832 dynamic_linker='Android linker'
2833 # Don't embed -rpath directories since the linker doesn't support them.
2834 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
28352641 ;;
28362642
28372643 # This must be glibc/ELF.
28392645 version_type=linux # correct to gnu/linux during the next big refactor
28402646 need_lib_prefix=no
28412647 need_version=no
2842 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2843 soname_spec='$libname$release$shared_ext$major'
2648 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2649 soname_spec='${libname}${release}${shared_ext}$major'
28442650 finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
28452651 shlibpath_var=LD_LIBRARY_PATH
28462652 shlibpath_overrides_runpath=no
28652671 # before this can be enabled.
28662672 hardcode_into_libs=yes
28672673
2868 # Ideally, we could use ldconfig to report *all* directores which are
2869 # searched for libraries, however this is still not possible. Aside from not
2870 # being certain /sbin/ldconfig is available, command
2871 # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
2872 # even though it is searched at run-time. Try to do the best guess by
2873 # appending ld.so.conf contents (and includes) to the search path.
2674 # Append ld.so.conf contents to the search path
28742675 if test -f /etc/ld.so.conf; then
28752676 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' ' '`
28762677 sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
29022703 need_lib_prefix=no
29032704 need_version=no
29042705 if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
2905 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
2706 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
29062707 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
29072708 dynamic_linker='NetBSD (a.out) ld.so'
29082709 else
2909 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2910 soname_spec='$libname$release$shared_ext$major'
2710 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
2711 soname_spec='${libname}${release}${shared_ext}$major'
29112712 dynamic_linker='NetBSD ld.elf_so'
29122713 fi
29132714 shlibpath_var=LD_LIBRARY_PATH
29172718
29182719 newsos6)
29192720 version_type=linux # correct to gnu/linux during the next big refactor
2920 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2721 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
29212722 shlibpath_var=LD_LIBRARY_PATH
29222723 shlibpath_overrides_runpath=yes
29232724 ;;
29262727 version_type=qnx
29272728 need_lib_prefix=no
29282729 need_version=no
2929 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2930 soname_spec='$libname$release$shared_ext$major'
2730 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2731 soname_spec='${libname}${release}${shared_ext}$major'
29312732 shlibpath_var=LD_LIBRARY_PATH
29322733 shlibpath_overrides_runpath=no
29332734 hardcode_into_libs=yes
29342735 dynamic_linker='ldqnx.so'
29352736 ;;
29362737
2937 openbsd* | bitrig*)
2738 openbsd*)
29382739 version_type=sunos
2939 sys_lib_dlsearch_path_spec=/usr/lib
2740 sys_lib_dlsearch_path_spec="/usr/lib"
29402741 need_lib_prefix=no
2941 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
2942 need_version=no
2943 else
2944 need_version=yes
2945 fi
2946 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
2742 # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
2743 case $host_os in
2744 openbsd3.3 | openbsd3.3.*) need_version=yes ;;
2745 *) need_version=no ;;
2746 esac
2747 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
29472748 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
29482749 shlibpath_var=LD_LIBRARY_PATH
2949 shlibpath_overrides_runpath=yes
2750 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
2751 case $host_os in
2752 openbsd2.[[89]] | openbsd2.[[89]].*)
2753 shlibpath_overrides_runpath=no
2754 ;;
2755 *)
2756 shlibpath_overrides_runpath=yes
2757 ;;
2758 esac
2759 else
2760 shlibpath_overrides_runpath=yes
2761 fi
29502762 ;;
29512763
29522764 os2*)
29532765 libname_spec='$name'
2954 version_type=windows
2955 shrext_cmds=.dll
2956 need_version=no
2766 shrext_cmds=".dll"
29572767 need_lib_prefix=no
2958 # OS/2 can only load a DLL with a base name of 8 characters or less.
2959 soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
2960 v=$($ECHO $release$versuffix | tr -d .-);
2961 n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
2962 $ECHO $n$v`$shared_ext'
2963 library_names_spec='${libname}_dll.$libext'
2768 library_names_spec='$libname${shared_ext} $libname.a'
29642769 dynamic_linker='OS/2 ld.exe'
2965 shlibpath_var=BEGINLIBPATH
2966 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
2967 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
2968 postinstall_cmds='base_file=`basename \$file`~
2969 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
2970 dldir=$destdir/`dirname \$dlpath`~
2971 test -d \$dldir || mkdir -p \$dldir~
2972 $install_prog $dir/$dlname \$dldir/$dlname~
2973 chmod a+x \$dldir/$dlname~
2974 if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
2975 eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
2976 fi'
2977 postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
2978 dlpath=$dir/\$dldll~
2979 $RM \$dlpath'
2770 shlibpath_var=LIBPATH
29802771 ;;
29812772
29822773 osf3* | osf4* | osf5*)
29832774 version_type=osf
29842775 need_lib_prefix=no
29852776 need_version=no
2986 soname_spec='$libname$release$shared_ext$major'
2987 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2777 soname_spec='${libname}${release}${shared_ext}$major'
2778 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
29882779 shlibpath_var=LD_LIBRARY_PATH
29892780 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
2990 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
2781 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
29912782 ;;
29922783
29932784 rdos*)
29982789 version_type=linux # correct to gnu/linux during the next big refactor
29992790 need_lib_prefix=no
30002791 need_version=no
3001 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
3002 soname_spec='$libname$release$shared_ext$major'
2792 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2793 soname_spec='${libname}${release}${shared_ext}$major'
30032794 shlibpath_var=LD_LIBRARY_PATH
30042795 shlibpath_overrides_runpath=yes
30052796 hardcode_into_libs=yes
30092800
30102801 sunos4*)
30112802 version_type=sunos
3012 library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
2803 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
30132804 finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
30142805 shlibpath_var=LD_LIBRARY_PATH
30152806 shlibpath_overrides_runpath=yes
3016 if test yes = "$with_gnu_ld"; then
2807 if test "$with_gnu_ld" = yes; then
30172808 need_lib_prefix=no
30182809 fi
30192810 need_version=yes
30212812
30222813 sysv4 | sysv4.3*)
30232814 version_type=linux # correct to gnu/linux during the next big refactor
3024 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
3025 soname_spec='$libname$release$shared_ext$major'
2815 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2816 soname_spec='${libname}${release}${shared_ext}$major'
30262817 shlibpath_var=LD_LIBRARY_PATH
30272818 case $host_vendor in
30282819 sni)
30432834 ;;
30442835
30452836 sysv4*MP*)
3046 if test -d /usr/nec; then
2837 if test -d /usr/nec ;then
30472838 version_type=linux # correct to gnu/linux during the next big refactor
3048 library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
3049 soname_spec='$libname$shared_ext.$major'
2839 library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
2840 soname_spec='$libname${shared_ext}.$major'
30502841 shlibpath_var=LD_LIBRARY_PATH
30512842 fi
30522843 ;;
30532844
30542845 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
3055 version_type=sco
2846 version_type=freebsd-elf
30562847 need_lib_prefix=no
30572848 need_version=no
3058 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
3059 soname_spec='$libname$release$shared_ext$major'
2849 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
2850 soname_spec='${libname}${release}${shared_ext}$major'
30602851 shlibpath_var=LD_LIBRARY_PATH
30612852 shlibpath_overrides_runpath=yes
30622853 hardcode_into_libs=yes
3063 if test yes = "$with_gnu_ld"; then
2854 if test "$with_gnu_ld" = yes; then
30642855 sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
30652856 else
30662857 sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
30782869 version_type=linux # correct to gnu/linux during the next big refactor
30792870 need_lib_prefix=no
30802871 need_version=no
3081 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
2872 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
30822873 shlibpath_var=LD_LIBRARY_PATH
30832874 shlibpath_overrides_runpath=no
30842875 hardcode_into_libs=yes
30862877
30872878 uts4*)
30882879 version_type=linux # correct to gnu/linux during the next big refactor
3089 library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
3090 soname_spec='$libname$release$shared_ext$major'
2880 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
2881 soname_spec='${libname}${release}${shared_ext}$major'
30912882 shlibpath_var=LD_LIBRARY_PATH
30922883 ;;
30932884
30962887 ;;
30972888 esac
30982889 AC_MSG_RESULT([$dynamic_linker])
3099 test no = "$dynamic_linker" && can_build_shared=no
2890 test "$dynamic_linker" = no && can_build_shared=no
31002891
31012892 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
3102 if test yes = "$GCC"; then
2893 if test "$GCC" = yes; then
31032894 variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
31042895 fi
31052896
3106 if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
3107 sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
2897 if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
2898 sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
31082899 fi
3109
3110 if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
3111 sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
2900 if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
2901 sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
31122902 fi
3113
3114 # remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
3115 configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
3116
3117 # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
3118 func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
3119
3120 # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
3121 configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
31222903
31232904 _LT_DECL([], [variables_saved_for_relink], [1],
31242905 [Variables whose values should be saved in libtool wrapper scripts and
31522933 [Whether we should hardcode library paths into libraries])
31532934 _LT_DECL([], [sys_lib_search_path_spec], [2],
31542935 [Compile-time system search path for libraries])
3155 _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2],
3156 [Detected run-time system search path for libraries])
3157 _LT_DECL([], [configure_time_lt_sys_library_path], [2],
3158 [Explicit LT_SYS_LIBRARY_PATH set during ./configure time])
2936 _LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
2937 [Run-time system search path for libraries])
31592938 ])# _LT_SYS_DYNAMIC_LINKER
31602939
31612940
31622941 # _LT_PATH_TOOL_PREFIX(TOOL)
31632942 # --------------------------
3164 # find a file program that can recognize shared library
2943 # find a file program which can recognize shared library
31652944 AC_DEFUN([_LT_PATH_TOOL_PREFIX],
31662945 [m4_require([_LT_DECL_EGREP])dnl
31672946 AC_MSG_CHECKING([for $1])
31682947 AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
31692948 [case $MAGIC_CMD in
31702949 [[\\/*] | ?:[\\/]*])
3171 lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
2950 lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
31722951 ;;
31732952 *)
3174 lt_save_MAGIC_CMD=$MAGIC_CMD
3175 lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
2953 lt_save_MAGIC_CMD="$MAGIC_CMD"
2954 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
31762955 dnl $ac_dummy forces splitting on constant user-supplied paths.
31772956 dnl POSIX.2 word splitting is done only on the output of word expansions,
31782957 dnl not every word. This closes a longstanding sh security hole.
31792958 ac_dummy="m4_if([$2], , $PATH, [$2])"
31802959 for ac_dir in $ac_dummy; do
3181 IFS=$lt_save_ifs
2960 IFS="$lt_save_ifs"
31822961 test -z "$ac_dir" && ac_dir=.
3183 if test -f "$ac_dir/$1"; then
3184 lt_cv_path_MAGIC_CMD=$ac_dir/"$1"
2962 if test -f $ac_dir/$1; then
2963 lt_cv_path_MAGIC_CMD="$ac_dir/$1"
31852964 if test -n "$file_magic_test_file"; then
31862965 case $deplibs_check_method in
31872966 "file_magic "*)
31882967 file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
3189 MAGIC_CMD=$lt_cv_path_MAGIC_CMD
2968 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
31902969 if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
31912970 $EGREP "$file_magic_regex" > /dev/null; then
31922971 :
32092988 break
32102989 fi
32112990 done
3212 IFS=$lt_save_ifs
3213 MAGIC_CMD=$lt_save_MAGIC_CMD
2991 IFS="$lt_save_ifs"
2992 MAGIC_CMD="$lt_save_MAGIC_CMD"
32142993 ;;
32152994 esac])
3216 MAGIC_CMD=$lt_cv_path_MAGIC_CMD
2995 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
32172996 if test -n "$MAGIC_CMD"; then
32182997 AC_MSG_RESULT($MAGIC_CMD)
32192998 else
32313010
32323011 # _LT_PATH_MAGIC
32333012 # --------------
3234 # find a file program that can recognize a shared library
3013 # find a file program which can recognize a shared library
32353014 m4_defun([_LT_PATH_MAGIC],
32363015 [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
32373016 if test -z "$lt_cv_path_MAGIC_CMD"; then
32583037 AC_ARG_WITH([gnu-ld],
32593038 [AS_HELP_STRING([--with-gnu-ld],
32603039 [assume the C compiler uses GNU ld @<:@default=no@:>@])],
3261 [test no = "$withval" || with_gnu_ld=yes],
3040 [test "$withval" = no || with_gnu_ld=yes],
32623041 [with_gnu_ld=no])dnl
32633042
32643043 ac_prog=ld
3265 if test yes = "$GCC"; then
3044 if test "$GCC" = yes; then
32663045 # Check if gcc -print-prog-name=ld gives a path.
32673046 AC_MSG_CHECKING([for ld used by $CC])
32683047 case $host in
32693048 *-*-mingw*)
3270 # gcc leaves a trailing carriage return, which upsets mingw
3049 # gcc leaves a trailing carriage return which upsets mingw
32713050 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
32723051 *)
32733052 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
32813060 while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
32823061 ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
32833062 done
3284 test -z "$LD" && LD=$ac_prog
3063 test -z "$LD" && LD="$ac_prog"
32853064 ;;
32863065 "")
32873066 # If it fails, then pretend we aren't using GCC.
32923071 with_gnu_ld=unknown
32933072 ;;
32943073 esac
3295 elif test yes = "$with_gnu_ld"; then
3074 elif test "$with_gnu_ld" = yes; then
32963075 AC_MSG_CHECKING([for GNU ld])
32973076 else
32983077 AC_MSG_CHECKING([for non-GNU ld])
32993078 fi
33003079 AC_CACHE_VAL(lt_cv_path_LD,
33013080 [if test -z "$LD"; then
3302 lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
3081 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
33033082 for ac_dir in $PATH; do
3304 IFS=$lt_save_ifs
3083 IFS="$lt_save_ifs"
33053084 test -z "$ac_dir" && ac_dir=.
33063085 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
3307 lt_cv_path_LD=$ac_dir/$ac_prog
3086 lt_cv_path_LD="$ac_dir/$ac_prog"
33083087 # Check to see if the program is GNU ld. I'd rather use --version,
33093088 # but apparently some variants of GNU ld only accept -v.
33103089 # Break only if it was the GNU/non-GNU ld that we prefer.
33113090 case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
33123091 *GNU* | *'with BFD'*)
3313 test no != "$with_gnu_ld" && break
3092 test "$with_gnu_ld" != no && break
33143093 ;;
33153094 *)
3316 test yes != "$with_gnu_ld" && break
3095 test "$with_gnu_ld" != yes && break
33173096 ;;
33183097 esac
33193098 fi
33203099 done
3321 IFS=$lt_save_ifs
3100 IFS="$lt_save_ifs"
33223101 else
3323 lt_cv_path_LD=$LD # Let the user override the test with a path.
3102 lt_cv_path_LD="$LD" # Let the user override the test with a path.
33243103 fi])
3325 LD=$lt_cv_path_LD
3104 LD="$lt_cv_path_LD"
33263105 if test -n "$LD"; then
33273106 AC_MSG_RESULT($LD)
33283107 else
33763155 reload_cmds='$LD$reload_flag -o $output$reload_objs'
33773156 case $host_os in
33783157 cygwin* | mingw* | pw32* | cegcc*)
3379 if test yes != "$GCC"; then
3158 if test "$GCC" != yes; then
33803159 reload_cmds=false
33813160 fi
33823161 ;;
33833162 darwin*)
3384 if test yes = "$GCC"; then
3385 reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs'
3163 if test "$GCC" = yes; then
3164 reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
33863165 else
33873166 reload_cmds='$LD$reload_flag -o $output$reload_objs'
33883167 fi
33913170 _LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
33923171 _LT_TAGDECL([], [reload_cmds], [2])dnl
33933172 ])# _LT_CMD_RELOAD
3394
3395
3396 # _LT_PATH_DD
3397 # -----------
3398 # find a working dd
3399 m4_defun([_LT_PATH_DD],
3400 [AC_CACHE_CHECK([for a working dd], [ac_cv_path_lt_DD],
3401 [printf 0123456789abcdef0123456789abcdef >conftest.i
3402 cat conftest.i conftest.i >conftest2.i
3403 : ${lt_DD:=$DD}
3404 AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd],
3405 [if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
3406 cmp -s conftest.i conftest.out \
3407 && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
3408 fi])
3409 rm -f conftest.i conftest2.i conftest.out])
3410 ])# _LT_PATH_DD
3411
3412
3413 # _LT_CMD_TRUNCATE
3414 # ----------------
3415 # find command to truncate a binary pipe
3416 m4_defun([_LT_CMD_TRUNCATE],
3417 [m4_require([_LT_PATH_DD])
3418 AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin],
3419 [printf 0123456789abcdef0123456789abcdef >conftest.i
3420 cat conftest.i conftest.i >conftest2.i
3421 lt_cv_truncate_bin=
3422 if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
3423 cmp -s conftest.i conftest.out \
3424 && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
3425 fi
3426 rm -f conftest.i conftest2.i conftest.out
3427 test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"])
3428 _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1],
3429 [Command to truncate a binary pipe])
3430 ])# _LT_CMD_TRUNCATE
34313173
34323174
34333175 # _LT_CHECK_MAGIC_METHOD
34453187 # Need to set the preceding variable on all platforms that support
34463188 # interlibrary dependencies.
34473189 # 'none' -- dependencies not supported.
3448 # 'unknown' -- same as none, but documents that we really don't know.
3190 # `unknown' -- same as none, but documents that we really don't know.
34493191 # 'pass_all' -- all dependencies passed with no checks.
34503192 # 'test_compile' -- check by making test program.
34513193 # 'file_magic [[regex]]' -- check by looking for files in library path
3452 # that responds to the $file_magic_cmd with a given extended regex.
3453 # If you have 'file' or equivalent on your system and you're not sure
3454 # whether 'pass_all' will *always* work, you probably want this one.
3194 # which responds to the $file_magic_cmd with a given extended regex.
3195 # If you have `file' or equivalent on your system and you're not sure
3196 # whether `pass_all' will *always* work, you probably want this one.
34553197
34563198 case $host_os in
34573199 aix[[4-9]]*)
34783220 # Base MSYS/MinGW do not provide the 'file' command needed by
34793221 # func_win32_libid shell function, so use a weaker test based on 'objdump',
34803222 # unless we find 'file', for example because we are cross-compiling.
3481 if ( file / ) >/dev/null 2>&1; then
3223 # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
3224 if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
34823225 lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
34833226 lt_cv_file_magic_cmd='func_win32_libid'
34843227 else
35743317 lt_cv_deplibs_check_method=pass_all
35753318 ;;
35763319
3577 openbsd* | bitrig*)
3578 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
3320 openbsd*)
3321 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
35793322 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
35803323 else
35813324 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
36283371 tpf*)
36293372 lt_cv_deplibs_check_method=pass_all
36303373 ;;
3631 os2*)
3632 lt_cv_deplibs_check_method=pass_all
3633 ;;
36343374 esac
36353375 ])
36363376
36713411 AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
36723412 [if test -n "$NM"; then
36733413 # Let the user override the test.
3674 lt_cv_path_NM=$NM
3414 lt_cv_path_NM="$NM"
36753415 else
3676 lt_nm_to_check=${ac_tool_prefix}nm
3416 lt_nm_to_check="${ac_tool_prefix}nm"
36773417 if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
36783418 lt_nm_to_check="$lt_nm_to_check nm"
36793419 fi
36803420 for lt_tmp_nm in $lt_nm_to_check; do
3681 lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
3421 lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
36823422 for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
3683 IFS=$lt_save_ifs
3423 IFS="$lt_save_ifs"
36843424 test -z "$ac_dir" && ac_dir=.
3685 tmp_nm=$ac_dir/$lt_tmp_nm
3686 if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
3425 tmp_nm="$ac_dir/$lt_tmp_nm"
3426 if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
36873427 # Check to see if the nm accepts a BSD-compat flag.
3688 # Adding the 'sed 1q' prevents false positives on HP-UX, which says:
3428 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
36893429 # nm: unknown option "B" ignored
36903430 # Tru64's nm complains that /dev/null is an invalid object file
3691 # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
3692 case $build_os in
3693 mingw*) lt_bad_file=conftest.nm/nofile ;;
3694 *) lt_bad_file=/dev/null ;;
3695 esac
3696 case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
3697 *$lt_bad_file* | *'Invalid file or object type'*)
3431 case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
3432 */dev/null* | *'Invalid file or object type'*)
36983433 lt_cv_path_NM="$tmp_nm -B"
3699 break 2
3434 break
37003435 ;;
37013436 *)
37023437 case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
37033438 */dev/null*)
37043439 lt_cv_path_NM="$tmp_nm -p"
3705 break 2
3440 break
37063441 ;;
37073442 *)
37083443 lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
37133448 esac
37143449 fi
37153450 done
3716 IFS=$lt_save_ifs
3451 IFS="$lt_save_ifs"
37173452 done
37183453 : ${lt_cv_path_NM=no}
37193454 fi])
3720 if test no != "$lt_cv_path_NM"; then
3721 NM=$lt_cv_path_NM
3455 if test "$lt_cv_path_NM" != "no"; then
3456 NM="$lt_cv_path_NM"
37223457 else
37233458 # Didn't find any BSD compatible name lister, look for dumpbin.
37243459 if test -n "$DUMPBIN"; then :
37253460 # Let the user override the test.
37263461 else
37273462 AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
3728 case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
3463 case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
37293464 *COFF*)
3730 DUMPBIN="$DUMPBIN -symbols -headers"
3465 DUMPBIN="$DUMPBIN -symbols"
37313466 ;;
37323467 *)
37333468 DUMPBIN=:
37353470 esac
37363471 fi
37373472 AC_SUBST([DUMPBIN])
3738 if test : != "$DUMPBIN"; then
3739 NM=$DUMPBIN
3473 if test "$DUMPBIN" != ":"; then
3474 NM="$DUMPBIN"
37403475 fi
37413476 fi
37423477 test -z "$NM" && NM=nm
37823517
37833518 case $host_os in
37843519 cygwin* | mingw* | pw32* | cegcc*)
3785 # two different shell functions defined in ltmain.sh;
3786 # decide which one to use based on capabilities of $DLLTOOL
3520 # two different shell functions defined in ltmain.sh
3521 # decide which to use based on capabilities of $DLLTOOL
37873522 case `$DLLTOOL --help 2>&1` in
37883523 *--identify-strict*)
37893524 lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
37953530 ;;
37963531 *)
37973532 # fallback: assume linklib IS sharedlib
3798 lt_cv_sharedlib_from_linklib_cmd=$ECHO
3533 lt_cv_sharedlib_from_linklib_cmd="$ECHO"
37993534 ;;
38003535 esac
38013536 ])
38223557 lt_cv_path_mainfest_tool=yes
38233558 fi
38243559 rm -f conftest*])
3825 if test yes != "$lt_cv_path_mainfest_tool"; then
3560 if test "x$lt_cv_path_mainfest_tool" != xyes; then
38263561 MANIFEST_TOOL=:
38273562 fi
38283563 _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
38293564 ])# _LT_PATH_MANIFEST_TOOL
3830
3831
3832 # _LT_DLL_DEF_P([FILE])
3833 # ---------------------
3834 # True iff FILE is a Windows DLL '.def' file.
3835 # Keep in sync with func_dll_def_p in the libtool script
3836 AC_DEFUN([_LT_DLL_DEF_P],
3837 [dnl
3838 test DEF = "`$SED -n dnl
3839 -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace
3840 -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments
3841 -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl
3842 -e q dnl Only consider the first "real" line
3843 $1`" dnl
3844 ])# _LT_DLL_DEF_P
38453565
38463566
38473567 # LT_LIB_M
38553575 # These system don't have libm, or don't need it
38563576 ;;
38573577 *-ncr-sysv4.3*)
3858 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw)
3578 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
38593579 AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
38603580 ;;
38613581 *)
3862 AC_CHECK_LIB(m, cos, LIBM=-lm)
3582 AC_CHECK_LIB(m, cos, LIBM="-lm")
38633583 ;;
38643584 esac
38653585 AC_SUBST([LIBM])
38783598
38793599 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
38803600
3881 if test yes = "$GCC"; then
3601 if test "$GCC" = yes; then
38823602 case $cc_basename in
38833603 nvcc*)
38843604 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
39303650 symcode='[[ABCDGISTW]]'
39313651 ;;
39323652 hpux*)
3933 if test ia64 = "$host_cpu"; then
3653 if test "$host_cpu" = ia64; then
39343654 symcode='[[ABCDEGRST]]'
39353655 fi
39363656 ;;
39633683 symcode='[[ABCDGIRSTW]]' ;;
39643684 esac
39653685
3966 if test "$lt_cv_nm_interface" = "MS dumpbin"; then
3967 # Gets list of data symbols to import.
3968 lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
3969 # Adjust the below global symbol transforms to fixup imported variables.
3970 lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
3971 lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'"
3972 lt_c_name_lib_hook="\
3973 -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\
3974 -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'"
3975 else
3976 # Disable hooks by default.
3977 lt_cv_sys_global_symbol_to_import=
3978 lt_cdecl_hook=
3979 lt_c_name_hook=
3980 lt_c_name_lib_hook=
3981 fi
3982
39833686 # Transform an extracted symbol line into a proper C declaration.
39843687 # Some systems (esp. on ia64) link data and code symbols differently,
39853688 # so use this general approach.
3986 lt_cv_sys_global_symbol_to_cdecl="sed -n"\
3987 $lt_cdecl_hook\
3988 " -e 's/^T .* \(.*\)$/extern int \1();/p'"\
3989 " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
3689 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
39903690
39913691 # Transform an extracted symbol line into symbol name and symbol address
3992 lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
3993 $lt_c_name_hook\
3994 " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
3995 " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'"
3996
3997 # Transform an extracted symbol line into symbol name with lib prefix and
3998 # symbol address.
3999 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
4000 $lt_c_name_lib_hook\
4001 " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\
4002 " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\
4003 " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'"
3692 lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
3693 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'"
40043694
40053695 # Handle CRLF in mingw tool chain
40063696 opt_cr=
40183708
40193709 # Write the raw and C identifiers.
40203710 if test "$lt_cv_nm_interface" = "MS dumpbin"; then
4021 # Fake it for dumpbin and say T for any non-static function,
4022 # D for any global variable and I for any imported variable.
3711 # Fake it for dumpbin and say T for any non-static function
3712 # and D for any global variable.
40233713 # Also find C++ and __fastcall symbols from MSVC++,
40243714 # which start with @ or ?.
40253715 lt_cv_sys_global_symbol_pipe="$AWK ['"\
40263716 " {last_section=section; section=\$ 3};"\
40273717 " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
40283718 " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
4029 " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
4030 " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
4031 " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
40323719 " \$ 0!~/External *\|/{next};"\
40333720 " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
40343721 " {if(hide[section]) next};"\
4035 " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
4036 " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
4037 " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
4038 " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
3722 " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
3723 " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
3724 " s[1]~/^[@?]/{print s[1], s[1]; next};"\
3725 " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
40393726 " ' prfx=^$ac_symprfx]"
40403727 else
40413728 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
40753762 if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
40763763 cat <<_LT_EOF > conftest.$ac_ext
40773764 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
4078 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
4079 /* DATA imports from DLLs on WIN32 can't be const, because runtime
3765 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
3766 /* DATA imports from DLLs on WIN32 con't be const, because runtime
40803767 relocations are performed -- see ld's documentation on pseudo-relocs. */
40813768 # define LT@&t@_DLSYM_CONST
4082 #elif defined __osf__
3769 #elif defined(__osf__)
40833770 /* This system does not cope well with relocations in const data. */
40843771 # define LT@&t@_DLSYM_CONST
40853772 #else
41053792 {
41063793 { "@PROGRAM@", (void *) 0 },
41073794 _LT_EOF
4108 $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
3795 $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
41093796 cat <<\_LT_EOF >> conftest.$ac_ext
41103797 {0, (void *) 0}
41113798 };
41253812 mv conftest.$ac_objext conftstm.$ac_objext
41263813 lt_globsym_save_LIBS=$LIBS
41273814 lt_globsym_save_CFLAGS=$CFLAGS
4128 LIBS=conftstm.$ac_objext
3815 LIBS="conftstm.$ac_objext"
41293816 CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
4130 if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
3817 if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
41313818 pipe_works=yes
41323819 fi
41333820 LIBS=$lt_globsym_save_LIBS
41483835 rm -rf conftest* conftst*
41493836
41503837 # Do not use the global_symbol_pipe unless it works.
4151 if test yes = "$pipe_works"; then
3838 if test "$pipe_works" = yes; then
41523839 break
41533840 else
41543841 lt_cv_sys_global_symbol_pipe=
41753862 [Take the output of nm and produce a listing of raw symbols and C names])
41763863 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
41773864 [Transform the output of nm in a proper C declaration])
4178 _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1],
4179 [Transform the output of nm into a list of symbols to manually relocate])
41803865 _LT_DECL([global_symbol_to_c_name_address],
41813866 [lt_cv_sys_global_symbol_to_c_name_address], [1],
41823867 [Transform the output of nm in a C name address pair])
41833868 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
41843869 [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
41853870 [Transform the output of nm in a C name address pair when lib prefix is needed])
4186 _LT_DECL([nm_interface], [lt_cv_nm_interface], [1],
4187 [The name lister interface])
41883871 _LT_DECL([], [nm_file_list_spec], [1],
41893872 [Specify filename containing input files for $NM])
41903873 ]) # _LT_CMD_GLOBAL_SYMBOLS
42003883
42013884 m4_if([$1], [CXX], [
42023885 # C++ specific cases for pic, static, wl, etc.
4203 if test yes = "$GXX"; then
3886 if test "$GXX" = yes; then
42043887 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
42053888 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
42063889
42073890 case $host_os in
42083891 aix*)
42093892 # All AIX code is PIC.
4210 if test ia64 = "$host_cpu"; then
3893 if test "$host_cpu" = ia64; then
42113894 # AIX 5 now supports IA64 processor
42123895 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
42133896 fi
4214 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
42153897 ;;
42163898
42173899 amigaos*)
42223904 ;;
42233905 m68k)
42243906 # FIXME: we need at least 68020 code to build shared libraries, but
4225 # adding the '-m68020' flag to GCC prevents building anything better,
4226 # like '-m68040'.
3907 # adding the `-m68020' flag to GCC prevents building anything better,
3908 # like `-m68040'.
42273909 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
42283910 ;;
42293911 esac
42393921 # (--disable-auto-import) libraries
42403922 m4_if([$1], [GCJ], [],
42413923 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
4242 case $host_os in
4243 os2*)
4244 _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
4245 ;;
4246 esac
42473924 ;;
42483925 darwin* | rhapsody*)
42493926 # PIC is the default on this platform
42933970 case $host_os in
42943971 aix[[4-9]]*)
42953972 # All AIX code is PIC.
4296 if test ia64 = "$host_cpu"; then
3973 if test "$host_cpu" = ia64; then
42973974 # AIX 5 now supports IA64 processor
42983975 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
42993976 else
43344011 case $cc_basename in
43354012 CC*)
43364013 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4337 _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
4338 if test ia64 != "$host_cpu"; then
4014 _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
4015 if test "$host_cpu" != ia64; then
43394016 _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
43404017 fi
43414018 ;;
43424019 aCC*)
43434020 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4344 _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
4021 _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
43454022 case $host_cpu in
43464023 hppa*64*|ia64*)
43474024 # +Z the default
43784055 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
43794056 ;;
43804057 ecpc* )
4381 # old Intel C++ for x86_64, which still supported -KPIC.
4058 # old Intel C++ for x86_64 which still supported -KPIC.
43824059 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
43834060 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
43844061 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
45234200 fi
45244201 ],
45254202 [
4526 if test yes = "$GCC"; then
4203 if test "$GCC" = yes; then
45274204 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
45284205 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
45294206
45304207 case $host_os in
45314208 aix*)
45324209 # All AIX code is PIC.
4533 if test ia64 = "$host_cpu"; then
4210 if test "$host_cpu" = ia64; then
45344211 # AIX 5 now supports IA64 processor
45354212 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
45364213 fi
4537 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
45384214 ;;
45394215
45404216 amigaos*)
45454221 ;;
45464222 m68k)
45474223 # FIXME: we need at least 68020 code to build shared libraries, but
4548 # adding the '-m68020' flag to GCC prevents building anything better,
4549 # like '-m68040'.
4224 # adding the `-m68020' flag to GCC prevents building anything better,
4225 # like `-m68040'.
45504226 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
45514227 ;;
45524228 esac
45634239 # (--disable-auto-import) libraries
45644240 m4_if([$1], [GCJ], [],
45654241 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
4566 case $host_os in
4567 os2*)
4568 _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
4569 ;;
4570 esac
45714242 ;;
45724243
45734244 darwin* | rhapsody*)
46384309 case $host_os in
46394310 aix*)
46404311 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4641 if test ia64 = "$host_cpu"; then
4312 if test "$host_cpu" = ia64; then
46424313 # AIX 5 now supports IA64 processor
46434314 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
46444315 else
46464317 fi
46474318 ;;
46484319
4649 darwin* | rhapsody*)
4650 # PIC is the default on this platform
4651 # Common symbols not allowed in MH_DYLIB files
4652 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
4653 case $cc_basename in
4654 nagfor*)
4655 # NAG Fortran compiler
4656 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
4657 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
4658 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4659 ;;
4660 esac
4661 ;;
4662
46634320 mingw* | cygwin* | pw32* | os2* | cegcc*)
46644321 # This hack is so that the source file can tell whether it is being
46654322 # built for inclusion in a dll (and should export symbols for example).
46664323 m4_if([$1], [GCJ], [],
46674324 [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
4668 case $host_os in
4669 os2*)
4670 _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
4671 ;;
4672 esac
46734325 ;;
46744326
46754327 hpux9* | hpux10* | hpux11*)
46854337 ;;
46864338 esac
46874339 # Is there a better lt_prog_compiler_static that works with the bundled CC?
4688 _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
4340 _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
46894341 ;;
46904342
46914343 irix5* | irix6* | nonstopux*)
46964348
46974349 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
46984350 case $cc_basename in
4699 # old Intel for x86_64, which still supported -KPIC.
4351 # old Intel for x86_64 which still supported -KPIC.
47004352 ecc*)
47014353 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
47024354 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
47204372 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
47214373 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
47224374 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
4723 ;;
4724 tcc*)
4725 # Fabrice Bellard et al's Tiny C Compiler
4726 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
4727 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
4728 _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
47294375 ;;
47304376 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
47314377 # Portland Group compilers (*not* the Pentium gcc compiler,
48244470 ;;
48254471
48264472 sysv4*MP*)
4827 if test -d /usr/nec; then
4473 if test -d /usr/nec ;then
48284474 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
48294475 _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
48304476 fi
48534499 fi
48544500 ])
48554501 case $host_os in
4856 # For platforms that do not support PIC, -DPIC is meaningless:
4502 # For platforms which do not support PIC, -DPIC is meaningless:
48574503 *djgpp*)
48584504 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
48594505 ;;
49194565 case $host_os in
49204566 aix[[4-9]]*)
49214567 # If we're using GNU nm, then we don't want the "-C" option.
4922 # -C means demangle to GNU nm, but means don't demangle to AIX nm.
4923 # Without the "-l" option, or with the "-B" option, AIX nm treats
4924 # weak defined symbols like other global defined symbols, whereas
4925 # GNU nm marks them as "W".
4926 # While the 'weak' keyword is ignored in the Export File, we need
4927 # it in the Import File for the 'aix-soname' feature, so we have
4928 # to replace the "-B" option with "-P" for AIX nm.
4568 # -C means demangle to AIX nm, but means don't demangle with GNU nm
4569 # Also, AIX nm treats weak defined symbols like other global defined
4570 # symbols, whereas GNU nm marks them as "W".
49294571 if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
4930 _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
4572 _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'
49314573 else
4932 _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
4574 _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'
49334575 fi
49344576 ;;
49354577 pw32*)
4936 _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
4578 _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
49374579 ;;
49384580 cygwin* | mingw* | cegcc*)
49394581 case $cc_basename in
49824624 # included in the symbol list
49834625 _LT_TAGVAR(include_expsyms, $1)=
49844626 # exclude_expsyms can be an extended regexp of symbols to exclude
4985 # it will be wrapped by ' (' and ')$', so one must not match beginning or
4986 # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
4987 # as well as any symbol that contains 'd'.
4627 # it will be wrapped by ` (' and `)$', so one must not match beginning or
4628 # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
4629 # as well as any symbol that contains `d'.
49884630 _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
49894631 # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
49904632 # platforms (ab)use it in PIC code, but their linkers get confused if
50004642 # FIXME: the MSVC++ port hasn't been tested in a loooong time
50014643 # When not using gcc, we currently assume that we are using
50024644 # Microsoft Visual C++.
5003 if test yes != "$GCC"; then
4645 if test "$GCC" != yes; then
50044646 with_gnu_ld=no
50054647 fi
50064648 ;;
50084650 # we just hope/assume this is gcc and not c89 (= MSVC++)
50094651 with_gnu_ld=yes
50104652 ;;
5011 openbsd* | bitrig*)
4653 openbsd*)
50124654 with_gnu_ld=no
50134655 ;;
50144656 linux* | k*bsd*-gnu | gnu*)
50214663 # On some targets, GNU ld is compatible enough with the native linker
50224664 # that we're better off using the native interface for both.
50234665 lt_use_gnu_ld_interface=no
5024 if test yes = "$with_gnu_ld"; then
4666 if test "$with_gnu_ld" = yes; then
50254667 case $host_os in
50264668 aix*)
50274669 # The AIX port of GNU ld has always aspired to compatibility
50434685 esac
50444686 fi
50454687
5046 if test yes = "$lt_use_gnu_ld_interface"; then
4688 if test "$lt_use_gnu_ld_interface" = yes; then
50474689 # If archive_cmds runs LD, not CC, wlarc should be empty
5048 wlarc='$wl'
4690 wlarc='${wl}'
50494691
50504692 # Set some defaults for GNU ld with shared library support. These
50514693 # are reset later if shared libraries are not supported. Putting them
50524694 # here allows them to be overridden if necessary.
50534695 runpath_var=LD_RUN_PATH
5054 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
5055 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
4696 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
4697 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
50564698 # ancient GNU ld didn't support --whole-archive et. al.
50574699 if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
5058 _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
4700 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
50594701 else
50604702 _LT_TAGVAR(whole_archive_flag_spec, $1)=
50614703 fi
50624704 supports_anon_versioning=no
5063 case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in
4705 case `$LD -v 2>&1` in
50644706 *GNU\ gold*) supports_anon_versioning=yes ;;
50654707 *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
50664708 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
50734715 case $host_os in
50744716 aix[[3-9]]*)
50754717 # On AIX/PPC, the GNU linker is very broken
5076 if test ia64 != "$host_cpu"; then
4718 if test "$host_cpu" != ia64; then
50774719 _LT_TAGVAR(ld_shlibs, $1)=no
50784720 cat <<_LT_EOF 1>&2
50794721
50924734 case $host_cpu in
50934735 powerpc)
50944736 # see comment about AmigaOS4 .so support
5095 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
4737 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
50964738 _LT_TAGVAR(archive_expsym_cmds, $1)=''
50974739 ;;
50984740 m68k)
51084750 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
51094751 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
51104752 # support --undefined. This deserves some investigation. FIXME
5111 _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
4753 _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
51124754 else
51134755 _LT_TAGVAR(ld_shlibs, $1)=no
51144756 fi
51184760 # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
51194761 # as there is no search path for DLLs.
51204762 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5121 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
4763 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
51224764 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
51234765 _LT_TAGVAR(always_export_symbols, $1)=no
51244766 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
51264768 _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
51274769
51284770 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
5129 _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'
5130 # If the export-symbols file already is a .def file, use it as
5131 # is; otherwise, prepend EXPORTS...
5132 _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
5133 cp $export_symbols $output_objdir/$soname.def;
5134 else
5135 echo EXPORTS > $output_objdir/$soname.def;
5136 cat $export_symbols >> $output_objdir/$soname.def;
5137 fi~
5138 $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
4771 _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'
4772 # If the export-symbols file already is a .def file (1st line
4773 # is EXPORTS), use it as is; otherwise, prepend...
4774 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
4775 cp $export_symbols $output_objdir/$soname.def;
4776 else
4777 echo EXPORTS > $output_objdir/$soname.def;
4778 cat $export_symbols >> $output_objdir/$soname.def;
4779 fi~
4780 $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
51394781 else
51404782 _LT_TAGVAR(ld_shlibs, $1)=no
51414783 fi
51424784 ;;
51434785
51444786 haiku*)
5145 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
4787 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
51464788 _LT_TAGVAR(link_all_deplibs, $1)=yes
5147 ;;
5148
5149 os2*)
5150 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
5151 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5152 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
5153 shrext_cmds=.dll
5154 _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
5155 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
5156 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
5157 $ECHO EXPORTS >> $output_objdir/$libname.def~
5158 emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
5159 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
5160 emximp -o $lib $output_objdir/$libname.def'
5161 _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
5162 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
5163 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
5164 $ECHO EXPORTS >> $output_objdir/$libname.def~
5165 prefix_cmds="$SED"~
5166 if test EXPORTS = "`$SED 1q $export_symbols`"; then
5167 prefix_cmds="$prefix_cmds -e 1d";
5168 fi~
5169 prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
5170 cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
5171 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
5172 emximp -o $lib $output_objdir/$libname.def'
5173 _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
5174 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
51754789 ;;
51764790
51774791 interix[[3-9]]*)
51784792 _LT_TAGVAR(hardcode_direct, $1)=no
51794793 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
5180 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
5181 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
4794 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
4795 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
51824796 # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
51834797 # Instead, shared libraries are loaded at an image base (0x10000000 by
51844798 # default) and relocated if they conflict, which is a slow very memory
51854799 # consuming and fragmenting process. To avoid this, we pick a random,
51864800 # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
51874801 # time. Moving up from 0x10000000 also allows more sbrk(2) space.
5188 _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'
5189 _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'
4802 _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'
4803 _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'
51904804 ;;
51914805
51924806 gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
51934807 tmp_diet=no
5194 if test linux-dietlibc = "$host_os"; then
4808 if test "$host_os" = linux-dietlibc; then
51954809 case $cc_basename in
51964810 diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
51974811 esac
51984812 fi
51994813 if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
5200 && test no = "$tmp_diet"
4814 && test "$tmp_diet" = no
52014815 then
52024816 tmp_addflag=' $pic_flag'
52034817 tmp_sharedflag='-shared'
52044818 case $cc_basename,$host_cpu in
52054819 pgcc*) # Portland Group C compiler
5206 _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'
4820 _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'
52074821 tmp_addflag=' $pic_flag'
52084822 ;;
52094823 pgf77* | pgf90* | pgf95* | pgfortran*)
52104824 # Portland Group f77 and f90 compilers
5211 _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'
4825 _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'
52124826 tmp_addflag=' $pic_flag -Mnomain' ;;
52134827 ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
52144828 tmp_addflag=' -i_dynamic' ;;
52194833 lf95*) # Lahey Fortran 8.1
52204834 _LT_TAGVAR(whole_archive_flag_spec, $1)=
52214835 tmp_sharedflag='--shared' ;;
5222 nagfor*) # NAGFOR 5.3
5223 tmp_sharedflag='-Wl,-shared' ;;
52244836 xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
52254837 tmp_sharedflag='-qmkshrobj'
52264838 tmp_addflag= ;;
52274839 nvcc*) # Cuda Compiler Driver 2.2
5228 _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'
4840 _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'
52294841 _LT_TAGVAR(compiler_needs_object, $1)=yes
52304842 ;;
52314843 esac
52324844 case `$CC -V 2>&1 | sed 5q` in
52334845 *Sun\ C*) # Sun C 5.9
5234 _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'
4846 _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'
52354847 _LT_TAGVAR(compiler_needs_object, $1)=yes
52364848 tmp_sharedflag='-G' ;;
52374849 *Sun\ F*) # Sun Fortran 8.3
52384850 tmp_sharedflag='-G' ;;
52394851 esac
5240 _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
5241
5242 if test yes = "$supports_anon_versioning"; then
4852 _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4853
4854 if test "x$supports_anon_versioning" = xyes; then
52434855 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
5244 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
5245 echo "local: *; };" >> $output_objdir/$libname.ver~
5246 $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
4856 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
4857 echo "local: *; };" >> $output_objdir/$libname.ver~
4858 $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
52474859 fi
52484860
52494861 case $cc_basename in
5250 tcc*)
5251 _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic'
5252 ;;
52534862 xlf* | bgf* | bgxlf* | mpixlf*)
52544863 # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
52554864 _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
5256 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
4865 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
52574866 _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
5258 if test yes = "$supports_anon_versioning"; then
4867 if test "x$supports_anon_versioning" = xyes; then
52594868 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
5260 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
5261 echo "local: *; };" >> $output_objdir/$libname.ver~
5262 $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
4869 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
4870 echo "local: *; };" >> $output_objdir/$libname.ver~
4871 $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
52634872 fi
52644873 ;;
52654874 esac
52734882 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
52744883 wlarc=
52754884 else
5276 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
5277 _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'
4885 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4886 _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'
52784887 fi
52794888 ;;
52804889
52924901
52934902 _LT_EOF
52944903 elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
5295 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
5296 _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'
4904 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4905 _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'
52974906 else
52984907 _LT_TAGVAR(ld_shlibs, $1)=no
52994908 fi
53054914 _LT_TAGVAR(ld_shlibs, $1)=no
53064915 cat <<_LT_EOF 1>&2
53074916
5308 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot
4917 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
53094918 *** reliably create shared libraries on SCO systems. Therefore, libtool
53104919 *** is disabling shared libraries support. We urge you to upgrade GNU
53114920 *** binutils to release 2.16.91.0.3 or newer. Another option is to modify
53204929 # DT_RUNPATH tag from executables and libraries. But doing so
53214930 # requires that you compile everything twice, which is a pain.
53224931 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
5323 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
5324 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
5325 _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'
4932 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
4933 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4934 _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'
53264935 else
53274936 _LT_TAGVAR(ld_shlibs, $1)=no
53284937 fi
53394948
53404949 *)
53414950 if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
5342 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
5343 _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'
4951 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
4952 _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'
53444953 else
53454954 _LT_TAGVAR(ld_shlibs, $1)=no
53464955 fi
53474956 ;;
53484957 esac
53494958
5350 if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then
4959 if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
53514960 runpath_var=
53524961 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
53534962 _LT_TAGVAR(export_dynamic_flag_spec, $1)=
53634972 # Note: this linker hardcodes the directories in LIBPATH if there
53644973 # are no directories specified by -L.
53654974 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5366 if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then
4975 if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
53674976 # Neither direct hardcoding nor static linking is supported with a
53684977 # broken collect2.
53694978 _LT_TAGVAR(hardcode_direct, $1)=unsupported
53714980 ;;
53724981
53734982 aix[[4-9]]*)
5374 if test ia64 = "$host_cpu"; then
4983 if test "$host_cpu" = ia64; then
53754984 # On IA64, the linker does run time linking by default, so we don't
53764985 # have to do anything special.
53774986 aix_use_runtimelinking=no
53784987 exp_sym_flag='-Bexport'
5379 no_entry_flag=
4988 no_entry_flag=""
53804989 else
53814990 # If we're using GNU nm, then we don't want the "-C" option.
5382 # -C means demangle to GNU nm, but means don't demangle to AIX nm.
5383 # Without the "-l" option, or with the "-B" option, AIX nm treats
5384 # weak defined symbols like other global defined symbols, whereas
5385 # GNU nm marks them as "W".
5386 # While the 'weak' keyword is ignored in the Export File, we need
5387 # it in the Import File for the 'aix-soname' feature, so we have
5388 # to replace the "-B" option with "-P" for AIX nm.
4991 # -C means demangle to AIX nm, but means don't demangle with GNU nm
4992 # Also, AIX nm treats weak defined symbols like other global
4993 # defined symbols, whereas GNU nm marks them as "W".
53894994 if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
5390 _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
4995 _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'
53914996 else
5392 _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
4997 _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'
53934998 fi
53944999 aix_use_runtimelinking=no
53955000
53965001 # Test if we are trying to use run time linking or normal
53975002 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
5398 # have runtime linking enabled, and use it for executables.
5399 # For shared libraries, we enable/disable runtime linking
5400 # depending on the kind of the shared library created -
5401 # when "with_aix_soname,aix_use_runtimelinking" is:
5402 # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables
5403 # "aix,yes" lib.so shared, rtl:yes, for executables
5404 # lib.a static archive
5405 # "both,no" lib.so.V(shr.o) shared, rtl:yes
5406 # lib.a(lib.so.V) shared, rtl:no, for executables
5407 # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
5408 # lib.a(lib.so.V) shared, rtl:no
5409 # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables
5410 # lib.a static archive
5003 # need to do runtime linking.
54115004 case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
54125005 for ld_flag in $LDFLAGS; do
5413 if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
5006 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
54145007 aix_use_runtimelinking=yes
54155008 break
54165009 fi
54175010 done
5418 if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
5419 # With aix-soname=svr4, we create the lib.so.V shared archives only,
5420 # so we don't have lib.a shared libs to link our executables.
5421 # We have to force runtime linking in this case.
5422 aix_use_runtimelinking=yes
5423 LDFLAGS="$LDFLAGS -Wl,-brtl"
5424 fi
54255011 ;;
54265012 esac
54275013
54405026 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
54415027 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
54425028 _LT_TAGVAR(link_all_deplibs, $1)=yes
5443 _LT_TAGVAR(file_list_spec, $1)='$wl-f,'
5444 case $with_aix_soname,$aix_use_runtimelinking in
5445 aix,*) ;; # traditional, no import file
5446 svr4,* | *,yes) # use import file
5447 # The Import File defines what to hardcode.
5448 _LT_TAGVAR(hardcode_direct, $1)=no
5449 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
5450 ;;
5451 esac
5452
5453 if test yes = "$GCC"; then
5029 _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
5030
5031 if test "$GCC" = yes; then
54545032 case $host_os in aix4.[[012]]|aix4.[[012]].*)
54555033 # We only want to do this on AIX 4.2 and lower, the check
54565034 # below for broken collect2 doesn't work under 4.3+
5457 collect2name=`$CC -print-prog-name=collect2`
5035 collect2name=`${CC} -print-prog-name=collect2`
54585036 if test -f "$collect2name" &&
54595037 strings "$collect2name" | $GREP resolve_lib_name >/dev/null
54605038 then
54735051 ;;
54745052 esac
54755053 shared_flag='-shared'
5476 if test yes = "$aix_use_runtimelinking"; then
5477 shared_flag="$shared_flag "'$wl-G'
5054 if test "$aix_use_runtimelinking" = yes; then
5055 shared_flag="$shared_flag "'${wl}-G'
54785056 fi
5479 # Need to ensure runtime linking is disabled for the traditional
5480 # shared library, or the linker may eventually find shared libraries
5481 # /with/ Import File - we do not want to mix them.
5482 shared_flag_aix='-shared'
5483 shared_flag_svr4='-shared $wl-G'
5057 _LT_TAGVAR(link_all_deplibs, $1)=no
54845058 else
54855059 # not using gcc
5486 if test ia64 = "$host_cpu"; then
5060 if test "$host_cpu" = ia64; then
54875061 # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
54885062 # chokes on -Wl,-G. The following line is correct:
54895063 shared_flag='-G'
54905064 else
5491 if test yes = "$aix_use_runtimelinking"; then
5492 shared_flag='$wl-G'
5065 if test "$aix_use_runtimelinking" = yes; then
5066 shared_flag='${wl}-G'
54935067 else
5494 shared_flag='$wl-bM:SRE'
5068 shared_flag='${wl}-bM:SRE'
54955069 fi
5496 shared_flag_aix='$wl-bM:SRE'
5497 shared_flag_svr4='$wl-G'
54985070 fi
54995071 fi
55005072
5501 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
5073 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
55025074 # It seems that -bexpall does not export symbols beginning with
55035075 # underscore (_), so it is better to generate a list of symbols to export.
55045076 _LT_TAGVAR(always_export_symbols, $1)=yes
5505 if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
5077 if test "$aix_use_runtimelinking" = yes; then
55065078 # Warning - without using the other runtime loading flags (-brtl),
55075079 # -berok will link without error, but may produce a broken library.
55085080 _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
55095081 # Determine the default libpath from the value encoded in an
55105082 # empty executable.
55115083 _LT_SYS_MODULE_PATH_AIX([$1])
5512 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
5513 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
5084 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
5085 _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"
55145086 else
5515 if test ia64 = "$host_cpu"; then
5516 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
5087 if test "$host_cpu" = ia64; then
5088 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
55175089 _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
5518 _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"
5090 _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"
55195091 else
55205092 # Determine the default libpath from the value encoded in an
55215093 # empty executable.
55225094 _LT_SYS_MODULE_PATH_AIX([$1])
5523 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
5095 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
55245096 # Warning - without using the other run time loading flags,
55255097 # -berok will link without error, but may produce a broken library.
5526 _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
5527 _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
5528 if test yes = "$with_gnu_ld"; then
5098 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
5099 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
5100 if test "$with_gnu_ld" = yes; then
55295101 # We only use this code for GNU lds that support --whole-archive.
5530 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
5102 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
55315103 else
55325104 # Exported symbols can be pulled into shared objects from archives
55335105 _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
55345106 fi
55355107 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
5536 _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
5537 # -brtl affects multiple linker settings, -berok does not and is overridden later
5538 compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
5539 if test svr4 != "$with_aix_soname"; then
5540 # This is similar to how AIX traditionally builds its shared libraries.
5541 _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
5542 fi
5543 if test aix != "$with_aix_soname"; then
5544 _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
5545 else
5546 # used by -dlpreopen to get the symbols
5547 _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir'
5548 fi
5549 _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
5108 # This is similar to how AIX traditionally builds its shared libraries.
5109 _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'
55505110 fi
55515111 fi
55525112 ;;
55555115 case $host_cpu in
55565116 powerpc)
55575117 # see comment about AmigaOS4 .so support
5558 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
5118 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
55595119 _LT_TAGVAR(archive_expsym_cmds, $1)=''
55605120 ;;
55615121 m68k)
55855145 # Tell ltmain to make .lib files, not .a files.
55865146 libext=lib
55875147 # Tell ltmain to make .dll files, not .so files.
5588 shrext_cmds=.dll
5148 shrext_cmds=".dll"
55895149 # FIXME: Setting linknames here is a bad hack.
5590 _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
5591 _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
5592 cp "$export_symbols" "$output_objdir/$soname.def";
5593 echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
5594 else
5595 $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
5596 fi~
5597 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
5598 linknames='
5150 _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
5151 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
5152 sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
5153 else
5154 sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
5155 fi~
5156 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
5157 linknames='
55995158 # The linker will not automatically build a static lib if we build a DLL.
56005159 # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
56015160 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
56045163 # Don't use ranlib
56055164 _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
56065165 _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
5607 lt_tool_outputfile="@TOOL_OUTPUT@"~
5608 case $lt_outputfile in
5609 *.exe|*.EXE) ;;
5610 *)
5611 lt_outputfile=$lt_outputfile.exe
5612 lt_tool_outputfile=$lt_tool_outputfile.exe
5613 ;;
5614 esac~
5615 if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
5616 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
5617 $RM "$lt_outputfile.manifest";
5618 fi'
5166 lt_tool_outputfile="@TOOL_OUTPUT@"~
5167 case $lt_outputfile in
5168 *.exe|*.EXE) ;;
5169 *)
5170 lt_outputfile="$lt_outputfile.exe"
5171 lt_tool_outputfile="$lt_tool_outputfile.exe"
5172 ;;
5173 esac~
5174 if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
5175 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
5176 $RM "$lt_outputfile.manifest";
5177 fi'
56195178 ;;
56205179 *)
56215180 # Assume MSVC wrapper
56245183 # Tell ltmain to make .lib files, not .a files.
56255184 libext=lib
56265185 # Tell ltmain to make .dll files, not .so files.
5627 shrext_cmds=.dll
5186 shrext_cmds=".dll"
56285187 # FIXME: Setting linknames here is a bad hack.
56295188 _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
56305189 # The linker will automatically build a .lib file if we build a DLL.
56745233 ;;
56755234
56765235 hpux9*)
5677 if test yes = "$GCC"; then
5678 _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 "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
5236 if test "$GCC" = yes; then
5237 _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'
56795238 else
5680 _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
5239 _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'
56815240 fi
5682 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
5241 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
56835242 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
56845243 _LT_TAGVAR(hardcode_direct, $1)=yes
56855244
56865245 # hardcode_minus_L: Not really in the search PATH,
56875246 # but as the default location of the library.
56885247 _LT_TAGVAR(hardcode_minus_L, $1)=yes
5689 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
5248 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
56905249 ;;
56915250
56925251 hpux10*)
5693 if test yes,no = "$GCC,$with_gnu_ld"; then
5694 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
5252 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
5253 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
56955254 else
56965255 _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
56975256 fi
5698 if test no = "$with_gnu_ld"; then
5699 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
5257 if test "$with_gnu_ld" = no; then
5258 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
57005259 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
57015260 _LT_TAGVAR(hardcode_direct, $1)=yes
57025261 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5703 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
5262 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
57045263 # hardcode_minus_L: Not really in the search PATH,
57055264 # but as the default location of the library.
57065265 _LT_TAGVAR(hardcode_minus_L, $1)=yes
57085267 ;;
57095268
57105269 hpux11*)
5711 if test yes,no = "$GCC,$with_gnu_ld"; then
5270 if test "$GCC" = yes && test "$with_gnu_ld" = no; then
57125271 case $host_cpu in
57135272 hppa*64*)
5714 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
5273 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
57155274 ;;
57165275 ia64*)
5717 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
5276 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
57185277 ;;
57195278 *)
5720 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
5279 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
57215280 ;;
57225281 esac
57235282 else
57245283 case $host_cpu in
57255284 hppa*64*)
5726 _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
5285 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
57275286 ;;
57285287 ia64*)
5729 _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
5288 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
57305289 ;;
57315290 *)
57325291 m4_if($1, [], [
57345293 # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
57355294 _LT_LINKER_OPTION([if $CC understands -b],
57365295 _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
5737 [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
5296 [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
57385297 [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
5739 [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
5298 [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
57405299 ;;
57415300 esac
57425301 fi
5743 if test no = "$with_gnu_ld"; then
5744 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
5302 if test "$with_gnu_ld" = no; then
5303 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
57455304 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
57465305
57475306 case $host_cpu in
57525311 *)
57535312 _LT_TAGVAR(hardcode_direct, $1)=yes
57545313 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5755 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
5314 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
57565315
57575316 # hardcode_minus_L: Not really in the search PATH,
57585317 # but as the default location of the library.
57635322 ;;
57645323
57655324 irix5* | irix6* | nonstopux*)
5766 if test yes = "$GCC"; then
5767 _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'
5325 if test "$GCC" = yes; then
5326 _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'
57685327 # Try to use the -exported_symbol ld option, if it does not
57695328 # work, assume that -exports_file does not work either and
57705329 # implicitly export all symbols.
57715330 # This should be the same for all languages, so no per-tag cache variable.
57725331 AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
57735332 [lt_cv_irix_exported_symbol],
5774 [save_LDFLAGS=$LDFLAGS
5775 LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null"
5333 [save_LDFLAGS="$LDFLAGS"
5334 LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
57765335 AC_LINK_IFELSE(
57775336 [AC_LANG_SOURCE(
57785337 [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
57855344 end]])])],
57865345 [lt_cv_irix_exported_symbol=yes],
57875346 [lt_cv_irix_exported_symbol=no])
5788 LDFLAGS=$save_LDFLAGS])
5789 if test yes = "$lt_cv_irix_exported_symbol"; then
5790 _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'
5347 LDFLAGS="$save_LDFLAGS"])
5348 if test "$lt_cv_irix_exported_symbol" = yes; then
5349 _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'
57915350 fi
5792 _LT_TAGVAR(link_all_deplibs, $1)=no
57935351 else
5794 _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'
5795 _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'
5352 _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'
5353 _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'
57965354 fi
57975355 _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
5798 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
5356 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
57995357 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
58005358 _LT_TAGVAR(inherit_rpath, $1)=yes
58015359 _LT_TAGVAR(link_all_deplibs, $1)=yes
5802 ;;
5803
5804 linux*)
5805 case $cc_basename in
5806 tcc*)
5807 # Fabrice Bellard et al's Tiny C Compiler
5808 _LT_TAGVAR(ld_shlibs, $1)=yes
5809 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5810 ;;
5811 esac
58125360 ;;
58135361
58145362 netbsd* | netbsdelf*-gnu)
58255373 newsos6)
58265374 _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
58275375 _LT_TAGVAR(hardcode_direct, $1)=yes
5828 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
5376 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
58295377 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
58305378 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
58315379 ;;
58335381 *nto* | *qnx*)
58345382 ;;
58355383
5836 openbsd* | bitrig*)
5384 openbsd*)
58375385 if test -f /usr/libexec/ld.so; then
58385386 _LT_TAGVAR(hardcode_direct, $1)=yes
58395387 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
58405388 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
5841 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
5389 if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
58425390 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5843 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
5844 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
5845 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
5391 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
5392 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
5393 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
58465394 else
5847 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5848 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
5395 case $host_os in
5396 openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
5397 _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
5398 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
5399 ;;
5400 *)
5401 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
5402 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
5403 ;;
5404 esac
58495405 fi
58505406 else
58515407 _LT_TAGVAR(ld_shlibs, $1)=no
58565412 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
58575413 _LT_TAGVAR(hardcode_minus_L, $1)=yes
58585414 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
5859 shrext_cmds=.dll
5860 _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
5861 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
5862 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
5863 $ECHO EXPORTS >> $output_objdir/$libname.def~
5864 emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
5865 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
5866 emximp -o $lib $output_objdir/$libname.def'
5867 _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
5868 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
5869 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
5870 $ECHO EXPORTS >> $output_objdir/$libname.def~
5871 prefix_cmds="$SED"~
5872 if test EXPORTS = "`$SED 1q $export_symbols`"; then
5873 prefix_cmds="$prefix_cmds -e 1d";
5874 fi~
5875 prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
5876 cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
5877 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
5878 emximp -o $lib $output_objdir/$libname.def'
5879 _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
5880 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
5415 _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'
5416 _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
58815417 ;;
58825418
58835419 osf3*)
5884 if test yes = "$GCC"; then
5885 _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
5886 _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'
5420 if test "$GCC" = yes; then
5421 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
5422 _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'
58875423 else
58885424 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
5889 _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'
5425 _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'
58905426 fi
58915427 _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
5892 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
5428 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
58935429 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
58945430 ;;
58955431
58965432 osf4* | osf5*) # as osf3* with the addition of -msym flag
5897 if test yes = "$GCC"; then
5898 _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
5899 _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'
5900 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
5433 if test "$GCC" = yes; then
5434 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
5435 _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'
5436 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
59015437 else
59025438 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
5903 _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'
5439 _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'
59045440 _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~
5905 $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'
5441 $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'
59065442
59075443 # Both c and cxx compiler support -rpath directly
59085444 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
59135449
59145450 solaris*)
59155451 _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
5916 if test yes = "$GCC"; then
5917 wlarc='$wl'
5918 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
5452 if test "$GCC" = yes; then
5453 wlarc='${wl}'
5454 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
59195455 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
5920 $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'
5456 $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'
59215457 else
59225458 case `$CC -V 2>&1` in
59235459 *"Compilers 5.0"*)
59245460 wlarc=''
5925 _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
5461 _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
59265462 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
5927 $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
5463 $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
59285464 ;;
59295465 *)
5930 wlarc='$wl'
5931 _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
5466 wlarc='${wl}'
5467 _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
59325468 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
5933 $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
5469 $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
59345470 ;;
59355471 esac
59365472 fi
59405476 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
59415477 *)
59425478 # The compiler driver will combine and reorder linker options,
5943 # but understands '-z linker_flag'. GCC discards it without '$wl',
5479 # but understands `-z linker_flag'. GCC discards it without `$wl',
59445480 # but is careful enough not to reorder.
59455481 # Supported since Solaris 2.6 (maybe 2.5.1?)
5946 if test yes = "$GCC"; then
5947 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
5482 if test "$GCC" = yes; then
5483 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
59485484 else
59495485 _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
59505486 fi
59545490 ;;
59555491
59565492 sunos4*)
5957 if test sequent = "$host_vendor"; then
5493 if test "x$host_vendor" = xsequent; then
59585494 # Use $CC to link under sequent, because it throws in some extra .o
59595495 # files that make .init and .fini sections work.
5960 _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
5496 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
59615497 else
59625498 _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
59635499 fi
60065542 ;;
60075543
60085544 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
6009 _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
5545 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
60105546 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
60115547 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
60125548 runpath_var='LD_RUN_PATH'
60135549
6014 if test yes = "$GCC"; then
6015 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6016 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5550 if test "$GCC" = yes; then
5551 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5552 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
60175553 else
6018 _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6019 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5554 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5555 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
60205556 fi
60215557 ;;
60225558
60235559 sysv5* | sco3.2v5* | sco5v6*)
6024 # Note: We CANNOT use -z defs as we might desire, because we do not
5560 # Note: We can NOT use -z defs as we might desire, because we do not
60255561 # link with -lc, and that would cause any symbols used from libc to
60265562 # always be unresolved, which means just about no library would
60275563 # ever link correctly. If we're not using GNU ld we use -z text
60285564 # though, which does catch some bad symbols but isn't as heavy-handed
60295565 # as -z defs.
6030 _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
6031 _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
5566 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
5567 _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
60325568 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
60335569 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6034 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
5570 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
60355571 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
60365572 _LT_TAGVAR(link_all_deplibs, $1)=yes
6037 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
5573 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
60385574 runpath_var='LD_RUN_PATH'
60395575
6040 if test yes = "$GCC"; then
6041 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6042 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5576 if test "$GCC" = yes; then
5577 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5578 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
60435579 else
6044 _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6045 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5580 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
5581 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
60465582 fi
60475583 ;;
60485584
60575593 ;;
60585594 esac
60595595
6060 if test sni = "$host_vendor"; then
5596 if test x$host_vendor = xsni; then
60615597 case $host in
60625598 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
6063 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym'
5599 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
60645600 ;;
60655601 esac
60665602 fi
60675603 fi
60685604 ])
60695605 AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
6070 test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
5606 test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
60715607
60725608 _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
60735609
60845620 # Assume -lc should be added
60855621 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
60865622
6087 if test yes,yes = "$GCC,$enable_shared"; then
5623 if test "$enable_shared" = yes && test "$GCC" = yes; then
60885624 case $_LT_TAGVAR(archive_cmds, $1) in
60895625 *'~'*)
60905626 # FIXME: we may have to deal with multi-command sequences.
61645700 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
61655701 [Whether we need a single "-rpath" flag with a separated argument])
61665702 _LT_TAGDECL([], [hardcode_direct], [0],
6167 [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
5703 [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
61685704 DIR into the resulting binary])
61695705 _LT_TAGDECL([], [hardcode_direct_absolute], [0],
6170 [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
5706 [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
61715707 DIR into the resulting binary and the resulting library dependency is
6172 "absolute", i.e impossible to change by setting $shlibpath_var if the
5708 "absolute", i.e impossible to change by setting ${shlibpath_var} if the
61735709 library is relocated])
61745710 _LT_TAGDECL([], [hardcode_minus_L], [0],
61755711 [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
62105746 # ------------------------
62115747 # Ensure that the configuration variables for a C compiler are suitably
62125748 # defined. These variables are subsequently used by _LT_CONFIG to write
6213 # the compiler configuration to 'libtool'.
5749 # the compiler configuration to `libtool'.
62145750 m4_defun([_LT_LANG_C_CONFIG],
62155751 [m4_require([_LT_DECL_EGREP])dnl
6216 lt_save_CC=$CC
5752 lt_save_CC="$CC"
62175753 AC_LANG_PUSH(C)
62185754
62195755 # Source file extension for C test sources.
62535789 LT_SYS_DLOPEN_SELF
62545790 _LT_CMD_STRIPLIB
62555791
6256 # Report what library types will actually be built
5792 # Report which library types will actually be built
62575793 AC_MSG_CHECKING([if libtool supports shared libraries])
62585794 AC_MSG_RESULT([$can_build_shared])
62595795
62605796 AC_MSG_CHECKING([whether to build shared libraries])
6261 test no = "$can_build_shared" && enable_shared=no
5797 test "$can_build_shared" = "no" && enable_shared=no
62625798
62635799 # On AIX, shared libraries and static libraries use the same namespace, and
62645800 # are all built from PIC.
62655801 case $host_os in
62665802 aix3*)
6267 test yes = "$enable_shared" && enable_static=no
5803 test "$enable_shared" = yes && enable_static=no
62685804 if test -n "$RANLIB"; then
62695805 archive_cmds="$archive_cmds~\$RANLIB \$lib"
62705806 postinstall_cmds='$RANLIB $lib'
62725808 ;;
62735809
62745810 aix[[4-9]]*)
6275 if test ia64 != "$host_cpu"; then
6276 case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
6277 yes,aix,yes) ;; # shared object as lib.so file only
6278 yes,svr4,*) ;; # shared object as lib.so archive member only
6279 yes,*) enable_static=no ;; # shared object in lib.a archive as well
6280 esac
5811 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
5812 test "$enable_shared" = yes && enable_static=no
62815813 fi
62825814 ;;
62835815 esac
62855817
62865818 AC_MSG_CHECKING([whether to build static libraries])
62875819 # Make sure either enable_shared or enable_static is yes.
6288 test yes = "$enable_shared" || enable_static=yes
5820 test "$enable_shared" = yes || enable_static=yes
62895821 AC_MSG_RESULT([$enable_static])
62905822
62915823 _LT_CONFIG($1)
62925824 fi
62935825 AC_LANG_POP
6294 CC=$lt_save_CC
5826 CC="$lt_save_CC"
62955827 ])# _LT_LANG_C_CONFIG
62965828
62975829
62995831 # --------------------------
63005832 # Ensure that the configuration variables for a C++ compiler are suitably
63015833 # defined. These variables are subsequently used by _LT_CONFIG to write
6302 # the compiler configuration to 'libtool'.
5834 # the compiler configuration to `libtool'.
63035835 m4_defun([_LT_LANG_CXX_CONFIG],
63045836 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
63055837 m4_require([_LT_DECL_EGREP])dnl
63065838 m4_require([_LT_PATH_MANIFEST_TOOL])dnl
6307 if test -n "$CXX" && ( test no != "$CXX" &&
6308 ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) ||
6309 (test g++ != "$CXX"))); then
5839 if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
5840 ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
5841 (test "X$CXX" != "Xg++"))) ; then
63105842 AC_PROG_CXXCPP
63115843 else
63125844 _lt_caught_CXX_error=yes
63485880 # the CXX compiler isn't working. Some variables (like enable_shared)
63495881 # are currently assumed to apply to all compilers on this platform,
63505882 # and will be corrupted by setting them based on a non-working compiler.
6351 if test yes != "$_lt_caught_CXX_error"; then
5883 if test "$_lt_caught_CXX_error" != yes; then
63525884 # Code to be used in simple compile tests
63535885 lt_simple_compile_test_code="int some_variable = 0;"
63545886
63905922 if test -n "$compiler"; then
63915923 # We don't want -fno-exception when compiling C++ code, so set the
63925924 # no_builtin_flag separately
6393 if test yes = "$GXX"; then
5925 if test "$GXX" = yes; then
63945926 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
63955927 else
63965928 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
63975929 fi
63985930
6399 if test yes = "$GXX"; then
5931 if test "$GXX" = yes; then
64005932 # Set up default GNU C++ configuration
64015933
64025934 LT_PATH_LD
64035935
64045936 # Check if GNU C++ uses GNU ld as the underlying linker, since the
64055937 # archiving commands below assume that GNU ld is being used.
6406 if test yes = "$with_gnu_ld"; then
6407 _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
6408 _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'
6409
6410 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
6411 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
5938 if test "$with_gnu_ld" = yes; then
5939 _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
5940 _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'
5941
5942 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
5943 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
64125944
64135945 # If archive_cmds runs LD, not CC, wlarc should be empty
64145946 # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
64155947 # investigate it a little bit more. (MM)
6416 wlarc='$wl'
5948 wlarc='${wl}'
64175949
64185950 # ancient GNU ld didn't support --whole-archive et. al.
64195951 if eval "`$CC -print-prog-name=ld` --help 2>&1" |
64205952 $GREP 'no-whole-archive' > /dev/null; then
6421 _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
5953 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
64225954 else
64235955 _LT_TAGVAR(whole_archive_flag_spec, $1)=
64245956 fi
64545986 _LT_TAGVAR(ld_shlibs, $1)=no
64555987 ;;
64565988 aix[[4-9]]*)
6457 if test ia64 = "$host_cpu"; then
5989 if test "$host_cpu" = ia64; then
64585990 # On IA64, the linker does run time linking by default, so we don't
64595991 # have to do anything special.
64605992 aix_use_runtimelinking=no
64615993 exp_sym_flag='-Bexport'
6462 no_entry_flag=
5994 no_entry_flag=""
64635995 else
64645996 aix_use_runtimelinking=no
64655997
64665998 # Test if we are trying to use run time linking or normal
64675999 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
6468 # have runtime linking enabled, and use it for executables.
6469 # For shared libraries, we enable/disable runtime linking
6470 # depending on the kind of the shared library created -
6471 # when "with_aix_soname,aix_use_runtimelinking" is:
6472 # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables
6473 # "aix,yes" lib.so shared, rtl:yes, for executables
6474 # lib.a static archive
6475 # "both,no" lib.so.V(shr.o) shared, rtl:yes
6476 # lib.a(lib.so.V) shared, rtl:no, for executables
6477 # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
6478 # lib.a(lib.so.V) shared, rtl:no
6479 # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables
6480 # lib.a static archive
6000 # need to do runtime linking.
64816001 case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
64826002 for ld_flag in $LDFLAGS; do
64836003 case $ld_flag in
64876007 ;;
64886008 esac
64896009 done
6490 if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
6491 # With aix-soname=svr4, we create the lib.so.V shared archives only,
6492 # so we don't have lib.a shared libs to link our executables.
6493 # We have to force runtime linking in this case.
6494 aix_use_runtimelinking=yes
6495 LDFLAGS="$LDFLAGS -Wl,-brtl"
6496 fi
64976010 ;;
64986011 esac
64996012
65126025 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
65136026 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
65146027 _LT_TAGVAR(link_all_deplibs, $1)=yes
6515 _LT_TAGVAR(file_list_spec, $1)='$wl-f,'
6516 case $with_aix_soname,$aix_use_runtimelinking in
6517 aix,*) ;; # no import file
6518 svr4,* | *,yes) # use import file
6519 # The Import File defines what to hardcode.
6520 _LT_TAGVAR(hardcode_direct, $1)=no
6521 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
6522 ;;
6523 esac
6524
6525 if test yes = "$GXX"; then
6028 _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
6029
6030 if test "$GXX" = yes; then
65266031 case $host_os in aix4.[[012]]|aix4.[[012]].*)
65276032 # We only want to do this on AIX 4.2 and lower, the check
65286033 # below for broken collect2 doesn't work under 4.3+
6529 collect2name=`$CC -print-prog-name=collect2`
6034 collect2name=`${CC} -print-prog-name=collect2`
65306035 if test -f "$collect2name" &&
65316036 strings "$collect2name" | $GREP resolve_lib_name >/dev/null
65326037 then
65446049 fi
65456050 esac
65466051 shared_flag='-shared'
6547 if test yes = "$aix_use_runtimelinking"; then
6548 shared_flag=$shared_flag' $wl-G'
6052 if test "$aix_use_runtimelinking" = yes; then
6053 shared_flag="$shared_flag "'${wl}-G'
65496054 fi
6550 # Need to ensure runtime linking is disabled for the traditional
6551 # shared library, or the linker may eventually find shared libraries
6552 # /with/ Import File - we do not want to mix them.
6553 shared_flag_aix='-shared'
6554 shared_flag_svr4='-shared $wl-G'
65556055 else
65566056 # not using gcc
6557 if test ia64 = "$host_cpu"; then
6057 if test "$host_cpu" = ia64; then
65586058 # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
65596059 # chokes on -Wl,-G. The following line is correct:
65606060 shared_flag='-G'
65616061 else
6562 if test yes = "$aix_use_runtimelinking"; then
6563 shared_flag='$wl-G'
6062 if test "$aix_use_runtimelinking" = yes; then
6063 shared_flag='${wl}-G'
65646064 else
6565 shared_flag='$wl-bM:SRE'
6065 shared_flag='${wl}-bM:SRE'
65666066 fi
6567 shared_flag_aix='$wl-bM:SRE'
6568 shared_flag_svr4='$wl-G'
65696067 fi
65706068 fi
65716069
6572 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
6070 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
65736071 # It seems that -bexpall does not export symbols beginning with
65746072 # underscore (_), so it is better to generate a list of symbols to
65756073 # export.
65766074 _LT_TAGVAR(always_export_symbols, $1)=yes
6577 if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
6075 if test "$aix_use_runtimelinking" = yes; then
65786076 # Warning - without using the other runtime loading flags (-brtl),
65796077 # -berok will link without error, but may produce a broken library.
6580 # The "-G" linker flag allows undefined symbols.
6581 _LT_TAGVAR(no_undefined_flag, $1)='-bernotok'
6078 _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
65826079 # Determine the default libpath from the value encoded in an empty
65836080 # executable.
65846081 _LT_SYS_MODULE_PATH_AIX([$1])
6585 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
6586
6587 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
6082 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
6083
6084 _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"
65886085 else
6589 if test ia64 = "$host_cpu"; then
6590 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
6086 if test "$host_cpu" = ia64; then
6087 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
65916088 _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
6592 _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"
6089 _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"
65936090 else
65946091 # Determine the default libpath from the value encoded in an
65956092 # empty executable.
65966093 _LT_SYS_MODULE_PATH_AIX([$1])
6597 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
6094 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
65986095 # Warning - without using the other run time loading flags,
65996096 # -berok will link without error, but may produce a broken library.
6600 _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
6601 _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
6602 if test yes = "$with_gnu_ld"; then
6097 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
6098 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
6099 if test "$with_gnu_ld" = yes; then
66036100 # We only use this code for GNU lds that support --whole-archive.
6604 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
6101 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
66056102 else
66066103 # Exported symbols can be pulled into shared objects from archives
66076104 _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
66086105 fi
66096106 _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
6610 _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
6611 # -brtl affects multiple linker settings, -berok does not and is overridden later
6612 compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
6613 if test svr4 != "$with_aix_soname"; then
6614 # This is similar to how AIX traditionally builds its shared
6615 # libraries. Need -bnortl late, we may have -brtl in LDFLAGS.
6616 _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
6617 fi
6618 if test aix != "$with_aix_soname"; then
6619 _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
6620 else
6621 # used by -dlpreopen to get the symbols
6622 _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir'
6623 fi
6624 _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
6107 # This is similar to how AIX traditionally builds its shared
6108 # libraries.
6109 _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'
66256110 fi
66266111 fi
66276112 ;;
66316116 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
66326117 # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
66336118 # support --undefined. This deserves some investigation. FIXME
6634 _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
6119 _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
66356120 else
66366121 _LT_TAGVAR(ld_shlibs, $1)=no
66376122 fi
66596144 # Tell ltmain to make .lib files, not .a files.
66606145 libext=lib
66616146 # Tell ltmain to make .dll files, not .so files.
6662 shrext_cmds=.dll
6147 shrext_cmds=".dll"
66636148 # FIXME: Setting linknames here is a bad hack.
6664 _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
6665 _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
6666 cp "$export_symbols" "$output_objdir/$soname.def";
6667 echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
6668 else
6669 $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
6670 fi~
6671 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
6672 linknames='
6149 _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
6150 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
6151 $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
6152 else
6153 $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
6154 fi~
6155 $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
6156 linknames='
66736157 # The linker will not automatically build a static lib if we build a DLL.
66746158 # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
66756159 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
66766160 # Don't use ranlib
66776161 _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
66786162 _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
6679 lt_tool_outputfile="@TOOL_OUTPUT@"~
6680 case $lt_outputfile in
6681 *.exe|*.EXE) ;;
6682 *)
6683 lt_outputfile=$lt_outputfile.exe
6684 lt_tool_outputfile=$lt_tool_outputfile.exe
6685 ;;
6686 esac~
6687 func_to_tool_file "$lt_outputfile"~
6688 if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
6689 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
6690 $RM "$lt_outputfile.manifest";
6691 fi'
6163 lt_tool_outputfile="@TOOL_OUTPUT@"~
6164 case $lt_outputfile in
6165 *.exe|*.EXE) ;;
6166 *)
6167 lt_outputfile="$lt_outputfile.exe"
6168 lt_tool_outputfile="$lt_tool_outputfile.exe"
6169 ;;
6170 esac~
6171 func_to_tool_file "$lt_outputfile"~
6172 if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
6173 $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
6174 $RM "$lt_outputfile.manifest";
6175 fi'
66926176 ;;
66936177 *)
66946178 # g++
66956179 # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
66966180 # as there is no search path for DLLs.
66976181 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
6698 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
6182 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
66996183 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
67006184 _LT_TAGVAR(always_export_symbols, $1)=no
67016185 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
67026186
67036187 if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
6704 _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'
6705 # If the export-symbols file already is a .def file, use it as
6706 # is; otherwise, prepend EXPORTS...
6707 _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
6708 cp $export_symbols $output_objdir/$soname.def;
6709 else
6710 echo EXPORTS > $output_objdir/$soname.def;
6711 cat $export_symbols >> $output_objdir/$soname.def;
6712 fi~
6713 $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'
6188 _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'
6189 # If the export-symbols file already is a .def file (1st line
6190 # is EXPORTS), use it as is; otherwise, prepend...
6191 _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
6192 cp $export_symbols $output_objdir/$soname.def;
6193 else
6194 echo EXPORTS > $output_objdir/$soname.def;
6195 cat $export_symbols >> $output_objdir/$soname.def;
6196 fi~
6197 $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'
67146198 else
67156199 _LT_TAGVAR(ld_shlibs, $1)=no
67166200 fi
67196203 ;;
67206204 darwin* | rhapsody*)
67216205 _LT_DARWIN_LINKER_FEATURES($1)
6722 ;;
6723
6724 os2*)
6725 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
6726 _LT_TAGVAR(hardcode_minus_L, $1)=yes
6727 _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
6728 shrext_cmds=.dll
6729 _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
6730 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
6731 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
6732 $ECHO EXPORTS >> $output_objdir/$libname.def~
6733 emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
6734 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
6735 emximp -o $lib $output_objdir/$libname.def'
6736 _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
6737 $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
6738 $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
6739 $ECHO EXPORTS >> $output_objdir/$libname.def~
6740 prefix_cmds="$SED"~
6741 if test EXPORTS = "`$SED 1q $export_symbols`"; then
6742 prefix_cmds="$prefix_cmds -e 1d";
6743 fi~
6744 prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
6745 cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
6746 $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
6747 emximp -o $lib $output_objdir/$libname.def'
6748 _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
6749 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
67506206 ;;
67516207
67526208 dgux*)
67846240 ;;
67856241
67866242 haiku*)
6787 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
6243 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
67886244 _LT_TAGVAR(link_all_deplibs, $1)=yes
67896245 ;;
67906246
67916247 hpux9*)
6792 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
6248 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
67936249 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
6794 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
6250 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
67956251 _LT_TAGVAR(hardcode_direct, $1)=yes
67966252 _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
67976253 # but as the default
68036259 _LT_TAGVAR(ld_shlibs, $1)=no
68046260 ;;
68056261 aCC*)
6806 _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 "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
6262 _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'
68076263 # Commands to make compiler produce verbose output that lists
68086264 # what "hidden" libraries, object files and flags are used when
68096265 # linking a shared library.
68126268 # explicitly linking system object files so we need to strip them
68136269 # from the output so that they don't get included in the library
68146270 # dependencies.
6815 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"'
6271 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"'
68166272 ;;
68176273 *)
6818 if test yes = "$GXX"; then
6819 _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 "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
6274 if test "$GXX" = yes; then
6275 _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'
68206276 else
68216277 # FIXME: insert proper C++ library support
68226278 _LT_TAGVAR(ld_shlibs, $1)=no
68266282 ;;
68276283
68286284 hpux10*|hpux11*)
6829 if test no = "$with_gnu_ld"; then
6830 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
6285 if test $with_gnu_ld = no; then
6286 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
68316287 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
68326288
68336289 case $host_cpu in
68346290 hppa*64*|ia64*)
68356291 ;;
68366292 *)
6837 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
6293 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
68386294 ;;
68396295 esac
68406296 fi
68606316 aCC*)
68616317 case $host_cpu in
68626318 hppa*64*)
6863 _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6319 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
68646320 ;;
68656321 ia64*)
6866 _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6322 _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
68676323 ;;
68686324 *)
6869 _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'
6325 _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'
68706326 ;;
68716327 esac
68726328 # Commands to make compiler produce verbose output that lists
68776333 # explicitly linking system object files so we need to strip them
68786334 # from the output so that they don't get included in the library
68796335 # dependencies.
6880 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"'
6336 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"'
68816337 ;;
68826338 *)
6883 if test yes = "$GXX"; then
6884 if test no = "$with_gnu_ld"; then
6339 if test "$GXX" = yes; then
6340 if test $with_gnu_ld = no; then
68856341 case $host_cpu in
68866342 hppa*64*)
6887 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6343 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
68886344 ;;
68896345 ia64*)
6890 _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'
6346 _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'
68916347 ;;
68926348 *)
6893 _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'
6349 _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'
68946350 ;;
68956351 esac
68966352 fi
69056361 interix[[3-9]]*)
69066362 _LT_TAGVAR(hardcode_direct, $1)=no
69076363 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
6908 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
6909 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
6364 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6365 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
69106366 # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
69116367 # Instead, shared libraries are loaded at an image base (0x10000000 by
69126368 # default) and relocated if they conflict, which is a slow very memory
69136369 # consuming and fragmenting process. To avoid this, we pick a random,
69146370 # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
69156371 # time. Moving up from 0x10000000 also allows more sbrk(2) space.
6916 _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'
6917 _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'
6372 _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'
6373 _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'
69186374 ;;
69196375 irix5* | irix6*)
69206376 case $cc_basename in
69216377 CC*)
69226378 # SGI C++
6923 _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'
6379 _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'
69246380
69256381 # Archives containing C++ object files must be created using
69266382 # "CC -ar", where "CC" is the IRIX C++ compiler. This is
69296385 _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
69306386 ;;
69316387 *)
6932 if test yes = "$GXX"; then
6933 if test no = "$with_gnu_ld"; then
6934 _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'
6388 if test "$GXX" = yes; then
6389 if test "$with_gnu_ld" = no; then
6390 _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'
69356391 else
6936 _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'
6392 _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'
69376393 fi
69386394 fi
69396395 _LT_TAGVAR(link_all_deplibs, $1)=yes
69406396 ;;
69416397 esac
6942 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
6398 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
69436399 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
69446400 _LT_TAGVAR(inherit_rpath, $1)=yes
69456401 ;;
69526408 # KCC will only create a shared library if the output file
69536409 # ends with ".so" (or ".sl" for HP-UX), so rename the library
69546410 # to its proper name (with version) after linking.
6955 _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'
6956 _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'
6411 _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'
6412 _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'
69576413 # Commands to make compiler produce verbose output that lists
69586414 # what "hidden" libraries, object files and flags are used when
69596415 # linking a shared library.
69626418 # explicitly linking system object files so we need to strip them
69636419 # from the output so that they don't get included in the library
69646420 # dependencies.
6965 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"'
6966
6967 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
6968 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
6421 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"'
6422
6423 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6424 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
69696425
69706426 # Archives containing C++ object files must be created using
69716427 # "CC -Bstatic", where "CC" is the KAI C++ compiler.
69796435 # earlier do not add the objects themselves.
69806436 case `$CC -V 2>&1` in
69816437 *"Version 7."*)
6982 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
6983 _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'
6438 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
6439 _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'
69846440 ;;
69856441 *) # Version 8.0 or newer
69866442 tmp_idyn=
69876443 case $host_cpu in
69886444 ia64*) tmp_idyn=' -i_dynamic';;
69896445 esac
6990 _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
6991 _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'
6446 _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6447 _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'
69926448 ;;
69936449 esac
69946450 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
6995 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
6996 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
6997 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
6451 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6452 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6453 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
69986454 ;;
69996455 pgCC* | pgcpp*)
70006456 # Portland Group C++ compiler
70016457 case `$CC -V` in
70026458 *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
70036459 _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
7004 rm -rf $tpldir~
7005 $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
7006 compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
6460 rm -rf $tpldir~
6461 $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
6462 compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
70076463 _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
7008 rm -rf $tpldir~
7009 $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
7010 $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
7011 $RANLIB $oldlib'
6464 rm -rf $tpldir~
6465 $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
6466 $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
6467 $RANLIB $oldlib'
70126468 _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
7013 rm -rf $tpldir~
7014 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
7015 $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
6469 rm -rf $tpldir~
6470 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
6471 $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
70166472 _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
7017 rm -rf $tpldir~
7018 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
7019 $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'
6473 rm -rf $tpldir~
6474 $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
6475 $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'
70206476 ;;
70216477 *) # Version 6 and above use weak symbols
7022 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
7023 _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'
6478 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
6479 _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'
70246480 ;;
70256481 esac
70266482
7027 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir'
7028 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
7029 _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'
6483 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
6484 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6485 _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'
70306486 ;;
70316487 cxx*)
70326488 # Compaq C++
7033 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
7034 _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'
6489 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
6490 _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'
70356491
70366492 runpath_var=LD_RUN_PATH
70376493 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
70456501 # explicitly linking system object files so we need to strip them
70466502 # from the output so that they don't get included in the library
70476503 # dependencies.
7048 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'
6504 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'
70496505 ;;
70506506 xl* | mpixl* | bgxl*)
70516507 # IBM XL 8.0 on PPC, with GNU ld
7052 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
7053 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
7054 _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
7055 if test yes = "$supports_anon_versioning"; then
6508 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
6509 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
6510 _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
6511 if test "x$supports_anon_versioning" = xyes; then
70566512 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
7057 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
7058 echo "local: *; };" >> $output_objdir/$libname.ver~
7059 $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
6513 cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
6514 echo "local: *; };" >> $output_objdir/$libname.ver~
6515 $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
70606516 fi
70616517 ;;
70626518 *)
70646520 *Sun\ C*)
70656521 # Sun C++ 5.9
70666522 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
7067 _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
7068 _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'
6523 _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6524 _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'
70696525 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
7070 _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'
6526 _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'
70716527 _LT_TAGVAR(compiler_needs_object, $1)=yes
70726528
70736529 # Not sure whether something based on
71256581 _LT_TAGVAR(ld_shlibs, $1)=yes
71266582 ;;
71276583
7128 openbsd* | bitrig*)
6584 openbsd2*)
6585 # C++ shared libraries are fairly broken
6586 _LT_TAGVAR(ld_shlibs, $1)=no
6587 ;;
6588
6589 openbsd*)
71296590 if test -f /usr/libexec/ld.so; then
71306591 _LT_TAGVAR(hardcode_direct, $1)=yes
71316592 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
71326593 _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
71336594 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
7134 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
7135 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
7136 _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'
7137 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
7138 _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
6595 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
6596 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
6597 _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'
6598 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
6599 _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
71396600 fi
71406601 output_verbose_link_cmd=func_echo_all
71416602 else
71516612 # KCC will only create a shared library if the output file
71526613 # ends with ".so" (or ".sl" for HP-UX), so rename the library
71536614 # to its proper name (with version) after linking.
7154 _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'
7155
7156 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
6615 _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'
6616
6617 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
71576618 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
71586619
71596620 # Archives containing C++ object files must be created using
71716632 cxx*)
71726633 case $host in
71736634 osf3*)
7174 _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
7175 _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'
7176 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
6635 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
6636 _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'
6637 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
71776638 ;;
71786639 *)
71796640 _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
7180 _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'
6641 _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'
71816642 _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
7182 echo "-hidden">> $lib.exp~
7183 $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~
7184 $RM $lib.exp'
6643 echo "-hidden">> $lib.exp~
6644 $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~
6645 $RM $lib.exp'
71856646 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
71866647 ;;
71876648 esac
71966657 # explicitly linking system object files so we need to strip them
71976658 # from the output so that they don't get included in the library
71986659 # dependencies.
7199 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"'
6660 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"'
72006661 ;;
72016662 *)
7202 if test yes,no = "$GXX,$with_gnu_ld"; then
7203 _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
6663 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
6664 _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
72046665 case $host in
72056666 osf3*)
7206 _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'
6667 _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'
72076668 ;;
72086669 *)
7209 _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'
6670 _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'
72106671 ;;
72116672 esac
72126673
7213 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
6674 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
72146675 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
72156676
72166677 # Commands to make compiler produce verbose output that lists
72566717 # Sun C++ 4.2, 5.x and Centerline C++
72576718 _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
72586719 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
7259 _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
6720 _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
72606721 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
7261 $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'
6722 $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'
72626723
72636724 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
72646725 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
72666727 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
72676728 *)
72686729 # The compiler driver will combine and reorder linker options,
7269 # but understands '-z linker_flag'.
6730 # but understands `-z linker_flag'.
72706731 # Supported since Solaris 2.6 (maybe 2.5.1?)
72716732 _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
72726733 ;;
72836744 ;;
72846745 gcx*)
72856746 # Green Hills C++ Compiler
7286 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
6747 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
72876748
72886749 # The C++ compiler must be used to create the archive.
72896750 _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
72906751 ;;
72916752 *)
72926753 # GNU C++ compiler with Solaris linker
7293 if test yes,no = "$GXX,$with_gnu_ld"; then
7294 _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs'
6754 if test "$GXX" = yes && test "$with_gnu_ld" = no; then
6755 _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
72956756 if $CC --version | $GREP -v '^2\.7' > /dev/null; then
7296 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
6757 _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'
72976758 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
7298 $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
6759 $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
72996760
73006761 # Commands to make compiler produce verbose output that lists
73016762 # what "hidden" libraries, object files and flags are used when
73026763 # linking a shared library.
73036764 output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
73046765 else
7305 # g++ 2.7 appears to require '-G' NOT '-shared' on this
6766 # g++ 2.7 appears to require `-G' NOT `-shared' on this
73066767 # platform.
7307 _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
6768 _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
73086769 _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
7309 $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
6770 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
73106771
73116772 # Commands to make compiler produce verbose output that lists
73126773 # what "hidden" libraries, object files and flags are used when
73146775 output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
73156776 fi
73166777
7317 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'
6778 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
73186779 case $host_os in
73196780 solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
73206781 *)
7321 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
6782 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
73226783 ;;
73236784 esac
73246785 fi
73276788 ;;
73286789
73296790 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
7330 _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
6791 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
73316792 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
73326793 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
73336794 runpath_var='LD_RUN_PATH'
73346795
73356796 case $cc_basename in
73366797 CC*)
7337 _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
7338 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6798 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6799 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
73396800 ;;
73406801 *)
7341 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
7342 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6802 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6803 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
73436804 ;;
73446805 esac
73456806 ;;
73466807
73476808 sysv5* | sco3.2v5* | sco5v6*)
7348 # Note: We CANNOT use -z defs as we might desire, because we do not
6809 # Note: We can NOT use -z defs as we might desire, because we do not
73496810 # link with -lc, and that would cause any symbols used from libc to
73506811 # always be unresolved, which means just about no library would
73516812 # ever link correctly. If we're not using GNU ld we use -z text
73526813 # though, which does catch some bad symbols but isn't as heavy-handed
73536814 # as -z defs.
7354 _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
7355 _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
6815 _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
6816 _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
73566817 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
73576818 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
7358 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
6819 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
73596820 _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
73606821 _LT_TAGVAR(link_all_deplibs, $1)=yes
7361 _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
6822 _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
73626823 runpath_var='LD_RUN_PATH'
73636824
73646825 case $cc_basename in
73656826 CC*)
7366 _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
7367 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6827 _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6828 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
73686829 _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
7369 '"$_LT_TAGVAR(old_archive_cmds, $1)"
6830 '"$_LT_TAGVAR(old_archive_cmds, $1)"
73706831 _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
7371 '"$_LT_TAGVAR(reload_cmds, $1)"
6832 '"$_LT_TAGVAR(reload_cmds, $1)"
73726833 ;;
73736834 *)
7374 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
7375 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6835 _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
6836 _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
73766837 ;;
73776838 esac
73786839 ;;
74036864 esac
74046865
74056866 AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
7406 test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
7407
7408 _LT_TAGVAR(GCC, $1)=$GXX
7409 _LT_TAGVAR(LD, $1)=$LD
6867 test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
6868
6869 _LT_TAGVAR(GCC, $1)="$GXX"
6870 _LT_TAGVAR(LD, $1)="$LD"
74106871
74116872 ## CAVEAT EMPTOR:
74126873 ## There is no encapsulation within the following macros, do not change
74336894 lt_cv_path_LD=$lt_save_path_LD
74346895 lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
74356896 lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
7436 fi # test yes != "$_lt_caught_CXX_error"
6897 fi # test "$_lt_caught_CXX_error" != yes
74376898
74386899 AC_LANG_POP
74396900 ])# _LT_LANG_CXX_CONFIG
74556916 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
74566917 func_stripname_cnf ()
74576918 {
7458 case @S|@2 in
7459 .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;;
7460 *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;;
6919 case ${2} in
6920 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
6921 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
74616922 esac
74626923 } # func_stripname_cnf
74636924 ])# _LT_FUNC_STRIPNAME_CNF
7464
74656925
74666926 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
74676927 # ---------------------------------
75467006 pre_test_object_deps_done=no
75477007
75487008 for p in `eval "$output_verbose_link_cmd"`; do
7549 case $prev$p in
7009 case ${prev}${p} in
75507010
75517011 -L* | -R* | -l*)
75527012 # Some compilers place space between "-{L,R}" and the path.
75537013 # Remove the space.
7554 if test x-L = "$p" ||
7555 test x-R = "$p"; then
7014 if test $p = "-L" ||
7015 test $p = "-R"; then
75567016 prev=$p
75577017 continue
75587018 fi
75687028 case $p in
75697029 =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
75707030 esac
7571 if test no = "$pre_test_object_deps_done"; then
7572 case $prev in
7031 if test "$pre_test_object_deps_done" = no; then
7032 case ${prev} in
75737033 -L | -R)
75747034 # Internal compiler library paths should come after those
75757035 # provided the user. The postdeps already come after the
75767036 # user supplied libs so there is no need to process them.
75777037 if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
7578 _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p
7038 _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
75797039 else
7580 _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p"
7040 _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
75817041 fi
75827042 ;;
75837043 # The "-l" case would never come before the object being
75857045 esac
75867046 else
75877047 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
7588 _LT_TAGVAR(postdeps, $1)=$prev$p
7048 _LT_TAGVAR(postdeps, $1)="${prev}${p}"
75897049 else
7590 _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p"
7050 _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
75917051 fi
75927052 fi
75937053 prev=
76027062 continue
76037063 fi
76047064
7605 if test no = "$pre_test_object_deps_done"; then
7065 if test "$pre_test_object_deps_done" = no; then
76067066 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
7607 _LT_TAGVAR(predep_objects, $1)=$p
7067 _LT_TAGVAR(predep_objects, $1)="$p"
76087068 else
76097069 _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
76107070 fi
76117071 else
76127072 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
7613 _LT_TAGVAR(postdep_objects, $1)=$p
7073 _LT_TAGVAR(postdep_objects, $1)="$p"
76147074 else
76157075 _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
76167076 fi
76417101 _LT_TAGVAR(postdep_objects,$1)=
76427102 _LT_TAGVAR(postdeps,$1)=
76437103 ;;
7104
7105 linux*)
7106 case `$CC -V 2>&1 | sed 5q` in
7107 *Sun\ C*)
7108 # Sun C++ 5.9
7109
7110 # The more standards-conforming stlport4 library is
7111 # incompatible with the Cstd library. Avoid specifying
7112 # it if it's in CXXFLAGS. Ignore libCrun as
7113 # -library=stlport4 depends on it.
7114 case " $CXX $CXXFLAGS " in
7115 *" -library=stlport4 "*)
7116 solaris_use_stlport4=yes
7117 ;;
7118 esac
7119
7120 if test "$solaris_use_stlport4" != yes; then
7121 _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
7122 fi
7123 ;;
7124 esac
7125 ;;
7126
7127 solaris*)
7128 case $cc_basename in
7129 CC* | sunCC*)
7130 # The more standards-conforming stlport4 library is
7131 # incompatible with the Cstd library. Avoid specifying
7132 # it if it's in CXXFLAGS. Ignore libCrun as
7133 # -library=stlport4 depends on it.
7134 case " $CXX $CXXFLAGS " in
7135 *" -library=stlport4 "*)
7136 solaris_use_stlport4=yes
7137 ;;
7138 esac
7139
7140 # Adding this requires a known-good setup of shared libraries for
7141 # Sun compiler versions before 5.6, else PIC objects from an old
7142 # archive will be linked into the output, leading to subtle bugs.
7143 if test "$solaris_use_stlport4" != yes; then
7144 _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
7145 fi
7146 ;;
7147 esac
7148 ;;
76447149 esac
76457150 ])
76467151
76497154 esac
76507155 _LT_TAGVAR(compiler_lib_search_dirs, $1)=
76517156 if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
7652 _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'`
7157 _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
76537158 fi
76547159 _LT_TAGDECL([], [compiler_lib_search_dirs], [1],
76557160 [The directories searched by this compiler when creating a shared library])
76697174 # --------------------------
76707175 # Ensure that the configuration variables for a Fortran 77 compiler are
76717176 # suitably defined. These variables are subsequently used by _LT_CONFIG
7672 # to write the compiler configuration to 'libtool'.
7177 # to write the compiler configuration to `libtool'.
76737178 m4_defun([_LT_LANG_F77_CONFIG],
76747179 [AC_LANG_PUSH(Fortran 77)
7675 if test -z "$F77" || test no = "$F77"; then
7180 if test -z "$F77" || test "X$F77" = "Xno"; then
76767181 _lt_disable_F77=yes
76777182 fi
76787183
77097214 # the F77 compiler isn't working. Some variables (like enable_shared)
77107215 # are currently assumed to apply to all compilers on this platform,
77117216 # and will be corrupted by setting them based on a non-working compiler.
7712 if test yes != "$_lt_disable_F77"; then
7217 if test "$_lt_disable_F77" != yes; then
77137218 # Code to be used in simple compile tests
77147219 lt_simple_compile_test_code="\
77157220 subroutine t
77317236 _LT_LINKER_BOILERPLATE
77327237
77337238 # Allow CC to be a program name with arguments.
7734 lt_save_CC=$CC
7239 lt_save_CC="$CC"
77357240 lt_save_GCC=$GCC
77367241 lt_save_CFLAGS=$CFLAGS
77377242 CC=${F77-"f77"}
77457250 AC_MSG_RESULT([$can_build_shared])
77467251
77477252 AC_MSG_CHECKING([whether to build shared libraries])
7748 test no = "$can_build_shared" && enable_shared=no
7253 test "$can_build_shared" = "no" && enable_shared=no
77497254
77507255 # On AIX, shared libraries and static libraries use the same namespace, and
77517256 # are all built from PIC.
77527257 case $host_os in
77537258 aix3*)
7754 test yes = "$enable_shared" && enable_static=no
7259 test "$enable_shared" = yes && enable_static=no
77557260 if test -n "$RANLIB"; then
77567261 archive_cmds="$archive_cmds~\$RANLIB \$lib"
77577262 postinstall_cmds='$RANLIB $lib'
77587263 fi
77597264 ;;
77607265 aix[[4-9]]*)
7761 if test ia64 != "$host_cpu"; then
7762 case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
7763 yes,aix,yes) ;; # shared object as lib.so file only
7764 yes,svr4,*) ;; # shared object as lib.so archive member only
7765 yes,*) enable_static=no ;; # shared object in lib.a archive as well
7766 esac
7266 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
7267 test "$enable_shared" = yes && enable_static=no
77677268 fi
77687269 ;;
77697270 esac
77717272
77727273 AC_MSG_CHECKING([whether to build static libraries])
77737274 # Make sure either enable_shared or enable_static is yes.
7774 test yes = "$enable_shared" || enable_static=yes
7275 test "$enable_shared" = yes || enable_static=yes
77757276 AC_MSG_RESULT([$enable_static])
77767277
7777 _LT_TAGVAR(GCC, $1)=$G77
7778 _LT_TAGVAR(LD, $1)=$LD
7278 _LT_TAGVAR(GCC, $1)="$G77"
7279 _LT_TAGVAR(LD, $1)="$LD"
77797280
77807281 ## CAVEAT EMPTOR:
77817282 ## There is no encapsulation within the following macros, do not change
77927293 fi # test -n "$compiler"
77937294
77947295 GCC=$lt_save_GCC
7795 CC=$lt_save_CC
7796 CFLAGS=$lt_save_CFLAGS
7797 fi # test yes != "$_lt_disable_F77"
7296 CC="$lt_save_CC"
7297 CFLAGS="$lt_save_CFLAGS"
7298 fi # test "$_lt_disable_F77" != yes
77987299
77997300 AC_LANG_POP
78007301 ])# _LT_LANG_F77_CONFIG
78047305 # -------------------------
78057306 # Ensure that the configuration variables for a Fortran compiler are
78067307 # suitably defined. These variables are subsequently used by _LT_CONFIG
7807 # to write the compiler configuration to 'libtool'.
7308 # to write the compiler configuration to `libtool'.
78087309 m4_defun([_LT_LANG_FC_CONFIG],
78097310 [AC_LANG_PUSH(Fortran)
78107311
7811 if test -z "$FC" || test no = "$FC"; then
7312 if test -z "$FC" || test "X$FC" = "Xno"; then
78127313 _lt_disable_FC=yes
78137314 fi
78147315
78457346 # the FC compiler isn't working. Some variables (like enable_shared)
78467347 # are currently assumed to apply to all compilers on this platform,
78477348 # and will be corrupted by setting them based on a non-working compiler.
7848 if test yes != "$_lt_disable_FC"; then
7349 if test "$_lt_disable_FC" != yes; then
78497350 # Code to be used in simple compile tests
78507351 lt_simple_compile_test_code="\
78517352 subroutine t
78677368 _LT_LINKER_BOILERPLATE
78687369
78697370 # Allow CC to be a program name with arguments.
7870 lt_save_CC=$CC
7371 lt_save_CC="$CC"
78717372 lt_save_GCC=$GCC
78727373 lt_save_CFLAGS=$CFLAGS
78737374 CC=${FC-"f95"}
78837384 AC_MSG_RESULT([$can_build_shared])
78847385
78857386 AC_MSG_CHECKING([whether to build shared libraries])
7886 test no = "$can_build_shared" && enable_shared=no
7387 test "$can_build_shared" = "no" && enable_shared=no
78877388
78887389 # On AIX, shared libraries and static libraries use the same namespace, and
78897390 # are all built from PIC.
78907391 case $host_os in
78917392 aix3*)
7892 test yes = "$enable_shared" && enable_static=no
7393 test "$enable_shared" = yes && enable_static=no
78937394 if test -n "$RANLIB"; then
78947395 archive_cmds="$archive_cmds~\$RANLIB \$lib"
78957396 postinstall_cmds='$RANLIB $lib'
78967397 fi
78977398 ;;
78987399 aix[[4-9]]*)
7899 if test ia64 != "$host_cpu"; then
7900 case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
7901 yes,aix,yes) ;; # shared object as lib.so file only
7902 yes,svr4,*) ;; # shared object as lib.so archive member only
7903 yes,*) enable_static=no ;; # shared object in lib.a archive as well
7904 esac
7400 if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
7401 test "$enable_shared" = yes && enable_static=no
79057402 fi
79067403 ;;
79077404 esac
79097406
79107407 AC_MSG_CHECKING([whether to build static libraries])
79117408 # Make sure either enable_shared or enable_static is yes.
7912 test yes = "$enable_shared" || enable_static=yes
7409 test "$enable_shared" = yes || enable_static=yes
79137410 AC_MSG_RESULT([$enable_static])
79147411
7915 _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu
7916 _LT_TAGVAR(LD, $1)=$LD
7412 _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
7413 _LT_TAGVAR(LD, $1)="$LD"
79177414
79187415 ## CAVEAT EMPTOR:
79197416 ## There is no encapsulation within the following macros, do not change
79337430 GCC=$lt_save_GCC
79347431 CC=$lt_save_CC
79357432 CFLAGS=$lt_save_CFLAGS
7936 fi # test yes != "$_lt_disable_FC"
7433 fi # test "$_lt_disable_FC" != yes
79377434
79387435 AC_LANG_POP
79397436 ])# _LT_LANG_FC_CONFIG
79437440 # --------------------------
79447441 # Ensure that the configuration variables for the GNU Java Compiler compiler
79457442 # are suitably defined. These variables are subsequently used by _LT_CONFIG
7946 # to write the compiler configuration to 'libtool'.
7443 # to write the compiler configuration to `libtool'.
79477444 m4_defun([_LT_LANG_GCJ_CONFIG],
79487445 [AC_REQUIRE([LT_PROG_GCJ])dnl
79497446 AC_LANG_SAVE
79777474 CFLAGS=$GCJFLAGS
79787475 compiler=$CC
79797476 _LT_TAGVAR(compiler, $1)=$CC
7980 _LT_TAGVAR(LD, $1)=$LD
7477 _LT_TAGVAR(LD, $1)="$LD"
79817478 _LT_CC_BASENAME([$compiler])
79827479
79837480 # GCJ did not exist at the time GCC didn't implicitly link libc in.
80147511 # --------------------------
80157512 # Ensure that the configuration variables for the GNU Go compiler
80167513 # are suitably defined. These variables are subsequently used by _LT_CONFIG
8017 # to write the compiler configuration to 'libtool'.
7514 # to write the compiler configuration to `libtool'.
80187515 m4_defun([_LT_LANG_GO_CONFIG],
80197516 [AC_REQUIRE([LT_PROG_GO])dnl
80207517 AC_LANG_SAVE
80487545 CFLAGS=$GOFLAGS
80497546 compiler=$CC
80507547 _LT_TAGVAR(compiler, $1)=$CC
8051 _LT_TAGVAR(LD, $1)=$LD
7548 _LT_TAGVAR(LD, $1)="$LD"
80527549 _LT_CC_BASENAME([$compiler])
80537550
80547551 # Go did not exist at the time GCC didn't implicitly link libc in.
80857582 # -------------------------
80867583 # Ensure that the configuration variables for the Windows resource compiler
80877584 # are suitably defined. These variables are subsequently used by _LT_CONFIG
8088 # to write the compiler configuration to 'libtool'.
7585 # to write the compiler configuration to `libtool'.
80897586 m4_defun([_LT_LANG_RC_CONFIG],
80907587 [AC_REQUIRE([LT_PROG_RC])dnl
80917588 AC_LANG_SAVE
81017598 lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
81027599
81037600 # Code to be used in simple link tests
8104 lt_simple_link_test_code=$lt_simple_compile_test_code
7601 lt_simple_link_test_code="$lt_simple_compile_test_code"
81057602
81067603 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
81077604 _LT_TAG_COMPILER
81117608 _LT_LINKER_BOILERPLATE
81127609
81137610 # Allow CC to be a program name with arguments.
8114 lt_save_CC=$CC
7611 lt_save_CC="$CC"
81157612 lt_save_CFLAGS=$CFLAGS
81167613 lt_save_GCC=$GCC
81177614 GCC=
81407637 [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
81417638 [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
81427639 [AC_CHECK_TOOL(GCJ, gcj,)
8143 test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2"
7640 test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
81447641 AC_SUBST(GCJFLAGS)])])[]dnl
81457642 ])
81467643
82517748 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
82527749 # along with /bin/sed that truncates output.
82537750 for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
8254 test ! -f "$lt_ac_sed" && continue
7751 test ! -f $lt_ac_sed && continue
82557752 cat /dev/null > conftest.in
82567753 lt_ac_count=0
82577754 echo $ECHO_N "0123456789$ECHO_C" >conftest.in
82687765 $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
82697766 cmp -s conftest.out conftest.nl || break
82707767 # 10000 chars as input seems more than enough
8271 test 10 -lt "$lt_ac_count" && break
7768 test $lt_ac_count -gt 10 && break
82727769 lt_ac_count=`expr $lt_ac_count + 1`
8273 if test "$lt_ac_count" -gt "$lt_ac_max"; then
7770 if test $lt_ac_count -gt $lt_ac_max; then
82747771 lt_ac_max=$lt_ac_count
82757772 lt_cv_path_SED=$lt_ac_sed
82767773 fi
82947791 # Find out whether the shell is Bourne or XSI compatible,
82957792 # or has some other useful features.
82967793 m4_defun([_LT_CHECK_SHELL_FEATURES],
8297 [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
7794 [AC_MSG_CHECKING([whether the shell understands some XSI constructs])
7795 # Try some XSI features
7796 xsi_shell=no
7797 ( _lt_dummy="a/b/c"
7798 test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
7799 = c,a/b,b/c, \
7800 && eval 'test $(( 1 + 1 )) -eq 2 \
7801 && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
7802 && xsi_shell=yes
7803 AC_MSG_RESULT([$xsi_shell])
7804 _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
7805
7806 AC_MSG_CHECKING([whether the shell understands "+="])
7807 lt_shell_append=no
7808 ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
7809 >/dev/null 2>&1 \
7810 && lt_shell_append=yes
7811 AC_MSG_RESULT([$lt_shell_append])
7812 _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
7813
7814 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
82987815 lt_unset=unset
82997816 else
83007817 lt_unset=false
83187835 ])# _LT_CHECK_SHELL_FEATURES
83197836
83207837
7838 # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
7839 # ------------------------------------------------------
7840 # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
7841 # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
7842 m4_defun([_LT_PROG_FUNCTION_REPLACE],
7843 [dnl {
7844 sed -e '/^$1 ()$/,/^} # $1 /c\
7845 $1 ()\
7846 {\
7847 m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
7848 } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
7849 && mv -f "$cfgfile.tmp" "$cfgfile" \
7850 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
7851 test 0 -eq $? || _lt_function_replace_fail=:
7852 ])
7853
7854
7855 # _LT_PROG_REPLACE_SHELLFNS
7856 # -------------------------
7857 # Replace existing portable implementations of several shell functions with
7858 # equivalent extended shell implementations where those features are available..
7859 m4_defun([_LT_PROG_REPLACE_SHELLFNS],
7860 [if test x"$xsi_shell" = xyes; then
7861 _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
7862 case ${1} in
7863 */*) func_dirname_result="${1%/*}${2}" ;;
7864 * ) func_dirname_result="${3}" ;;
7865 esac])
7866
7867 _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
7868 func_basename_result="${1##*/}"])
7869
7870 _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
7871 case ${1} in
7872 */*) func_dirname_result="${1%/*}${2}" ;;
7873 * ) func_dirname_result="${3}" ;;
7874 esac
7875 func_basename_result="${1##*/}"])
7876
7877 _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
7878 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
7879 # positional parameters, so assign one to ordinary parameter first.
7880 func_stripname_result=${3}
7881 func_stripname_result=${func_stripname_result#"${1}"}
7882 func_stripname_result=${func_stripname_result%"${2}"}])
7883
7884 _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
7885 func_split_long_opt_name=${1%%=*}
7886 func_split_long_opt_arg=${1#*=}])
7887
7888 _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
7889 func_split_short_opt_arg=${1#??}
7890 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
7891
7892 _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
7893 case ${1} in
7894 *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
7895 *) func_lo2o_result=${1} ;;
7896 esac])
7897
7898 _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
7899
7900 _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
7901
7902 _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
7903 fi
7904
7905 if test x"$lt_shell_append" = xyes; then
7906 _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
7907
7908 _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
7909 func_quote_for_eval "${2}"
7910 dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
7911 eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
7912
7913 # Save a `func_append' function call where possible by direct use of '+='
7914 sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
7915 && mv -f "$cfgfile.tmp" "$cfgfile" \
7916 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
7917 test 0 -eq $? || _lt_function_replace_fail=:
7918 else
7919 # Save a `func_append' function call even when '+=' is not available
7920 sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
7921 && mv -f "$cfgfile.tmp" "$cfgfile" \
7922 || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
7923 test 0 -eq $? || _lt_function_replace_fail=:
7924 fi
7925
7926 if test x"$_lt_function_replace_fail" = x":"; then
7927 AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
7928 fi
7929 ])
7930
83217931 # _LT_PATH_CONVERSION_FUNCTIONS
83227932 # -----------------------------
8323 # Determine what file name conversion functions should be used by
7933 # Determine which file name conversion functions should be used by
83247934 # func_to_host_file (and, implicitly, by func_to_host_path). These are needed
83257935 # for certain cross-compile configurations and native mingw.
83267936 m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
00 # Helper functions for option handling. -*- Autoconf -*-
11 #
2 # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
3 # Foundation, Inc.
2 # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
3 # Inc.
44 # Written by Gary V. Vaughan, 2004
55 #
66 # This file is free software; the Free Software Foundation gives
77 # unlimited permission to copy and/or distribute it, with or without
88 # modifications, as long as this notice is preserved.
99
10 # serial 8 ltoptions.m4
10 # serial 7 ltoptions.m4
1111
1212 # This is to help aclocal find these macros, as it can't see m4_define.
1313 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
2828 [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
2929 m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
3030 _LT_MANGLE_DEFUN([$1], [$2]),
31 [m4_warning([Unknown $1 option '$2'])])[]dnl
31 [m4_warning([Unknown $1 option `$2'])])[]dnl
3232 ])
3333
3434
7474 dnl
7575 dnl If no reference was made to various pairs of opposing options, then
7676 dnl we run the default mode handler for the pair. For example, if neither
77 dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
77 dnl `shared' nor `disable-shared' was passed, we enable building of shared
7878 dnl archives by default:
7979 _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
8080 _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
8181 _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
8282 _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
83 [_LT_ENABLE_FAST_INSTALL])
84 _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
85 [_LT_WITH_AIX_SONAME([aix])])
83 [_LT_ENABLE_FAST_INSTALL])
8684 ])
8785 ])# _LT_SET_OPTIONS
8886
113111 [_LT_SET_OPTION([LT_INIT], [dlopen])
114112 AC_DIAGNOSE([obsolete],
115113 [$0: Remove this warning and the call to _LT_SET_OPTION when you
116 put the 'dlopen' option into LT_INIT's first parameter.])
114 put the `dlopen' option into LT_INIT's first parameter.])
117115 ])
118116
119117 dnl aclocal-1.4 backwards compatibility:
149147 _LT_SET_OPTION([LT_INIT], [win32-dll])
150148 AC_DIAGNOSE([obsolete],
151149 [$0: Remove this warning and the call to _LT_SET_OPTION when you
152 put the 'win32-dll' option into LT_INIT's first parameter.])
150 put the `win32-dll' option into LT_INIT's first parameter.])
153151 ])
154152
155153 dnl aclocal-1.4 backwards compatibility:
158156
159157 # _LT_ENABLE_SHARED([DEFAULT])
160158 # ----------------------------
161 # implement the --enable-shared flag, and supports the 'shared' and
162 # 'disable-shared' LT_INIT options.
163 # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
159 # implement the --enable-shared flag, and supports the `shared' and
160 # `disable-shared' LT_INIT options.
161 # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
164162 m4_define([_LT_ENABLE_SHARED],
165163 [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
166164 AC_ARG_ENABLE([shared],
173171 *)
174172 enable_shared=no
175173 # Look at the argument we got. We use all the common list separators.
176 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
174 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
177175 for pkg in $enableval; do
178 IFS=$lt_save_ifs
176 IFS="$lt_save_ifs"
179177 if test "X$pkg" = "X$p"; then
180178 enable_shared=yes
181179 fi
182180 done
183 IFS=$lt_save_ifs
181 IFS="$lt_save_ifs"
184182 ;;
185183 esac],
186184 [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
212210
213211 # _LT_ENABLE_STATIC([DEFAULT])
214212 # ----------------------------
215 # implement the --enable-static flag, and support the 'static' and
216 # 'disable-static' LT_INIT options.
217 # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
213 # implement the --enable-static flag, and support the `static' and
214 # `disable-static' LT_INIT options.
215 # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
218216 m4_define([_LT_ENABLE_STATIC],
219217 [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
220218 AC_ARG_ENABLE([static],
227225 *)
228226 enable_static=no
229227 # Look at the argument we got. We use all the common list separators.
230 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
228 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
231229 for pkg in $enableval; do
232 IFS=$lt_save_ifs
230 IFS="$lt_save_ifs"
233231 if test "X$pkg" = "X$p"; then
234232 enable_static=yes
235233 fi
236234 done
237 IFS=$lt_save_ifs
235 IFS="$lt_save_ifs"
238236 ;;
239237 esac],
240238 [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
266264
267265 # _LT_ENABLE_FAST_INSTALL([DEFAULT])
268266 # ----------------------------------
269 # implement the --enable-fast-install flag, and support the 'fast-install'
270 # and 'disable-fast-install' LT_INIT options.
271 # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
267 # implement the --enable-fast-install flag, and support the `fast-install'
268 # and `disable-fast-install' LT_INIT options.
269 # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
272270 m4_define([_LT_ENABLE_FAST_INSTALL],
273271 [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
274272 AC_ARG_ENABLE([fast-install],
281279 *)
282280 enable_fast_install=no
283281 # Look at the argument we got. We use all the common list separators.
284 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
282 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
285283 for pkg in $enableval; do
286 IFS=$lt_save_ifs
284 IFS="$lt_save_ifs"
287285 if test "X$pkg" = "X$p"; then
288286 enable_fast_install=yes
289287 fi
290288 done
291 IFS=$lt_save_ifs
289 IFS="$lt_save_ifs"
292290 ;;
293291 esac],
294292 [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
305303 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
306304 AC_DIAGNOSE([obsolete],
307305 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
308 the 'fast-install' option into LT_INIT's first parameter.])
306 the `fast-install' option into LT_INIT's first parameter.])
309307 ])
310308
311309 AU_DEFUN([AC_DISABLE_FAST_INSTALL],
312310 [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
313311 AC_DIAGNOSE([obsolete],
314312 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
315 the 'disable-fast-install' option into LT_INIT's first parameter.])
313 the `disable-fast-install' option into LT_INIT's first parameter.])
316314 ])
317315
318316 dnl aclocal-1.4 backwards compatibility:
320318 dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
321319
322320
323 # _LT_WITH_AIX_SONAME([DEFAULT])
324 # ----------------------------------
325 # implement the --with-aix-soname flag, and support the `aix-soname=aix'
326 # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
327 # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
328 m4_define([_LT_WITH_AIX_SONAME],
329 [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
330 shared_archive_member_spec=
331 case $host,$enable_shared in
332 power*-*-aix[[5-9]]*,yes)
333 AC_MSG_CHECKING([which variant of shared library versioning to provide])
334 AC_ARG_WITH([aix-soname],
335 [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
336 [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
337 [case $withval in
338 aix|svr4|both)
339 ;;
340 *)
341 AC_MSG_ERROR([Unknown argument to --with-aix-soname])
342 ;;
343 esac
344 lt_cv_with_aix_soname=$with_aix_soname],
345 [AC_CACHE_VAL([lt_cv_with_aix_soname],
346 [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
347 with_aix_soname=$lt_cv_with_aix_soname])
348 AC_MSG_RESULT([$with_aix_soname])
349 if test aix != "$with_aix_soname"; then
350 # For the AIX way of multilib, we name the shared archive member
351 # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
352 # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
353 # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
354 # the AIX toolchain works better with OBJECT_MODE set (default 32).
355 if test 64 = "${OBJECT_MODE-32}"; then
356 shared_archive_member_spec=shr_64
357 else
358 shared_archive_member_spec=shr
359 fi
360 fi
361 ;;
362 *)
363 with_aix_soname=aix
364 ;;
365 esac
366
367 _LT_DECL([], [shared_archive_member_spec], [0],
368 [Shared archive member basename, for filename based shared library versioning on AIX])dnl
369 ])# _LT_WITH_AIX_SONAME
370
371 LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
372 LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
373 LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
374
375
376321 # _LT_WITH_PIC([MODE])
377322 # --------------------
378 # implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
323 # implement the --with-pic flag, and support the `pic-only' and `no-pic'
379324 # LT_INIT options.
380 # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
325 # MODE is either `yes' or `no'. If omitted, it defaults to `both'.
381326 m4_define([_LT_WITH_PIC],
382327 [AC_ARG_WITH([pic],
383328 [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
388333 *)
389334 pic_mode=default
390335 # Look at the argument we got. We use all the common list separators.
391 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
336 lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
392337 for lt_pkg in $withval; do
393 IFS=$lt_save_ifs
338 IFS="$lt_save_ifs"
394339 if test "X$lt_pkg" = "X$lt_p"; then
395340 pic_mode=yes
396341 fi
397342 done
398 IFS=$lt_save_ifs
343 IFS="$lt_save_ifs"
399344 ;;
400345 esac],
401 [pic_mode=m4_default([$1], [default])])
346 [pic_mode=default])
347
348 test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
402349
403350 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
404351 ])# _LT_WITH_PIC
411358 [_LT_SET_OPTION([LT_INIT], [pic-only])
412359 AC_DIAGNOSE([obsolete],
413360 [$0: Remove this warning and the call to _LT_SET_OPTION when you
414 put the 'pic-only' option into LT_INIT's first parameter.])
361 put the `pic-only' option into LT_INIT's first parameter.])
415362 ])
416363
417364 dnl aclocal-1.4 backwards compatibility:
00 # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
11 #
2 # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
3 # Foundation, Inc.
2 # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
43 # Written by Gary V. Vaughan, 2004
54 #
65 # This file is free software; the Free Software Foundation gives
3332 # ------------
3433 # Manipulate m4 lists.
3534 # These macros are necessary as long as will still need to support
36 # Autoconf-2.59, which quotes differently.
35 # Autoconf-2.59 which quotes differently.
3736 m4_define([lt_car], [[$1]])
3837 m4_define([lt_cdr],
3938 [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
4443
4544 # lt_append(MACRO-NAME, STRING, [SEPARATOR])
4645 # ------------------------------------------
47 # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
46 # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
4847 # Note that neither SEPARATOR nor STRING are expanded; they are appended
4948 # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
5049 # No SEPARATOR is output if MACRO-NAME was previously undefined (different
00 # ltversion.m4 -- version numbers -*- Autoconf -*-
11 #
2 # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
2 # Copyright (C) 2004 Free Software Foundation, Inc.
33 # Written by Scott James Remnant, 2004
44 #
55 # This file is free software; the Free Software Foundation gives
88
99 # @configure_input@
1010
11 # serial 4179 ltversion.m4
11 # serial 3337 ltversion.m4
1212 # This file is part of GNU Libtool
1313
14 m4_define([LT_PACKAGE_VERSION], [2.4.6])
15 m4_define([LT_PACKAGE_REVISION], [2.4.6])
14 m4_define([LT_PACKAGE_VERSION], [2.4.2])
15 m4_define([LT_PACKAGE_REVISION], [1.3337])
1616
1717 AC_DEFUN([LTVERSION_VERSION],
18 [macro_version='2.4.6'
19 macro_revision='2.4.6'
18 [macro_version='2.4.2'
19 macro_revision='1.3337'
2020 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
2121 _LT_DECL(, macro_revision, 0)
2222 ])
00 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
11 #
2 # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
3 # Foundation, Inc.
2 # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
43 # Written by Scott James Remnant, 2004.
54 #
65 # This file is free software; the Free Software Foundation gives
1110
1211 # These exist entirely to fool aclocal when bootstrapping libtool.
1312 #
14 # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
13 # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
1514 # which have later been changed to m4_define as they aren't part of the
1615 # exported API, or moved to Autoconf or Automake where they belong.
1716 #
2524 # included after everything else. This provides aclocal with the
2625 # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
2726 # because those macros already exist, or will be overwritten later.
28 # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
27 # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
2928 #
3029 # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
3130 # Yes, that means every name once taken will need to remain here until
22
33 scriptversion=2013-10-28.13; # UTC
44
5 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
5 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
66 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
77
88 # This program is free software; you can redistribute it and/or modify
0 # Makefile.in generated by automake 1.15.1 from Makefile.am.
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2017 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
1313
1414 @SET_MAKE@
1515 VPATH = @srcdir@
16 am__is_gnu_make = { \
17 if test -z '$(MAKELEVEL)'; then \
18 false; \
19 elif test -n '$(MAKE_HOST)'; then \
20 true; \
21 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
22 true; \
23 else \
24 false; \
25 fi; \
26 }
16 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
2717 am__make_running_with_option = \
2818 case $${target_option-} in \
2919 ?) ;; \
8878 host_triplet = @host@
8979 target_triplet = @target@
9080 subdir = scripts
81 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
9182 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
92 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
83 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
84 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
9385 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
9486 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
9587 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
9688 $(top_srcdir)/configure.ac
9789 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
9890 $(ACLOCAL_M4)
99 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
10091 mkinstalldirs = $(install_sh) -d
10192 CONFIG_HEADER = $(top_builddir)/config.h
10293 CONFIG_CLEAN_FILES =
122113 esac
123114 am__extra_recursive_targets = format-recursive test-recursive
124115 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
125 am__DIST_COMMON = $(srcdir)/Makefile.in
126116 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
127117 ACLOCAL = @ACLOCAL@
128118 AMTAR = @AMTAR@
159149 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
160150 EXEEXT = @EXEEXT@
161151 FGREP = @FGREP@
152 FUZZING_ENGINE = @FUZZING_ENGINE@
162153 GO = @GO@
163154 GREP = @GREP@
164155 HAVE_CXX11 = @HAVE_CXX11@
180171 LIPO = @LIPO@
181172 LN_S = @LN_S@
182173 LTLIBOBJS = @LTLIBOBJS@
183 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
184174 MAKEINFO = @MAKEINFO@
185175 MANIFEST_TOOL = @MANIFEST_TOOL@
186176 MKDIR_P = @MKDIR_P@
208198 SHELL = @SHELL@
209199 STRIP = @STRIP@
210200 VERSION = @VERSION@
201 WITH_EXAMPLES = @WITH_EXAMPLES@
211202 abs_builddir = @abs_builddir@
212203 abs_srcdir = @abs_srcdir@
213204 abs_top_builddir = @abs_top_builddir@
267258 prefix = @prefix@
268259 program_transform_name = @program_transform_name@
269260 psdir = @psdir@
270 runstatedir = @runstatedir@
271261 sbindir = @sbindir@
272262 sharedstatedir = @sharedstatedir@
273263 srcdir = @srcdir@
312302 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \
313303 $(am__cd) $(top_srcdir) && \
314304 $(AUTOMAKE) --foreign scripts/Makefile
305 .PRECIOUS: Makefile
315306 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
316307 @case '$?' in \
317308 *config.status*) \
497488 mostlyclean-libtool pdf pdf-am ps ps-am tags-am test-am \
498489 test-local uninstall uninstall-am
499490
500 .PRECIOUS: Makefile
501
502491
503492 # Tell versions [3.59,3.63) of GNU make to not export all variables.
504493 # Otherwise a system limit (for SysV at least) may be exceeded.
3939 if [ ! -z "$FUZZER" ]; then
4040 export CC="$BUILD_ROOT/clang/bin/clang"
4141 export CXX="$BUILD_ROOT/clang/bin/clang++"
42 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-libfuzzer"
42 FUZZER_FLAGS="-fsanitize=fuzzer-no-link,address,shift,integer -fno-sanitize-recover=shift,integer"
43 export CFLAGS="$CFLAGS $FUZZER_FLAGS"
44 export CXXFLAGS="$CXXFLAGS $FUZZER_FLAGS"
45 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-libfuzzer=-fsanitize=fuzzer"
4346 fi
4447 else
4548 # Make sure the correct compiler will be used.
9191 [ -s "example-1.png" ] || exit 1
9292 echo "Checking second generated file ..."
9393 [ -s "example-2.png" ] || exit 1
94 if [ ! -z "$WITH_X265" ]; then
95 echo "Converting single JPEG file to heif ..."
96 ${BIN_WRAPPER} ./examples/heif-enc${BIN_SUFFIX} -o output-single.heic -v -v -v --thumb 320x240 example-1.jpg
97 echo "Checking generated file ..."
98 [ -s "output-single.heic" ] || exit 1
99 echo "Converting back generated heif to JPEG ..."
100 ${BIN_WRAPPER} ./examples/heif-convert${BIN_SUFFIX} output-single.heic output-single.jpg
101 echo "Checking generated file ..."
102 [ -s "output-single.jpg" ] || exit 1
103 echo "Converting multiple JPEG files to heif ..."
104 ${BIN_WRAPPER} ./examples/heif-enc${BIN_SUFFIX} -o output-multi.heic -v -v -v --thumb 320x240 example-1.jpg example-2.jpg
105 echo "Checking generated file ..."
106 [ -s "output-multi.heic" ] || exit 1
107 ${BIN_WRAPPER} ./examples/heif-convert${BIN_SUFFIX} output-multi.heic output-multi.jpg
108 echo "Checking first generated file ..."
109 [ -s "output-multi-1.jpg" ] || exit 1
110 echo "Checking second generated file ..."
111 [ -s "output-multi-2.jpg" ] || exit 1
112 fi
94113 fi
95114 if [ ! -z "$GO" ]; then
96115 echo "Installing library ..."
0
1 if HAVE_TESTS
2 noinst_PROGRAMS = \
3 heif-unit-tests
4
5 heif_unit_tests_DEPENDENCIES = ../libheif/libheif.la
6 heif_unit_tests_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)/.
7 heif_unit_tests_LDFLAGS =
8 heif_unit_tests_LDADD = ../libheif/libheif.la
9 heif_unit_tests_SOURCES = main.cc encode.cc catch.hpp conversion.cc
10 endif
0 # Makefile.in generated by automake 1.14.1 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994-2013 Free Software Foundation, Inc.
4
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 @SET_MAKE@
15
16 VPATH = @srcdir@
17 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
18 am__make_running_with_option = \
19 case $${target_option-} in \
20 ?) ;; \
21 *) echo "am__make_running_with_option: internal error: invalid" \
22 "target option '$${target_option-}' specified" >&2; \
23 exit 1;; \
24 esac; \
25 has_opt=no; \
26 sane_makeflags=$$MAKEFLAGS; \
27 if $(am__is_gnu_make); then \
28 sane_makeflags=$$MFLAGS; \
29 else \
30 case $$MAKEFLAGS in \
31 *\\[\ \ ]*) \
32 bs=\\; \
33 sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
34 | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
35 esac; \
36 fi; \
37 skip_next=no; \
38 strip_trailopt () \
39 { \
40 flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
41 }; \
42 for flg in $$sane_makeflags; do \
43 test $$skip_next = yes && { skip_next=no; continue; }; \
44 case $$flg in \
45 *=*|--*) continue;; \
46 -*I) strip_trailopt 'I'; skip_next=yes;; \
47 -*I?*) strip_trailopt 'I';; \
48 -*O) strip_trailopt 'O'; skip_next=yes;; \
49 -*O?*) strip_trailopt 'O';; \
50 -*l) strip_trailopt 'l'; skip_next=yes;; \
51 -*l?*) strip_trailopt 'l';; \
52 -[dEDm]) skip_next=yes;; \
53 -[JT]) skip_next=yes;; \
54 esac; \
55 case $$flg in \
56 *$$target_option*) has_opt=yes; break;; \
57 esac; \
58 done; \
59 test $$has_opt = yes
60 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
61 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
62 pkgdatadir = $(datadir)/@PACKAGE@
63 pkgincludedir = $(includedir)/@PACKAGE@
64 pkglibdir = $(libdir)/@PACKAGE@
65 pkglibexecdir = $(libexecdir)/@PACKAGE@
66 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
67 install_sh_DATA = $(install_sh) -c -m 644
68 install_sh_PROGRAM = $(install_sh) -c
69 install_sh_SCRIPT = $(install_sh) -c
70 INSTALL_HEADER = $(INSTALL_DATA)
71 transform = $(program_transform_name)
72 NORMAL_INSTALL = :
73 PRE_INSTALL = :
74 POST_INSTALL = :
75 NORMAL_UNINSTALL = :
76 PRE_UNINSTALL = :
77 POST_UNINSTALL = :
78 build_triplet = @build@
79 host_triplet = @host@
80 target_triplet = @target@
81 @HAVE_TESTS_TRUE@noinst_PROGRAMS = heif-unit-tests$(EXEEXT)
82 subdir = tests
83 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
84 $(top_srcdir)/depcomp
85 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
86 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c_cxx_compile_flags.m4 \
87 $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
88 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
89 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
90 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/visibility.m4 \
91 $(top_srcdir)/configure.ac
92 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
93 $(ACLOCAL_M4)
94 mkinstalldirs = $(install_sh) -d
95 CONFIG_HEADER = $(top_builddir)/config.h
96 CONFIG_CLEAN_FILES =
97 CONFIG_CLEAN_VPATH_FILES =
98 PROGRAMS = $(noinst_PROGRAMS)
99 am__heif_unit_tests_SOURCES_DIST = main.cc encode.cc catch.hpp \
100 conversion.cc
101 @HAVE_TESTS_TRUE@am_heif_unit_tests_OBJECTS = \
102 @HAVE_TESTS_TRUE@ heif_unit_tests-main.$(OBJEXT) \
103 @HAVE_TESTS_TRUE@ heif_unit_tests-encode.$(OBJEXT) \
104 @HAVE_TESTS_TRUE@ heif_unit_tests-conversion.$(OBJEXT)
105 heif_unit_tests_OBJECTS = $(am_heif_unit_tests_OBJECTS)
106 AM_V_lt = $(am__v_lt_@AM_V@)
107 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
108 am__v_lt_0 = --silent
109 am__v_lt_1 =
110 heif_unit_tests_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
111 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
112 $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) \
113 $(heif_unit_tests_LDFLAGS) $(LDFLAGS) -o $@
114 AM_V_P = $(am__v_P_@AM_V@)
115 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
116 am__v_P_0 = false
117 am__v_P_1 = :
118 AM_V_GEN = $(am__v_GEN_@AM_V@)
119 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
120 am__v_GEN_0 = @echo " GEN " $@;
121 am__v_GEN_1 =
122 AM_V_at = $(am__v_at_@AM_V@)
123 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
124 am__v_at_0 = @
125 am__v_at_1 =
126 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
127 depcomp = $(SHELL) $(top_srcdir)/depcomp
128 am__depfiles_maybe = depfiles
129 am__mv = mv -f
130 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
131 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
132 LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
133 $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
134 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
135 $(AM_CXXFLAGS) $(CXXFLAGS)
136 AM_V_CXX = $(am__v_CXX_@AM_V@)
137 am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
138 am__v_CXX_0 = @echo " CXX " $@;
139 am__v_CXX_1 =
140 CXXLD = $(CXX)
141 CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
142 $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
143 $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
144 AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
145 am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
146 am__v_CXXLD_0 = @echo " CXXLD " $@;
147 am__v_CXXLD_1 =
148 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
149 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
150 LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
151 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
152 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
153 $(AM_CFLAGS) $(CFLAGS)
154 AM_V_CC = $(am__v_CC_@AM_V@)
155 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
156 am__v_CC_0 = @echo " CC " $@;
157 am__v_CC_1 =
158 CCLD = $(CC)
159 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
160 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
161 $(AM_LDFLAGS) $(LDFLAGS) -o $@
162 AM_V_CCLD = $(am__v_CCLD_@AM_V@)
163 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
164 am__v_CCLD_0 = @echo " CCLD " $@;
165 am__v_CCLD_1 =
166 SOURCES = $(heif_unit_tests_SOURCES)
167 DIST_SOURCES = $(am__heif_unit_tests_SOURCES_DIST)
168 am__can_run_installinfo = \
169 case $$AM_UPDATE_INFO_DIR in \
170 n|no|NO) false;; \
171 *) (install-info --version) >/dev/null 2>&1;; \
172 esac
173 am__extra_recursive_targets = format-recursive test-recursive
174 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
175 # Read a list of newline-separated strings from the standard input,
176 # and print each of them once, without duplicates. Input order is
177 # *not* preserved.
178 am__uniquify_input = $(AWK) '\
179 BEGIN { nonempty = 0; } \
180 { items[$$0] = 1; nonempty = 1; } \
181 END { if (nonempty) { for (i in items) print i; }; } \
182 '
183 # Make sure the list of sources is unique. This is necessary because,
184 # e.g., the same source file might be shared among _SOURCES variables
185 # for different programs/libraries.
186 am__define_uniq_tagged_files = \
187 list='$(am__tagged_files)'; \
188 unique=`for i in $$list; do \
189 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
190 done | $(am__uniquify_input)`
191 ETAGS = etags
192 CTAGS = ctags
193 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
194 ACLOCAL = @ACLOCAL@
195 AMTAR = @AMTAR@
196 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
197 AR = @AR@
198 AUTOCONF = @AUTOCONF@
199 AUTOHEADER = @AUTOHEADER@
200 AUTOMAKE = @AUTOMAKE@
201 AWK = @AWK@
202 CC = @CC@
203 CCAS = @CCAS@
204 CCASDEPMODE = @CCASDEPMODE@
205 CCASFLAGS = @CCASFLAGS@
206 CCDEPMODE = @CCDEPMODE@
207 CFLAGS = @CFLAGS@
208 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
209 CPP = @CPP@
210 CPPFLAGS = @CPPFLAGS@
211 CXX = @CXX@
212 CXXCPP = @CXXCPP@
213 CXXDEPMODE = @CXXDEPMODE@
214 CXXFLAGS = @CXXFLAGS@
215 CYGPATH_W = @CYGPATH_W@
216 DEFS = @DEFS@
217 DEPDIR = @DEPDIR@
218 DLLTOOL = @DLLTOOL@
219 DSYMUTIL = @DSYMUTIL@
220 DUMPBIN = @DUMPBIN@
221 ECHO_C = @ECHO_C@
222 ECHO_N = @ECHO_N@
223 ECHO_T = @ECHO_T@
224 EGREP = @EGREP@
225 ENABLE_LIBFUZZER = @ENABLE_LIBFUZZER@
226 ENABLE_PARALLEL_TILE_DECODING = @ENABLE_PARALLEL_TILE_DECODING@
227 EXEEXT = @EXEEXT@
228 FGREP = @FGREP@
229 FUZZING_ENGINE = @FUZZING_ENGINE@
230 GO = @GO@
231 GREP = @GREP@
232 HAVE_CXX11 = @HAVE_CXX11@
233 HAVE_GO = @HAVE_GO@
234 HAVE_VISIBILITY = @HAVE_VISIBILITY@
235 INSTALL = @INSTALL@
236 INSTALL_DATA = @INSTALL_DATA@
237 INSTALL_PROGRAM = @INSTALL_PROGRAM@
238 INSTALL_SCRIPT = @INSTALL_SCRIPT@
239 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
240 LD = @LD@
241 LDFLAGS = @LDFLAGS@
242 LIBHEIF_AGE = @LIBHEIF_AGE@
243 LIBHEIF_CURRENT = @LIBHEIF_CURRENT@
244 LIBHEIF_REVISION = @LIBHEIF_REVISION@
245 LIBOBJS = @LIBOBJS@
246 LIBS = @LIBS@
247 LIBTOOL = @LIBTOOL@
248 LIPO = @LIPO@
249 LN_S = @LN_S@
250 LTLIBOBJS = @LTLIBOBJS@
251 MAKEINFO = @MAKEINFO@
252 MANIFEST_TOOL = @MANIFEST_TOOL@
253 MKDIR_P = @MKDIR_P@
254 NM = @NM@
255 NMEDIT = @NMEDIT@
256 NUMERIC_VERSION = @NUMERIC_VERSION@
257 OBJDUMP = @OBJDUMP@
258 OBJEXT = @OBJEXT@
259 OTOOL = @OTOOL@
260 OTOOL64 = @OTOOL64@
261 PACKAGE = @PACKAGE@
262 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
263 PACKAGE_NAME = @PACKAGE_NAME@
264 PACKAGE_STRING = @PACKAGE_STRING@
265 PACKAGE_TARNAME = @PACKAGE_TARNAME@
266 PACKAGE_URL = @PACKAGE_URL@
267 PACKAGE_VERSION = @PACKAGE_VERSION@
268 PATH_SEPARATOR = @PATH_SEPARATOR@
269 PKG_CONFIG = @PKG_CONFIG@
270 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
271 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
272 RANLIB = @RANLIB@
273 SED = @SED@
274 SET_MAKE = @SET_MAKE@
275 SHELL = @SHELL@
276 STRIP = @STRIP@
277 VERSION = @VERSION@
278 WITH_EXAMPLES = @WITH_EXAMPLES@
279 abs_builddir = @abs_builddir@
280 abs_srcdir = @abs_srcdir@
281 abs_top_builddir = @abs_top_builddir@
282 abs_top_srcdir = @abs_top_srcdir@
283 ac_ct_AR = @ac_ct_AR@
284 ac_ct_CC = @ac_ct_CC@
285 ac_ct_CXX = @ac_ct_CXX@
286 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
287 am__include = @am__include@
288 am__leading_dot = @am__leading_dot@
289 am__quote = @am__quote@
290 am__tar = @am__tar@
291 am__untar = @am__untar@
292 bindir = @bindir@
293 build = @build@
294 build_alias = @build_alias@
295 build_cpu = @build_cpu@
296 build_os = @build_os@
297 build_vendor = @build_vendor@
298 builddir = @builddir@
299 datadir = @datadir@
300 datarootdir = @datarootdir@
301 docdir = @docdir@
302 dvidir = @dvidir@
303 exec_prefix = @exec_prefix@
304 gdk_pixbuf_binary_version = @gdk_pixbuf_binary_version@
305 gdk_pixbuf_binarydir = @gdk_pixbuf_binarydir@
306 gdk_pixbuf_cache_file = @gdk_pixbuf_cache_file@
307 gdk_pixbuf_moduledir = @gdk_pixbuf_moduledir@
308 gdkpixbuf_CFLAGS = @gdkpixbuf_CFLAGS@
309 gdkpixbuf_LIBS = @gdkpixbuf_LIBS@
310 have_libde265 = @have_libde265@
311 have_x265 = @have_x265@
312 host = @host@
313 host_alias = @host_alias@
314 host_cpu = @host_cpu@
315 host_os = @host_os@
316 host_vendor = @host_vendor@
317 htmldir = @htmldir@
318 includedir = @includedir@
319 infodir = @infodir@
320 install_sh = @install_sh@
321 libde265_CFLAGS = @libde265_CFLAGS@
322 libde265_LIBS = @libde265_LIBS@
323 libdir = @libdir@
324 libexecdir = @libexecdir@
325 libjpeg_CFLAGS = @libjpeg_CFLAGS@
326 libjpeg_LIBS = @libjpeg_LIBS@
327 libpng_CFLAGS = @libpng_CFLAGS@
328 libpng_LIBS = @libpng_LIBS@
329 localedir = @localedir@
330 localstatedir = @localstatedir@
331 mandir = @mandir@
332 mkdir_p = @mkdir_p@
333 oldincludedir = @oldincludedir@
334 pdfdir = @pdfdir@
335 prefix = @prefix@
336 program_transform_name = @program_transform_name@
337 psdir = @psdir@
338 sbindir = @sbindir@
339 sharedstatedir = @sharedstatedir@
340 srcdir = @srcdir@
341 sysconfdir = @sysconfdir@
342 target = @target@
343 target_alias = @target_alias@
344 target_cpu = @target_cpu@
345 target_os = @target_os@
346 target_vendor = @target_vendor@
347 top_build_prefix = @top_build_prefix@
348 top_builddir = @top_builddir@
349 top_srcdir = @top_srcdir@
350 x265_CFLAGS = @x265_CFLAGS@
351 x265_LIBS = @x265_LIBS@
352 @HAVE_TESTS_TRUE@heif_unit_tests_DEPENDENCIES = ../libheif/libheif.la
353 @HAVE_TESTS_TRUE@heif_unit_tests_CXXFLAGS = -I$(top_srcdir) -I$(top_builddir)/.
354 @HAVE_TESTS_TRUE@heif_unit_tests_LDFLAGS =
355 @HAVE_TESTS_TRUE@heif_unit_tests_LDADD = ../libheif/libheif.la
356 @HAVE_TESTS_TRUE@heif_unit_tests_SOURCES = main.cc encode.cc catch.hpp conversion.cc
357 all: all-am
358
359 .SUFFIXES:
360 .SUFFIXES: .cc .lo .o .obj
361 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
362 @for dep in $?; do \
363 case '$(am__configure_deps)' in \
364 *$$dep*) \
365 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
366 && { if test -f $@; then exit 0; else break; fi; }; \
367 exit 1;; \
368 esac; \
369 done; \
370 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
371 $(am__cd) $(top_srcdir) && \
372 $(AUTOMAKE) --foreign tests/Makefile
373 .PRECIOUS: Makefile
374 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
375 @case '$?' in \
376 *config.status*) \
377 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
378 *) \
379 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
380 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
381 esac;
382
383 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
384 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
385
386 $(top_srcdir)/configure: $(am__configure_deps)
387 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
388 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
389 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
390 $(am__aclocal_m4_deps):
391
392 clean-noinstPROGRAMS:
393 @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
394 echo " rm -f" $$list; \
395 rm -f $$list || exit $$?; \
396 test -n "$(EXEEXT)" || exit 0; \
397 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
398 echo " rm -f" $$list; \
399 rm -f $$list
400
401 heif-unit-tests$(EXEEXT): $(heif_unit_tests_OBJECTS) $(heif_unit_tests_DEPENDENCIES) $(EXTRA_heif_unit_tests_DEPENDENCIES)
402 @rm -f heif-unit-tests$(EXEEXT)
403 $(AM_V_CXXLD)$(heif_unit_tests_LINK) $(heif_unit_tests_OBJECTS) $(heif_unit_tests_LDADD) $(LIBS)
404
405 mostlyclean-compile:
406 -rm -f *.$(OBJEXT)
407
408 distclean-compile:
409 -rm -f *.tab.c
410
411 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_unit_tests-conversion.Po@am__quote@
412 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_unit_tests-encode.Po@am__quote@
413 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heif_unit_tests-main.Po@am__quote@
414
415 .cc.o:
416 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
417 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
418 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
419 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
420 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
421
422 .cc.obj:
423 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
424 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
425 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
426 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
427 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
428
429 .cc.lo:
430 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
431 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
432 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
433 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
434 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
435
436 heif_unit_tests-main.o: main.cc
437 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -MT heif_unit_tests-main.o -MD -MP -MF $(DEPDIR)/heif_unit_tests-main.Tpo -c -o heif_unit_tests-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc
438 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_unit_tests-main.Tpo $(DEPDIR)/heif_unit_tests-main.Po
439 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='main.cc' object='heif_unit_tests-main.o' libtool=no @AMDEPBACKSLASH@
440 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
441 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -c -o heif_unit_tests-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc
442
443 heif_unit_tests-main.obj: main.cc
444 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -MT heif_unit_tests-main.obj -MD -MP -MF $(DEPDIR)/heif_unit_tests-main.Tpo -c -o heif_unit_tests-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi`
445 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_unit_tests-main.Tpo $(DEPDIR)/heif_unit_tests-main.Po
446 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='main.cc' object='heif_unit_tests-main.obj' libtool=no @AMDEPBACKSLASH@
447 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
448 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -c -o heif_unit_tests-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi`
449
450 heif_unit_tests-encode.o: encode.cc
451 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -MT heif_unit_tests-encode.o -MD -MP -MF $(DEPDIR)/heif_unit_tests-encode.Tpo -c -o heif_unit_tests-encode.o `test -f 'encode.cc' || echo '$(srcdir)/'`encode.cc
452 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_unit_tests-encode.Tpo $(DEPDIR)/heif_unit_tests-encode.Po
453 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encode.cc' object='heif_unit_tests-encode.o' libtool=no @AMDEPBACKSLASH@
454 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
455 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -c -o heif_unit_tests-encode.o `test -f 'encode.cc' || echo '$(srcdir)/'`encode.cc
456
457 heif_unit_tests-encode.obj: encode.cc
458 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -MT heif_unit_tests-encode.obj -MD -MP -MF $(DEPDIR)/heif_unit_tests-encode.Tpo -c -o heif_unit_tests-encode.obj `if test -f 'encode.cc'; then $(CYGPATH_W) 'encode.cc'; else $(CYGPATH_W) '$(srcdir)/encode.cc'; fi`
459 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_unit_tests-encode.Tpo $(DEPDIR)/heif_unit_tests-encode.Po
460 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encode.cc' object='heif_unit_tests-encode.obj' libtool=no @AMDEPBACKSLASH@
461 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
462 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -c -o heif_unit_tests-encode.obj `if test -f 'encode.cc'; then $(CYGPATH_W) 'encode.cc'; else $(CYGPATH_W) '$(srcdir)/encode.cc'; fi`
463
464 heif_unit_tests-conversion.o: conversion.cc
465 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -MT heif_unit_tests-conversion.o -MD -MP -MF $(DEPDIR)/heif_unit_tests-conversion.Tpo -c -o heif_unit_tests-conversion.o `test -f 'conversion.cc' || echo '$(srcdir)/'`conversion.cc
466 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_unit_tests-conversion.Tpo $(DEPDIR)/heif_unit_tests-conversion.Po
467 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='conversion.cc' object='heif_unit_tests-conversion.o' libtool=no @AMDEPBACKSLASH@
468 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
469 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -c -o heif_unit_tests-conversion.o `test -f 'conversion.cc' || echo '$(srcdir)/'`conversion.cc
470
471 heif_unit_tests-conversion.obj: conversion.cc
472 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -MT heif_unit_tests-conversion.obj -MD -MP -MF $(DEPDIR)/heif_unit_tests-conversion.Tpo -c -o heif_unit_tests-conversion.obj `if test -f 'conversion.cc'; then $(CYGPATH_W) 'conversion.cc'; else $(CYGPATH_W) '$(srcdir)/conversion.cc'; fi`
473 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/heif_unit_tests-conversion.Tpo $(DEPDIR)/heif_unit_tests-conversion.Po
474 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='conversion.cc' object='heif_unit_tests-conversion.obj' libtool=no @AMDEPBACKSLASH@
475 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
476 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(heif_unit_tests_CXXFLAGS) $(CXXFLAGS) -c -o heif_unit_tests-conversion.obj `if test -f 'conversion.cc'; then $(CYGPATH_W) 'conversion.cc'; else $(CYGPATH_W) '$(srcdir)/conversion.cc'; fi`
477
478 mostlyclean-libtool:
479 -rm -f *.lo
480
481 clean-libtool:
482 -rm -rf .libs _libs
483 format-local:
484 test-local:
485
486 ID: $(am__tagged_files)
487 $(am__define_uniq_tagged_files); mkid -fID $$unique
488 tags: tags-am
489 TAGS: tags
490
491 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
492 set x; \
493 here=`pwd`; \
494 $(am__define_uniq_tagged_files); \
495 shift; \
496 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
497 test -n "$$unique" || unique=$$empty_fix; \
498 if test $$# -gt 0; then \
499 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
500 "$$@" $$unique; \
501 else \
502 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
503 $$unique; \
504 fi; \
505 fi
506 ctags: ctags-am
507
508 CTAGS: ctags
509 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
510 $(am__define_uniq_tagged_files); \
511 test -z "$(CTAGS_ARGS)$$unique" \
512 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
513 $$unique
514
515 GTAGS:
516 here=`$(am__cd) $(top_builddir) && pwd` \
517 && $(am__cd) $(top_srcdir) \
518 && gtags -i $(GTAGS_ARGS) "$$here"
519 cscopelist: cscopelist-am
520
521 cscopelist-am: $(am__tagged_files)
522 list='$(am__tagged_files)'; \
523 case "$(srcdir)" in \
524 [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
525 *) sdir=$(subdir)/$(srcdir) ;; \
526 esac; \
527 for i in $$list; do \
528 if test -f "$$i"; then \
529 echo "$(subdir)/$$i"; \
530 else \
531 echo "$$sdir/$$i"; \
532 fi; \
533 done >> $(top_builddir)/cscope.files
534
535 distclean-tags:
536 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
537
538 distdir: $(DISTFILES)
539 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
540 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
541 list='$(DISTFILES)'; \
542 dist_files=`for file in $$list; do echo $$file; done | \
543 sed -e "s|^$$srcdirstrip/||;t" \
544 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
545 case $$dist_files in \
546 */*) $(MKDIR_P) `echo "$$dist_files" | \
547 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
548 sort -u` ;; \
549 esac; \
550 for file in $$dist_files; do \
551 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
552 if test -d $$d/$$file; then \
553 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
554 if test -d "$(distdir)/$$file"; then \
555 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
556 fi; \
557 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
558 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
559 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
560 fi; \
561 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
562 else \
563 test -f "$(distdir)/$$file" \
564 || cp -p $$d/$$file "$(distdir)/$$file" \
565 || exit 1; \
566 fi; \
567 done
568 check-am: all-am
569 check: check-am
570 all-am: Makefile $(PROGRAMS)
571 installdirs:
572 install: install-am
573 install-exec: install-exec-am
574 install-data: install-data-am
575 uninstall: uninstall-am
576
577 install-am: all-am
578 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
579
580 installcheck: installcheck-am
581 install-strip:
582 if test -z '$(STRIP)'; then \
583 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
584 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
585 install; \
586 else \
587 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
588 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
589 "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
590 fi
591 mostlyclean-generic:
592
593 clean-generic:
594
595 distclean-generic:
596 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
597 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
598
599 maintainer-clean-generic:
600 @echo "This command is intended for maintainers to use"
601 @echo "it deletes files that may require special tools to rebuild."
602 clean: clean-am
603
604 clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
605 mostlyclean-am
606
607 distclean: distclean-am
608 -rm -rf ./$(DEPDIR)
609 -rm -f Makefile
610 distclean-am: clean-am distclean-compile distclean-generic \
611 distclean-tags
612
613 dvi: dvi-am
614
615 dvi-am:
616
617 format: format-am
618
619 format-am: format-local
620
621 html: html-am
622
623 html-am:
624
625 info: info-am
626
627 info-am:
628
629 install-data-am:
630
631 install-dvi: install-dvi-am
632
633 install-dvi-am:
634
635 install-exec-am:
636
637 install-html: install-html-am
638
639 install-html-am:
640
641 install-info: install-info-am
642
643 install-info-am:
644
645 install-man:
646
647 install-pdf: install-pdf-am
648
649 install-pdf-am:
650
651 install-ps: install-ps-am
652
653 install-ps-am:
654
655 installcheck-am:
656
657 maintainer-clean: maintainer-clean-am
658 -rm -rf ./$(DEPDIR)
659 -rm -f Makefile
660 maintainer-clean-am: distclean-am maintainer-clean-generic
661
662 mostlyclean: mostlyclean-am
663
664 mostlyclean-am: mostlyclean-compile mostlyclean-generic \
665 mostlyclean-libtool
666
667 pdf: pdf-am
668
669 pdf-am:
670
671 ps: ps-am
672
673 ps-am:
674
675 test: test-am
676
677 test-am: test-local
678
679 uninstall-am:
680
681 .MAKE: install-am install-strip
682
683 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
684 clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
685 ctags-am distclean distclean-compile distclean-generic \
686 distclean-libtool distclean-tags distdir dvi dvi-am format-am \
687 format-local html html-am info info-am install install-am \
688 install-data install-data-am install-dvi install-dvi-am \
689 install-exec install-exec-am install-html install-html-am \
690 install-info install-info-am install-man install-pdf \
691 install-pdf-am install-ps install-ps-am install-strip \
692 installcheck installcheck-am installdirs maintainer-clean \
693 maintainer-clean-generic mostlyclean mostlyclean-compile \
694 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
695 tags tags-am test-am test-local uninstall uninstall-am
696
697
698 # Tell versions [3.59,3.63) of GNU make to not export all variables.
699 # Otherwise a system limit (for SysV at least) may be exceeded.
700 .NOEXPORT:
0 /*
1 * Catch v2.9.1
2 * Generated: 2019-06-17 11:59:24.363643
3 * ----------------------------------------------------------
4 * This file has been merged from multiple headers. Please don't edit it directly
5 * Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved.
6 *
7 * Distributed under the Boost Software License, Version 1.0. (See accompanying
8 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 */
10 #ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
11 #define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
12 // start catch.hpp
13
14
15 #define CATCH_VERSION_MAJOR 2
16 #define CATCH_VERSION_MINOR 9
17 #define CATCH_VERSION_PATCH 1
18
19 #ifdef __clang__
20 # pragma clang system_header
21 #elif defined __GNUC__
22 # pragma GCC system_header
23 #endif
24
25 // start catch_suppress_warnings.h
26
27 #ifdef __clang__
28 # ifdef __ICC // icpc defines the __clang__ macro
29 # pragma warning(push)
30 # pragma warning(disable: 161 1682)
31 # else // __ICC
32 # pragma clang diagnostic push
33 # pragma clang diagnostic ignored "-Wpadded"
34 # pragma clang diagnostic ignored "-Wswitch-enum"
35 # pragma clang diagnostic ignored "-Wcovered-switch-default"
36 # endif
37 #elif defined __GNUC__
38 // Because REQUIREs trigger GCC's -Wparentheses, and because still
39 // supported version of g++ have only buggy support for _Pragmas,
40 // Wparentheses have to be suppressed globally.
41 # pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details
42
43 # pragma GCC diagnostic push
44 # pragma GCC diagnostic ignored "-Wunused-variable"
45 # pragma GCC diagnostic ignored "-Wpadded"
46 #endif
47 // end catch_suppress_warnings.h
48 #if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
49 # define CATCH_IMPL
50 # define CATCH_CONFIG_ALL_PARTS
51 #endif
52
53 // In the impl file, we want to have access to all parts of the headers
54 // Can also be used to sanely support PCHs
55 #if defined(CATCH_CONFIG_ALL_PARTS)
56 # define CATCH_CONFIG_EXTERNAL_INTERFACES
57 # if defined(CATCH_CONFIG_DISABLE_MATCHERS)
58 # undef CATCH_CONFIG_DISABLE_MATCHERS
59 # endif
60 # if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
61 # define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
62 # endif
63 #endif
64
65 #if !defined(CATCH_CONFIG_IMPL_ONLY)
66 // start catch_platform.h
67
68 #ifdef __APPLE__
69 # include <TargetConditionals.h>
70 # if TARGET_OS_OSX == 1
71 # define CATCH_PLATFORM_MAC
72 # elif TARGET_OS_IPHONE == 1
73 # define CATCH_PLATFORM_IPHONE
74 # endif
75
76 #elif defined(linux) || defined(__linux) || defined(__linux__)
77 # define CATCH_PLATFORM_LINUX
78
79 #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)
80 # define CATCH_PLATFORM_WINDOWS
81 #endif
82
83 // end catch_platform.h
84
85 #ifdef CATCH_IMPL
86 # ifndef CLARA_CONFIG_MAIN
87 # define CLARA_CONFIG_MAIN_NOT_DEFINED
88 # define CLARA_CONFIG_MAIN
89 # endif
90 #endif
91
92 // start catch_user_interfaces.h
93
94 namespace Catch {
95 unsigned int rngSeed();
96 }
97
98 // end catch_user_interfaces.h
99 // start catch_tag_alias_autoregistrar.h
100
101 // start catch_common.h
102
103 // start catch_compiler_capabilities.h
104
105 // Detect a number of compiler features - by compiler
106 // The following features are defined:
107 //
108 // CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
109 // CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
110 // CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?
111 // CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled?
112 // ****************
113 // Note to maintainers: if new toggles are added please document them
114 // in configuration.md, too
115 // ****************
116
117 // In general each macro has a _NO_<feature name> form
118 // (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature.
119 // Many features, at point of detection, define an _INTERNAL_ macro, so they
120 // can be combined, en-mass, with the _NO_ forms later.
121
122 #ifdef __cplusplus
123
124 # if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
125 # define CATCH_CPP14_OR_GREATER
126 # endif
127
128 # if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
129 # define CATCH_CPP17_OR_GREATER
130 # endif
131
132 #endif
133
134 #if defined(CATCH_CPP17_OR_GREATER)
135 # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
136 #endif
137
138 #ifdef __clang__
139
140 # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
141 _Pragma( "clang diagnostic push" ) \
142 _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \
143 _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"")
144 # define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
145 _Pragma( "clang diagnostic pop" )
146
147 # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
148 _Pragma( "clang diagnostic push" ) \
149 _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
150 # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
151 _Pragma( "clang diagnostic pop" )
152
153 # define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
154 _Pragma( "clang diagnostic push" ) \
155 _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" )
156 # define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS \
157 _Pragma( "clang diagnostic pop" )
158
159 # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
160 _Pragma( "clang diagnostic push" ) \
161 _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" )
162 # define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \
163 _Pragma( "clang diagnostic pop" )
164
165 #endif // __clang__
166
167 ////////////////////////////////////////////////////////////////////////////////
168 // Assume that non-Windows platforms support posix signals by default
169 #if !defined(CATCH_PLATFORM_WINDOWS)
170 #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS
171 #endif
172
173 ////////////////////////////////////////////////////////////////////////////////
174 // We know some environments not to support full POSIX signals
175 #if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__)
176 #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
177 #endif
178
179 #ifdef __OS400__
180 # define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
181 # define CATCH_CONFIG_COLOUR_NONE
182 #endif
183
184 ////////////////////////////////////////////////////////////////////////////////
185 // Android somehow still does not support std::to_string
186 #if defined(__ANDROID__)
187 # define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
188 #endif
189
190 ////////////////////////////////////////////////////////////////////////////////
191 // Not all Windows environments support SEH properly
192 #if defined(__MINGW32__)
193 # define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
194 #endif
195
196 ////////////////////////////////////////////////////////////////////////////////
197 // PS4
198 #if defined(__ORBIS__)
199 # define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE
200 #endif
201
202 ////////////////////////////////////////////////////////////////////////////////
203 // Cygwin
204 #ifdef __CYGWIN__
205
206 // Required for some versions of Cygwin to declare gettimeofday
207 // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
208 # define _BSD_SOURCE
209 // some versions of cygwin (most) do not support std::to_string. Use the libstd check.
210 // https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813
211 # if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
212 && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
213
214 # define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
215
216 # endif
217 #endif // __CYGWIN__
218
219 ////////////////////////////////////////////////////////////////////////////////
220 // Visual C++
221 #ifdef _MSC_VER
222
223 # if _MSC_VER >= 1900 // Visual Studio 2015 or newer
224 # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
225 # endif
226
227 // Universal Windows platform does not support SEH
228 // Or console colours (or console at all...)
229 # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
230 # define CATCH_CONFIG_COLOUR_NONE
231 # else
232 # define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
233 # endif
234
235 // MSVC traditional preprocessor needs some workaround for __VA_ARGS__
236 // _MSVC_TRADITIONAL == 0 means new conformant preprocessor
237 // _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
238 # if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
239 # define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
240 # endif
241 #endif // _MSC_VER
242
243 #if defined(_REENTRANT) || defined(_MSC_VER)
244 // Enable async processing, as -pthread is specified or no additional linking is required
245 # define CATCH_INTERNAL_CONFIG_USE_ASYNC
246 #endif // _MSC_VER
247
248 ////////////////////////////////////////////////////////////////////////////////
249 // Check if we are compiled with -fno-exceptions or equivalent
250 #if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND)
251 # define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED
252 #endif
253
254 ////////////////////////////////////////////////////////////////////////////////
255 // DJGPP
256 #ifdef __DJGPP__
257 # define CATCH_INTERNAL_CONFIG_NO_WCHAR
258 #endif // __DJGPP__
259
260 ////////////////////////////////////////////////////////////////////////////////
261 // Embarcadero C++Build
262 #if defined(__BORLANDC__)
263 #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN
264 #endif
265
266 ////////////////////////////////////////////////////////////////////////////////
267
268 // Use of __COUNTER__ is suppressed during code analysis in
269 // CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly
270 // handled by it.
271 // Otherwise all supported compilers support COUNTER macro,
272 // but user still might want to turn it off
273 #if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )
274 #define CATCH_INTERNAL_CONFIG_COUNTER
275 #endif
276
277 ////////////////////////////////////////////////////////////////////////////////
278 // Check if string_view is available and usable
279 // The check is split apart to work around v140 (VS2015) preprocessor issue...
280 #if defined(__has_include)
281 #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER)
282 # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW
283 #endif
284 #endif
285
286 ////////////////////////////////////////////////////////////////////////////////
287 // Check if optional is available and usable
288 #if defined(__has_include)
289 # if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)
290 # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL
291 # endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)
292 #endif // __has_include
293
294 ////////////////////////////////////////////////////////////////////////////////
295 // Check if variant is available and usable
296 #if defined(__has_include)
297 # if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)
298 # if defined(__clang__) && (__clang_major__ < 8)
299 // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852
300 // fix should be in clang 8, workaround in libstdc++ 8.2
301 # include <ciso646>
302 # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
303 # define CATCH_CONFIG_NO_CPP17_VARIANT
304 # else
305 # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
306 # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
307 # else
308 # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
309 # endif // defined(__clang__) && (__clang_major__ < 8)
310 # endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)
311 #endif // __has_include
312
313 #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
314 # define CATCH_CONFIG_COUNTER
315 #endif
316 #if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)
317 # define CATCH_CONFIG_WINDOWS_SEH
318 #endif
319 // This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
320 #if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
321 # define CATCH_CONFIG_POSIX_SIGNALS
322 #endif
323 // This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions.
324 #if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR)
325 # define CATCH_CONFIG_WCHAR
326 #endif
327
328 #if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING)
329 # define CATCH_CONFIG_CPP11_TO_STRING
330 #endif
331
332 #if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL)
333 # define CATCH_CONFIG_CPP17_OPTIONAL
334 #endif
335
336 #if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
337 # define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
338 #endif
339
340 #if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)
341 # define CATCH_CONFIG_CPP17_STRING_VIEW
342 #endif
343
344 #if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT)
345 # define CATCH_CONFIG_CPP17_VARIANT
346 #endif
347
348 #if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)
349 # define CATCH_INTERNAL_CONFIG_NEW_CAPTURE
350 #endif
351
352 #if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE)
353 # define CATCH_CONFIG_NEW_CAPTURE
354 #endif
355
356 #if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
357 # define CATCH_CONFIG_DISABLE_EXCEPTIONS
358 #endif
359
360 #if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN)
361 # define CATCH_CONFIG_POLYFILL_ISNAN
362 #endif
363
364 #if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC)
365 # define CATCH_CONFIG_USE_ASYNC
366 #endif
367
368 #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
369 # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
370 # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
371 #endif
372 #if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)
373 # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
374 # define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
375 #endif
376 #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS)
377 # define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS
378 # define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS
379 #endif
380 #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS)
381 # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS
382 # define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS
383 #endif
384
385 #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
386 #define CATCH_TRY if ((true))
387 #define CATCH_CATCH_ALL if ((false))
388 #define CATCH_CATCH_ANON(type) if ((false))
389 #else
390 #define CATCH_TRY try
391 #define CATCH_CATCH_ALL catch (...)
392 #define CATCH_CATCH_ANON(type) catch (type)
393 #endif
394
395 #if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR)
396 #define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
397 #endif
398
399 // end catch_compiler_capabilities.h
400 #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
401 #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
402 #ifdef CATCH_CONFIG_COUNTER
403 # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
404 #else
405 # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
406 #endif
407
408 #include <iosfwd>
409 #include <string>
410 #include <cstdint>
411
412 // We need a dummy global operator<< so we can bring it into Catch namespace later
413 struct Catch_global_namespace_dummy {};
414 std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);
415
416 namespace Catch {
417
418 struct CaseSensitive { enum Choice {
419 Yes,
420 No
421 }; };
422
423 class NonCopyable {
424 NonCopyable( NonCopyable const& ) = delete;
425 NonCopyable( NonCopyable && ) = delete;
426 NonCopyable& operator = ( NonCopyable const& ) = delete;
427 NonCopyable& operator = ( NonCopyable && ) = delete;
428
429 protected:
430 NonCopyable();
431 virtual ~NonCopyable();
432 };
433
434 struct SourceLineInfo {
435
436 SourceLineInfo() = delete;
437 SourceLineInfo( char const* _file, std::size_t _line ) noexcept
438 : file( _file ),
439 line( _line )
440 {}
441
442 SourceLineInfo( SourceLineInfo const& other ) = default;
443 SourceLineInfo& operator = ( SourceLineInfo const& ) = default;
444 SourceLineInfo( SourceLineInfo&& ) noexcept = default;
445 SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default;
446
447 bool empty() const noexcept;
448 bool operator == ( SourceLineInfo const& other ) const noexcept;
449 bool operator < ( SourceLineInfo const& other ) const noexcept;
450
451 char const* file;
452 std::size_t line;
453 };
454
455 std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
456
457 // Bring in operator<< from global namespace into Catch namespace
458 // This is necessary because the overload of operator<< above makes
459 // lookup stop at namespace Catch
460 using ::operator<<;
461
462 // Use this in variadic streaming macros to allow
463 // >> +StreamEndStop
464 // as well as
465 // >> stuff +StreamEndStop
466 struct StreamEndStop {
467 std::string operator+() const;
468 };
469 template<typename T>
470 T const& operator + ( T const& value, StreamEndStop ) {
471 return value;
472 }
473 }
474
475 #define CATCH_INTERNAL_LINEINFO \
476 ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )
477
478 // end catch_common.h
479 namespace Catch {
480
481 struct RegistrarForTagAliases {
482 RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo );
483 };
484
485 } // end namespace Catch
486
487 #define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \
488 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
489 namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \
490 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
491
492 // end catch_tag_alias_autoregistrar.h
493 // start catch_test_registry.h
494
495 // start catch_interfaces_testcase.h
496
497 #include <vector>
498
499 namespace Catch {
500
501 class TestSpec;
502
503 struct ITestInvoker {
504 virtual void invoke () const = 0;
505 virtual ~ITestInvoker();
506 };
507
508 class TestCase;
509 struct IConfig;
510
511 struct ITestCaseRegistry {
512 virtual ~ITestCaseRegistry();
513 virtual std::vector<TestCase> const& getAllTests() const = 0;
514 virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0;
515 };
516
517 bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
518 std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
519 std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
520
521 }
522
523 // end catch_interfaces_testcase.h
524 // start catch_stringref.h
525
526 #include <cstddef>
527 #include <string>
528 #include <iosfwd>
529
530 namespace Catch {
531
532 /// A non-owning string class (similar to the forthcoming std::string_view)
533 /// Note that, because a StringRef may be a substring of another string,
534 /// it may not be null terminated. c_str() must return a null terminated
535 /// string, however, and so the StringRef will internally take ownership
536 /// (taking a copy), if necessary. In theory this ownership is not externally
537 /// visible - but it does mean (substring) StringRefs should not be shared between
538 /// threads.
539 class StringRef {
540 public:
541 using size_type = std::size_t;
542
543 private:
544 friend struct StringRefTestAccess;
545
546 char const* m_start;
547 size_type m_size;
548
549 char* m_data = nullptr;
550
551 void takeOwnership();
552
553 static constexpr char const* const s_empty = "";
554
555 public: // construction/ assignment
556 StringRef() noexcept
557 : StringRef( s_empty, 0 )
558 {}
559
560 StringRef( StringRef const& other ) noexcept
561 : m_start( other.m_start ),
562 m_size( other.m_size )
563 {}
564
565 StringRef( StringRef&& other ) noexcept
566 : m_start( other.m_start ),
567 m_size( other.m_size ),
568 m_data( other.m_data )
569 {
570 other.m_data = nullptr;
571 }
572
573 StringRef( char const* rawChars ) noexcept;
574
575 StringRef( char const* rawChars, size_type size ) noexcept
576 : m_start( rawChars ),
577 m_size( size )
578 {}
579
580 StringRef( std::string const& stdString ) noexcept
581 : m_start( stdString.c_str() ),
582 m_size( stdString.size() )
583 {}
584
585 ~StringRef() noexcept {
586 delete[] m_data;
587 }
588
589 auto operator = ( StringRef const &other ) noexcept -> StringRef& {
590 delete[] m_data;
591 m_data = nullptr;
592 m_start = other.m_start;
593 m_size = other.m_size;
594 return *this;
595 }
596
597 operator std::string() const;
598
599 void swap( StringRef& other ) noexcept;
600
601 public: // operators
602 auto operator == ( StringRef const& other ) const noexcept -> bool;
603 auto operator != ( StringRef const& other ) const noexcept -> bool;
604
605 auto operator[] ( size_type index ) const noexcept -> char;
606
607 public: // named queries
608 auto empty() const noexcept -> bool {
609 return m_size == 0;
610 }
611 auto size() const noexcept -> size_type {
612 return m_size;
613 }
614
615 auto numberOfCharacters() const noexcept -> size_type;
616 auto c_str() const -> char const*;
617
618 public: // substrings and searches
619 auto substr( size_type start, size_type size ) const noexcept -> StringRef;
620
621 // Returns the current start pointer.
622 // Note that the pointer can change when if the StringRef is a substring
623 auto currentData() const noexcept -> char const*;
624
625 private: // ownership queries - may not be consistent between calls
626 auto isOwned() const noexcept -> bool;
627 auto isSubstring() const noexcept -> bool;
628 };
629
630 auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string;
631 auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string;
632 auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string;
633
634 auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&;
635 auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&;
636
637 inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {
638 return StringRef( rawChars, size );
639 }
640
641 } // namespace Catch
642
643 inline auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef {
644 return Catch::StringRef( rawChars, size );
645 }
646
647 // end catch_stringref.h
648 // start catch_type_traits.hpp
649
650
651 #include <type_traits>
652
653 namespace Catch{
654
655 #ifdef CATCH_CPP17_OR_GREATER
656 template <typename...>
657 inline constexpr auto is_unique = std::true_type{};
658
659 template <typename T, typename... Rest>
660 inline constexpr auto is_unique<T, Rest...> = std::bool_constant<
661 (!std::is_same_v<T, Rest> && ...) && is_unique<Rest...>
662 >{};
663 #else
664
665 template <typename...>
666 struct is_unique : std::true_type{};
667
668 template <typename T0, typename T1, typename... Rest>
669 struct is_unique<T0, T1, Rest...> : std::integral_constant
670 <bool,
671 !std::is_same<T0, T1>::value
672 && is_unique<T0, Rest...>::value
673 && is_unique<T1, Rest...>::value
674 >{};
675
676 #endif
677 }
678
679 // end catch_type_traits.hpp
680 // start catch_preprocessor.hpp
681
682
683 #define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__
684 #define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__)))
685 #define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__)))
686 #define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__)))
687 #define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__)))
688 #define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__)))
689
690 #ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
691 #define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__
692 // MSVC needs more evaluations
693 #define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__)))
694 #define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__))
695 #else
696 #define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__)
697 #endif
698
699 #define CATCH_REC_END(...)
700 #define CATCH_REC_OUT
701
702 #define CATCH_EMPTY()
703 #define CATCH_DEFER(id) id CATCH_EMPTY()
704
705 #define CATCH_REC_GET_END2() 0, CATCH_REC_END
706 #define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2
707 #define CATCH_REC_GET_END(...) CATCH_REC_GET_END1
708 #define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT
709 #define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0)
710 #define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next)
711
712 #define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
713 #define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ )
714 #define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
715
716 #define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )
717 #define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ )
718 #define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )
719
720 // Applies the function macro `f` to each of the remaining parameters, inserts commas between the results,
721 // and passes userdata as the first parameter to each invocation,
722 // e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c)
723 #define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
724
725 #define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
726
727 #define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
728 #define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__
729 #define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
730 #define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
731 #define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__)
732 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
733 #define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__
734 #define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param))
735 #else
736 // MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
737 #define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__)
738 #define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__
739 #define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1)
740 #endif
741
742 #define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__
743 #define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name)
744
745 #define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__)
746
747 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
748 #define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>())
749 #define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))
750 #else
751 #define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>()))
752 #define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)))
753 #endif
754
755 #define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\
756 CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__)
757
758 #define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0)
759 #define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1)
760 #define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2)
761 #define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)
762 #define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)
763 #define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)
764 #define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _4, _5, _6)
765 #define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)
766 #define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)
767 #define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)
768 #define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10)
769
770 #define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
771
772 #define INTERNAL_CATCH_TYPE_GEN\
773 template<typename...> struct TypeList {};\
774 template<typename...Ts>\
775 constexpr auto get_wrapper() noexcept -> TypeList<Ts...> { return {}; }\
776 \
777 template<template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2> \
778 constexpr auto append(L1<E1...>, L2<E2...>) noexcept -> L1<E1...,E2...> { return {}; }\
779 template< template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2, typename...Rest>\
780 constexpr auto append(L1<E1...>, L2<E2...>, Rest...) noexcept -> decltype(append(L1<E1...,E2...>{}, Rest{}...)) { return {}; }\
781 template< template<typename...> class L1, typename...E1, typename...Rest>\
782 constexpr auto append(L1<E1...>, TypeList<mpl_::na>, Rest...) noexcept -> L1<E1...> { return {}; }\
783 \
784 template< template<typename...> class Container, template<typename...> class List, typename...elems>\
785 constexpr auto rewrap(List<elems...>) noexcept -> TypeList<Container<elems...>> { return {}; }\
786 template< template<typename...> class Container, template<typename...> class List, class...Elems, typename...Elements>\
787 constexpr auto rewrap(List<Elems...>,Elements...) noexcept -> decltype(append(TypeList<Container<Elems...>>{}, rewrap<Container>(Elements{}...))) { return {}; }\
788 \
789 template<template <typename...> class Final, template< typename...> class...Containers, typename...Types>\
790 constexpr auto create(TypeList<Types...>) noexcept -> decltype(append(Final<>{}, rewrap<Containers>(Types{}...)...)) { return {}; }\
791 template<template <typename...> class Final, template <typename...> class List, typename...Ts>\
792 constexpr auto convert(List<Ts...>) noexcept -> decltype(append(Final<>{},TypeList<Ts>{}...)) { return {}; }
793
794 #define INTERNAL_CATCH_NTTP_1(signature, ...)\
795 template<INTERNAL_CATCH_REMOVE_PARENS(signature)> struct Nttp{};\
796 template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
797 constexpr auto get_wrapper() noexcept -> Nttp<__VA_ARGS__> { return {}; } \
798 \
799 template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature)>\
800 constexpr auto rewrap(List<__VA_ARGS__>) noexcept -> TypeList<Container<__VA_ARGS__>> { return {}; }\
801 template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature), typename...Elements>\
802 constexpr auto rewrap(List<__VA_ARGS__>,Elements...elems) noexcept -> decltype(append(TypeList<Container<__VA_ARGS__>>{}, rewrap<Container>(elems...))) { return {}; }\
803 template<template <typename...> class Final, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Containers, typename...Types>\
804 constexpr auto create(TypeList<Types...>) noexcept -> decltype(append(Final<>{}, rewrap<Containers>(Types{}...)...)) { return {}; }
805
806 #define INTERNAL_CATCH_DECLARE_SIG_TEST0(TestName)
807 #define INTERNAL_CATCH_DECLARE_SIG_TEST1(TestName, signature)\
808 template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
809 static void TestName()
810 #define INTERNAL_CATCH_DECLARE_SIG_TEST_X(TestName, signature, ...)\
811 template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
812 static void TestName()
813
814 #define INTERNAL_CATCH_DEFINE_SIG_TEST0(TestName)
815 #define INTERNAL_CATCH_DEFINE_SIG_TEST1(TestName, signature)\
816 template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
817 static void TestName()
818 #define INTERNAL_CATCH_DEFINE_SIG_TEST_X(TestName, signature,...)\
819 template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
820 static void TestName()
821
822 #define INTERNAL_CATCH_NTTP_REGISTER0(TestFunc, signature)\
823 template<typename Type>\
824 void reg_test(TypeList<Type>, Catch::NameAndTags nameAndTags)\
825 {\
826 Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<Type>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\
827 }
828
829 #define INTERNAL_CATCH_NTTP_REGISTER(TestFunc, signature, ...)\
830 template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
831 void reg_test(Nttp<__VA_ARGS__>, Catch::NameAndTags nameAndTags)\
832 {\
833 Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\
834 }
835
836 #define INTERNAL_CATCH_NTTP_REGISTER_METHOD0(TestName, signature, ...)\
837 template<typename Type>\
838 void reg_test(TypeList<Type>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\
839 {\
840 Catch::AutoReg( Catch::makeTestInvoker(&TestName<Type>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\
841 }
842
843 #define INTERNAL_CATCH_NTTP_REGISTER_METHOD(TestName, signature, ...)\
844 template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
845 void reg_test(Nttp<__VA_ARGS__>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\
846 {\
847 Catch::AutoReg( Catch::makeTestInvoker(&TestName<__VA_ARGS__>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\
848 }
849
850 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0(TestName, ClassName)
851 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1(TestName, ClassName, signature)\
852 template<typename TestType> \
853 struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> { \
854 void test();\
855 }
856
857 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X(TestName, ClassName, signature, ...)\
858 template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \
859 struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> { \
860 void test();\
861 }
862
863 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0(TestName)
864 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1(TestName, signature)\
865 template<typename TestType> \
866 void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<TestType>::test()
867 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X(TestName, signature, ...)\
868 template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \
869 void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<__VA_ARGS__>::test()
870
871 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
872 #define INTERNAL_CATCH_NTTP_0
873 #define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0)
874 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__)
875 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__)
876 #define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__)
877 #define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__)
878 #define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__)
879 #define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__)
880 #define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__)
881 #else
882 #define INTERNAL_CATCH_NTTP_0(signature)
883 #define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1,INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_0)( __VA_ARGS__))
884 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__))
885 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__))
886 #define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__))
887 #define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__))
888 #define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__))
889 #define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__))
890 #define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__))
891 #endif
892
893 // end catch_preprocessor.hpp
894 // start catch_meta.hpp
895
896
897 #include <type_traits>
898
899 namespace Catch {
900 template<typename T>
901 struct always_false : std::false_type {};
902
903 template <typename> struct true_given : std::true_type {};
904 struct is_callable_tester {
905 template <typename Fun, typename... Args>
906 true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int);
907 template <typename...>
908 std::false_type static test(...);
909 };
910
911 template <typename T>
912 struct is_callable;
913
914 template <typename Fun, typename... Args>
915 struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {};
916
917 } // namespace Catch
918
919 namespace mpl_{
920 struct na;
921 }
922
923 // end catch_meta.hpp
924 namespace Catch {
925
926 template<typename C>
927 class TestInvokerAsMethod : public ITestInvoker {
928 void (C::*m_testAsMethod)();
929 public:
930 TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {}
931
932 void invoke() const override {
933 C obj;
934 (obj.*m_testAsMethod)();
935 }
936 };
937
938 auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*;
939
940 template<typename C>
941 auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* {
942 return new(std::nothrow) TestInvokerAsMethod<C>( testAsMethod );
943 }
944
945 struct NameAndTags {
946 NameAndTags( StringRef const& name_ = StringRef(), StringRef const& tags_ = StringRef() ) noexcept;
947 StringRef name;
948 StringRef tags;
949 };
950
951 struct AutoReg : NonCopyable {
952 AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept;
953 ~AutoReg();
954 };
955
956 } // end namespace Catch
957
958 #if defined(CATCH_CONFIG_DISABLE)
959 #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \
960 static void TestName()
961 #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
962 namespace{ \
963 struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \
964 void test(); \
965 }; \
966 } \
967 void TestName::test()
968 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( TestName, TestFunc, Name, Tags, Signature, ... ) \
969 INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature))
970 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \
971 namespace{ \
972 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
973 INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\
974 } \
975 } \
976 INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))
977
978 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
979 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
980 INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ )
981 #else
982 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
983 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
984 #endif
985
986 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
987 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
988 INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ )
989 #else
990 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
991 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
992 #endif
993
994 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
995 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
996 INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
997 #else
998 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
999 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
1000 #endif
1001
1002 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1003 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
1004 INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
1005 #else
1006 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
1007 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
1008 #endif
1009 #endif
1010
1011 ///////////////////////////////////////////////////////////////////////////////
1012 #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
1013 static void TestName(); \
1014 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1015 namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
1016 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1017 static void TestName()
1018 #define INTERNAL_CATCH_TESTCASE( ... ) \
1019 INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
1020
1021 ///////////////////////////////////////////////////////////////////////////////
1022 #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
1023 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1024 namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
1025 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
1026
1027 ///////////////////////////////////////////////////////////////////////////////
1028 #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
1029 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1030 namespace{ \
1031 struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \
1032 void test(); \
1033 }; \
1034 Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
1035 } \
1036 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1037 void TestName::test()
1038 #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
1039 INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
1040
1041 ///////////////////////////////////////////////////////////////////////////////
1042 #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
1043 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1044 Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
1045 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
1046
1047 ///////////////////////////////////////////////////////////////////////////////
1048 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\
1049 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1050 CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
1051 INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\
1052 namespace {\
1053 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\
1054 INTERNAL_CATCH_TYPE_GEN\
1055 INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1056 INTERNAL_CATCH_NTTP_REG_GEN(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1057 template<typename...Types> \
1058 struct TestName{\
1059 TestName(){\
1060 int index = 0; \
1061 constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
1062 using expander = int[];\
1063 (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
1064 }\
1065 };\
1066 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
1067 TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\
1068 return 0;\
1069 }();\
1070 }\
1071 }\
1072 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1073 CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \
1074 INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))
1075
1076 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1077 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
1078 INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ )
1079 #else
1080 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
1081 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
1082 #endif
1083
1084 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1085 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
1086 INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ )
1087 #else
1088 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
1089 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
1090 #endif
1091
1092 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \
1093 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1094 CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
1095 template<typename TestType> static void TestFuncName(); \
1096 namespace {\
1097 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
1098 INTERNAL_CATCH_TYPE_GEN \
1099 INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
1100 template<typename... Types> \
1101 struct TestName { \
1102 void reg_tests() { \
1103 int index = 0; \
1104 using expander = int[]; \
1105 constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
1106 constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
1107 constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
1108 (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */\
1109 } \
1110 }; \
1111 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
1112 using TestInit = decltype(create<TestName, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>(TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>{})); \
1113 TestInit t; \
1114 t.reg_tests(); \
1115 return 0; \
1116 }(); \
1117 } \
1118 } \
1119 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1120 CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \
1121 template<typename TestType> \
1122 static void TestFuncName()
1123
1124 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1125 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
1126 INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T,__VA_ARGS__)
1127 #else
1128 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
1129 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T, __VA_ARGS__ ) )
1130 #endif
1131
1132 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1133 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
1134 INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__)
1135 #else
1136 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
1137 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
1138 #endif
1139
1140 #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\
1141 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1142 template<typename TestType> static void TestFunc(); \
1143 namespace {\
1144 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\
1145 INTERNAL_CATCH_TYPE_GEN\
1146 template<typename... Types> \
1147 struct TestName { \
1148 void reg_tests() { \
1149 int index = 0; \
1150 using expander = int[]; \
1151 (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */\
1152 } \
1153 };\
1154 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
1155 using TestInit = decltype(convert<TestName>(TmplList {})); \
1156 TestInit t; \
1157 t.reg_tests(); \
1158 return 0; \
1159 }(); \
1160 }}\
1161 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1162 template<typename TestType> \
1163 static void TestFunc()
1164
1165 #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \
1166 INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, TmplList )
1167
1168 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \
1169 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1170 CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
1171 namespace {\
1172 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \
1173 INTERNAL_CATCH_TYPE_GEN\
1174 INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1175 INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\
1176 INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1177 template<typename...Types> \
1178 struct TestNameClass{\
1179 TestNameClass(){\
1180 int index = 0; \
1181 constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
1182 using expander = int[];\
1183 (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
1184 }\
1185 };\
1186 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
1187 TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\
1188 return 0;\
1189 }();\
1190 }\
1191 }\
1192 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\
1193 CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS\
1194 INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))
1195
1196 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1197 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
1198 INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
1199 #else
1200 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
1201 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
1202 #endif
1203
1204 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1205 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
1206 INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
1207 #else
1208 #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
1209 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
1210 #endif
1211
1212 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\
1213 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1214 CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
1215 template<typename TestType> \
1216 struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
1217 void test();\
1218 };\
1219 namespace {\
1220 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) {\
1221 INTERNAL_CATCH_TYPE_GEN \
1222 INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1223 template<typename...Types>\
1224 struct TestNameClass{\
1225 void reg_tests(){\
1226 int index = 0;\
1227 using expander = int[];\
1228 constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
1229 constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
1230 constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
1231 (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */ \
1232 }\
1233 };\
1234 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
1235 using TestInit = decltype(create<TestNameClass, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>(TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>{}));\
1236 TestInit t;\
1237 t.reg_tests();\
1238 return 0;\
1239 }(); \
1240 }\
1241 }\
1242 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1243 CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \
1244 template<typename TestType> \
1245 void TestName<TestType>::test()
1246
1247 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1248 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
1249 INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T, __VA_ARGS__ )
1250 #else
1251 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
1252 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) )
1253 #endif
1254
1255 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1256 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
1257 INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature, __VA_ARGS__ )
1258 #else
1259 #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
1260 INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) )
1261 #endif
1262
1263 #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \
1264 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1265 template<typename TestType> \
1266 struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
1267 void test();\
1268 };\
1269 namespace {\
1270 namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \
1271 INTERNAL_CATCH_TYPE_GEN\
1272 template<typename...Types>\
1273 struct TestNameClass{\
1274 void reg_tests(){\
1275 int index = 0;\
1276 using expander = int[];\
1277 (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */ \
1278 }\
1279 };\
1280 static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
1281 using TestInit = decltype(convert<TestNameClass>(TmplList {}));\
1282 TestInit t;\
1283 t.reg_tests();\
1284 return 0;\
1285 }(); \
1286 }}\
1287 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1288 template<typename TestType> \
1289 void TestName<TestType>::test()
1290
1291 #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \
1292 INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, TmplList )
1293
1294 // end catch_test_registry.h
1295 // start catch_capture.hpp
1296
1297 // start catch_assertionhandler.h
1298
1299 // start catch_assertioninfo.h
1300
1301 // start catch_result_type.h
1302
1303 namespace Catch {
1304
1305 // ResultWas::OfType enum
1306 struct ResultWas { enum OfType {
1307 Unknown = -1,
1308 Ok = 0,
1309 Info = 1,
1310 Warning = 2,
1311
1312 FailureBit = 0x10,
1313
1314 ExpressionFailed = FailureBit | 1,
1315 ExplicitFailure = FailureBit | 2,
1316
1317 Exception = 0x100 | FailureBit,
1318
1319 ThrewException = Exception | 1,
1320 DidntThrowException = Exception | 2,
1321
1322 FatalErrorCondition = 0x200 | FailureBit
1323
1324 }; };
1325
1326 bool isOk( ResultWas::OfType resultType );
1327 bool isJustInfo( int flags );
1328
1329 // ResultDisposition::Flags enum
1330 struct ResultDisposition { enum Flags {
1331 Normal = 0x01,
1332
1333 ContinueOnFailure = 0x02, // Failures fail test, but execution continues
1334 FalseTest = 0x04, // Prefix expression with !
1335 SuppressFail = 0x08 // Failures are reported but do not fail the test
1336 }; };
1337
1338 ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs );
1339
1340 bool shouldContinueOnFailure( int flags );
1341 inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }
1342 bool shouldSuppressFailure( int flags );
1343
1344 } // end namespace Catch
1345
1346 // end catch_result_type.h
1347 namespace Catch {
1348
1349 struct AssertionInfo
1350 {
1351 StringRef macroName;
1352 SourceLineInfo lineInfo;
1353 StringRef capturedExpression;
1354 ResultDisposition::Flags resultDisposition;
1355
1356 // We want to delete this constructor but a compiler bug in 4.8 means
1357 // the struct is then treated as non-aggregate
1358 //AssertionInfo() = delete;
1359 };
1360
1361 } // end namespace Catch
1362
1363 // end catch_assertioninfo.h
1364 // start catch_decomposer.h
1365
1366 // start catch_tostring.h
1367
1368 #include <vector>
1369 #include <cstddef>
1370 #include <type_traits>
1371 #include <string>
1372 // start catch_stream.h
1373
1374 #include <iosfwd>
1375 #include <cstddef>
1376 #include <ostream>
1377
1378 namespace Catch {
1379
1380 std::ostream& cout();
1381 std::ostream& cerr();
1382 std::ostream& clog();
1383
1384 class StringRef;
1385
1386 struct IStream {
1387 virtual ~IStream();
1388 virtual std::ostream& stream() const = 0;
1389 };
1390
1391 auto makeStream( StringRef const &filename ) -> IStream const*;
1392
1393 class ReusableStringStream {
1394 std::size_t m_index;
1395 std::ostream* m_oss;
1396 public:
1397 ReusableStringStream();
1398 ~ReusableStringStream();
1399
1400 auto str() const -> std::string;
1401
1402 template<typename T>
1403 auto operator << ( T const& value ) -> ReusableStringStream& {
1404 *m_oss << value;
1405 return *this;
1406 }
1407 auto get() -> std::ostream& { return *m_oss; }
1408 };
1409 }
1410
1411 // end catch_stream.h
1412 // start catch_interfaces_enum_values_registry.h
1413
1414 #include <vector>
1415
1416 namespace Catch {
1417
1418 namespace Detail {
1419 struct EnumInfo {
1420 StringRef m_name;
1421 std::vector<std::pair<int, std::string>> m_values;
1422
1423 ~EnumInfo();
1424
1425 StringRef lookup( int value ) const;
1426 };
1427 } // namespace Detail
1428
1429 struct IMutableEnumValuesRegistry {
1430 virtual ~IMutableEnumValuesRegistry();
1431
1432 virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0;
1433
1434 template<typename E>
1435 Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) {
1436 std::vector<int> intValues;
1437 intValues.reserve( values.size() );
1438 for( auto enumValue : values )
1439 intValues.push_back( static_cast<int>( enumValue ) );
1440 return registerEnum( enumName, allEnums, intValues );
1441 }
1442 };
1443
1444 } // Catch
1445
1446 // end catch_interfaces_enum_values_registry.h
1447
1448 #ifdef CATCH_CONFIG_CPP17_STRING_VIEW
1449 #include <string_view>
1450 #endif
1451
1452 #ifdef __OBJC__
1453 // start catch_objc_arc.hpp
1454
1455 #import <Foundation/Foundation.h>
1456
1457 #ifdef __has_feature
1458 #define CATCH_ARC_ENABLED __has_feature(objc_arc)
1459 #else
1460 #define CATCH_ARC_ENABLED 0
1461 #endif
1462
1463 void arcSafeRelease( NSObject* obj );
1464 id performOptionalSelector( id obj, SEL sel );
1465
1466 #if !CATCH_ARC_ENABLED
1467 inline void arcSafeRelease( NSObject* obj ) {
1468 [obj release];
1469 }
1470 inline id performOptionalSelector( id obj, SEL sel ) {
1471 if( [obj respondsToSelector: sel] )
1472 return [obj performSelector: sel];
1473 return nil;
1474 }
1475 #define CATCH_UNSAFE_UNRETAINED
1476 #define CATCH_ARC_STRONG
1477 #else
1478 inline void arcSafeRelease( NSObject* ){}
1479 inline id performOptionalSelector( id obj, SEL sel ) {
1480 #ifdef __clang__
1481 #pragma clang diagnostic push
1482 #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
1483 #endif
1484 if( [obj respondsToSelector: sel] )
1485 return [obj performSelector: sel];
1486 #ifdef __clang__
1487 #pragma clang diagnostic pop
1488 #endif
1489 return nil;
1490 }
1491 #define CATCH_UNSAFE_UNRETAINED __unsafe_unretained
1492 #define CATCH_ARC_STRONG __strong
1493 #endif
1494
1495 // end catch_objc_arc.hpp
1496 #endif
1497
1498 #ifdef _MSC_VER
1499 #pragma warning(push)
1500 #pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
1501 #endif
1502
1503 namespace Catch {
1504 namespace Detail {
1505
1506 extern const std::string unprintableString;
1507
1508 std::string rawMemoryToString( const void *object, std::size_t size );
1509
1510 template<typename T>
1511 std::string rawMemoryToString( const T& object ) {
1512 return rawMemoryToString( &object, sizeof(object) );
1513 }
1514
1515 template<typename T>
1516 class IsStreamInsertable {
1517 template<typename SS, typename TT>
1518 static auto test(int)
1519 -> decltype(std::declval<SS&>() << std::declval<TT>(), std::true_type());
1520
1521 template<typename, typename>
1522 static auto test(...)->std::false_type;
1523
1524 public:
1525 static const bool value = decltype(test<std::ostream, const T&>(0))::value;
1526 };
1527
1528 template<typename E>
1529 std::string convertUnknownEnumToString( E e );
1530
1531 template<typename T>
1532 typename std::enable_if<
1533 !std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value,
1534 std::string>::type convertUnstreamable( T const& ) {
1535 return Detail::unprintableString;
1536 }
1537 template<typename T>
1538 typename std::enable_if<
1539 !std::is_enum<T>::value && std::is_base_of<std::exception, T>::value,
1540 std::string>::type convertUnstreamable(T const& ex) {
1541 return ex.what();
1542 }
1543
1544 template<typename T>
1545 typename std::enable_if<
1546 std::is_enum<T>::value
1547 , std::string>::type convertUnstreamable( T const& value ) {
1548 return convertUnknownEnumToString( value );
1549 }
1550
1551 #if defined(_MANAGED)
1552 //! Convert a CLR string to a utf8 std::string
1553 template<typename T>
1554 std::string clrReferenceToString( T^ ref ) {
1555 if (ref == nullptr)
1556 return std::string("null");
1557 auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString());
1558 cli::pin_ptr<System::Byte> p = &bytes[0];
1559 return std::string(reinterpret_cast<char const *>(p), bytes->Length);
1560 }
1561 #endif
1562
1563 } // namespace Detail
1564
1565 // If we decide for C++14, change these to enable_if_ts
1566 template <typename T, typename = void>
1567 struct StringMaker {
1568 template <typename Fake = T>
1569 static
1570 typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
1571 convert(const Fake& value) {
1572 ReusableStringStream rss;
1573 // NB: call using the function-like syntax to avoid ambiguity with
1574 // user-defined templated operator<< under clang.
1575 rss.operator<<(value);
1576 return rss.str();
1577 }
1578
1579 template <typename Fake = T>
1580 static
1581 typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
1582 convert( const Fake& value ) {
1583 #if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)
1584 return Detail::convertUnstreamable(value);
1585 #else
1586 return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);
1587 #endif
1588 }
1589 };
1590
1591 namespace Detail {
1592
1593 // This function dispatches all stringification requests inside of Catch.
1594 // Should be preferably called fully qualified, like ::Catch::Detail::stringify
1595 template <typename T>
1596 std::string stringify(const T& e) {
1597 return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e);
1598 }
1599
1600 template<typename E>
1601 std::string convertUnknownEnumToString( E e ) {
1602 return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e));
1603 }
1604
1605 #if defined(_MANAGED)
1606 template <typename T>
1607 std::string stringify( T^ e ) {
1608 return ::Catch::StringMaker<T^>::convert(e);
1609 }
1610 #endif
1611
1612 } // namespace Detail
1613
1614 // Some predefined specializations
1615
1616 template<>
1617 struct StringMaker<std::string> {
1618 static std::string convert(const std::string& str);
1619 };
1620
1621 #ifdef CATCH_CONFIG_CPP17_STRING_VIEW
1622 template<>
1623 struct StringMaker<std::string_view> {
1624 static std::string convert(std::string_view str);
1625 };
1626 #endif
1627
1628 template<>
1629 struct StringMaker<char const *> {
1630 static std::string convert(char const * str);
1631 };
1632 template<>
1633 struct StringMaker<char *> {
1634 static std::string convert(char * str);
1635 };
1636
1637 #ifdef CATCH_CONFIG_WCHAR
1638 template<>
1639 struct StringMaker<std::wstring> {
1640 static std::string convert(const std::wstring& wstr);
1641 };
1642
1643 # ifdef CATCH_CONFIG_CPP17_STRING_VIEW
1644 template<>
1645 struct StringMaker<std::wstring_view> {
1646 static std::string convert(std::wstring_view str);
1647 };
1648 # endif
1649
1650 template<>
1651 struct StringMaker<wchar_t const *> {
1652 static std::string convert(wchar_t const * str);
1653 };
1654 template<>
1655 struct StringMaker<wchar_t *> {
1656 static std::string convert(wchar_t * str);
1657 };
1658 #endif
1659
1660 // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer,
1661 // while keeping string semantics?
1662 template<int SZ>
1663 struct StringMaker<char[SZ]> {
1664 static std::string convert(char const* str) {
1665 return ::Catch::Detail::stringify(std::string{ str });
1666 }
1667 };
1668 template<int SZ>
1669 struct StringMaker<signed char[SZ]> {
1670 static std::string convert(signed char const* str) {
1671 return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) });
1672 }
1673 };
1674 template<int SZ>
1675 struct StringMaker<unsigned char[SZ]> {
1676 static std::string convert(unsigned char const* str) {
1677 return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) });
1678 }
1679 };
1680
1681 template<>
1682 struct StringMaker<int> {
1683 static std::string convert(int value);
1684 };
1685 template<>
1686 struct StringMaker<long> {
1687 static std::string convert(long value);
1688 };
1689 template<>
1690 struct StringMaker<long long> {
1691 static std::string convert(long long value);
1692 };
1693 template<>
1694 struct StringMaker<unsigned int> {
1695 static std::string convert(unsigned int value);
1696 };
1697 template<>
1698 struct StringMaker<unsigned long> {
1699 static std::string convert(unsigned long value);
1700 };
1701 template<>
1702 struct StringMaker<unsigned long long> {
1703 static std::string convert(unsigned long long value);
1704 };
1705
1706 template<>
1707 struct StringMaker<bool> {
1708 static std::string convert(bool b);
1709 };
1710
1711 template<>
1712 struct StringMaker<char> {
1713 static std::string convert(char c);
1714 };
1715 template<>
1716 struct StringMaker<signed char> {
1717 static std::string convert(signed char c);
1718 };
1719 template<>
1720 struct StringMaker<unsigned char> {
1721 static std::string convert(unsigned char c);
1722 };
1723
1724 template<>
1725 struct StringMaker<std::nullptr_t> {
1726 static std::string convert(std::nullptr_t);
1727 };
1728
1729 template<>
1730 struct StringMaker<float> {
1731 static std::string convert(float value);
1732 static int precision;
1733 };
1734
1735 template<>
1736 struct StringMaker<double> {
1737 static std::string convert(double value);
1738 static int precision;
1739 };
1740
1741 template <typename T>
1742 struct StringMaker<T*> {
1743 template <typename U>
1744 static std::string convert(U* p) {
1745 if (p) {
1746 return ::Catch::Detail::rawMemoryToString(p);
1747 } else {
1748 return "nullptr";
1749 }
1750 }
1751 };
1752
1753 template <typename R, typename C>
1754 struct StringMaker<R C::*> {
1755 static std::string convert(R C::* p) {
1756 if (p) {
1757 return ::Catch::Detail::rawMemoryToString(p);
1758 } else {
1759 return "nullptr";
1760 }
1761 }
1762 };
1763
1764 #if defined(_MANAGED)
1765 template <typename T>
1766 struct StringMaker<T^> {
1767 static std::string convert( T^ ref ) {
1768 return ::Catch::Detail::clrReferenceToString(ref);
1769 }
1770 };
1771 #endif
1772
1773 namespace Detail {
1774 template<typename InputIterator>
1775 std::string rangeToString(InputIterator first, InputIterator last) {
1776 ReusableStringStream rss;
1777 rss << "{ ";
1778 if (first != last) {
1779 rss << ::Catch::Detail::stringify(*first);
1780 for (++first; first != last; ++first)
1781 rss << ", " << ::Catch::Detail::stringify(*first);
1782 }
1783 rss << " }";
1784 return rss.str();
1785 }
1786 }
1787
1788 #ifdef __OBJC__
1789 template<>
1790 struct StringMaker<NSString*> {
1791 static std::string convert(NSString * nsstring) {
1792 if (!nsstring)
1793 return "nil";
1794 return std::string("@") + [nsstring UTF8String];
1795 }
1796 };
1797 template<>
1798 struct StringMaker<NSObject*> {
1799 static std::string convert(NSObject* nsObject) {
1800 return ::Catch::Detail::stringify([nsObject description]);
1801 }
1802
1803 };
1804 namespace Detail {
1805 inline std::string stringify( NSString* nsstring ) {
1806 return StringMaker<NSString*>::convert( nsstring );
1807 }
1808
1809 } // namespace Detail
1810 #endif // __OBJC__
1811
1812 } // namespace Catch
1813
1814 //////////////////////////////////////////////////////
1815 // Separate std-lib types stringification, so it can be selectively enabled
1816 // This means that we do not bring in
1817
1818 #if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS)
1819 # define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
1820 # define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
1821 # define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
1822 # define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
1823 # define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER
1824 #endif
1825
1826 // Separate std::pair specialization
1827 #if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER)
1828 #include <utility>
1829 namespace Catch {
1830 template<typename T1, typename T2>
1831 struct StringMaker<std::pair<T1, T2> > {
1832 static std::string convert(const std::pair<T1, T2>& pair) {
1833 ReusableStringStream rss;
1834 rss << "{ "
1835 << ::Catch::Detail::stringify(pair.first)
1836 << ", "
1837 << ::Catch::Detail::stringify(pair.second)
1838 << " }";
1839 return rss.str();
1840 }
1841 };
1842 }
1843 #endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
1844
1845 #if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL)
1846 #include <optional>
1847 namespace Catch {
1848 template<typename T>
1849 struct StringMaker<std::optional<T> > {
1850 static std::string convert(const std::optional<T>& optional) {
1851 ReusableStringStream rss;
1852 if (optional.has_value()) {
1853 rss << ::Catch::Detail::stringify(*optional);
1854 } else {
1855 rss << "{ }";
1856 }
1857 return rss.str();
1858 }
1859 };
1860 }
1861 #endif // CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER
1862
1863 // Separate std::tuple specialization
1864 #if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER)
1865 #include <tuple>
1866 namespace Catch {
1867 namespace Detail {
1868 template<
1869 typename Tuple,
1870 std::size_t N = 0,
1871 bool = (N < std::tuple_size<Tuple>::value)
1872 >
1873 struct TupleElementPrinter {
1874 static void print(const Tuple& tuple, std::ostream& os) {
1875 os << (N ? ", " : " ")
1876 << ::Catch::Detail::stringify(std::get<N>(tuple));
1877 TupleElementPrinter<Tuple, N + 1>::print(tuple, os);
1878 }
1879 };
1880
1881 template<
1882 typename Tuple,
1883 std::size_t N
1884 >
1885 struct TupleElementPrinter<Tuple, N, false> {
1886 static void print(const Tuple&, std::ostream&) {}
1887 };
1888
1889 }
1890
1891 template<typename ...Types>
1892 struct StringMaker<std::tuple<Types...>> {
1893 static std::string convert(const std::tuple<Types...>& tuple) {
1894 ReusableStringStream rss;
1895 rss << '{';
1896 Detail::TupleElementPrinter<std::tuple<Types...>>::print(tuple, rss.get());
1897 rss << " }";
1898 return rss.str();
1899 }
1900 };
1901 }
1902 #endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
1903
1904 #if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT)
1905 #include <variant>
1906 namespace Catch {
1907 template<>
1908 struct StringMaker<std::monostate> {
1909 static std::string convert(const std::monostate&) {
1910 return "{ }";
1911 }
1912 };
1913
1914 template<typename... Elements>
1915 struct StringMaker<std::variant<Elements...>> {
1916 static std::string convert(const std::variant<Elements...>& variant) {
1917 if (variant.valueless_by_exception()) {
1918 return "{valueless variant}";
1919 } else {
1920 return std::visit(
1921 [](const auto& value) {
1922 return ::Catch::Detail::stringify(value);
1923 },
1924 variant
1925 );
1926 }
1927 }
1928 };
1929 }
1930 #endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
1931
1932 namespace Catch {
1933 struct not_this_one {}; // Tag type for detecting which begin/ end are being selected
1934
1935 // Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace
1936 using std::begin;
1937 using std::end;
1938
1939 not_this_one begin( ... );
1940 not_this_one end( ... );
1941
1942 template <typename T>
1943 struct is_range {
1944 static const bool value =
1945 !std::is_same<decltype(begin(std::declval<T>())), not_this_one>::value &&
1946 !std::is_same<decltype(end(std::declval<T>())), not_this_one>::value;
1947 };
1948
1949 #if defined(_MANAGED) // Managed types are never ranges
1950 template <typename T>
1951 struct is_range<T^> {
1952 static const bool value = false;
1953 };
1954 #endif
1955
1956 template<typename Range>
1957 std::string rangeToString( Range const& range ) {
1958 return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
1959 }
1960
1961 // Handle vector<bool> specially
1962 template<typename Allocator>
1963 std::string rangeToString( std::vector<bool, Allocator> const& v ) {
1964 ReusableStringStream rss;
1965 rss << "{ ";
1966 bool first = true;
1967 for( bool b : v ) {
1968 if( first )
1969 first = false;
1970 else
1971 rss << ", ";
1972 rss << ::Catch::Detail::stringify( b );
1973 }
1974 rss << " }";
1975 return rss.str();
1976 }
1977
1978 template<typename R>
1979 struct StringMaker<R, typename std::enable_if<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>::type> {
1980 static std::string convert( R const& range ) {
1981 return rangeToString( range );
1982 }
1983 };
1984
1985 template <typename T, int SZ>
1986 struct StringMaker<T[SZ]> {
1987 static std::string convert(T const(&arr)[SZ]) {
1988 return rangeToString(arr);
1989 }
1990 };
1991
1992 } // namespace Catch
1993
1994 // Separate std::chrono::duration specialization
1995 #if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
1996 #include <ctime>
1997 #include <ratio>
1998 #include <chrono>
1999
2000 namespace Catch {
2001
2002 template <class Ratio>
2003 struct ratio_string {
2004 static std::string symbol();
2005 };
2006
2007 template <class Ratio>
2008 std::string ratio_string<Ratio>::symbol() {
2009 Catch::ReusableStringStream rss;
2010 rss << '[' << Ratio::num << '/'
2011 << Ratio::den << ']';
2012 return rss.str();
2013 }
2014 template <>
2015 struct ratio_string<std::atto> {
2016 static std::string symbol();
2017 };
2018 template <>
2019 struct ratio_string<std::femto> {
2020 static std::string symbol();
2021 };
2022 template <>
2023 struct ratio_string<std::pico> {
2024 static std::string symbol();
2025 };
2026 template <>
2027 struct ratio_string<std::nano> {
2028 static std::string symbol();
2029 };
2030 template <>
2031 struct ratio_string<std::micro> {
2032 static std::string symbol();
2033 };
2034 template <>
2035 struct ratio_string<std::milli> {
2036 static std::string symbol();
2037 };
2038
2039 ////////////
2040 // std::chrono::duration specializations
2041 template<typename Value, typename Ratio>
2042 struct StringMaker<std::chrono::duration<Value, Ratio>> {
2043 static std::string convert(std::chrono::duration<Value, Ratio> const& duration) {
2044 ReusableStringStream rss;
2045 rss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's';
2046 return rss.str();
2047 }
2048 };
2049 template<typename Value>
2050 struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> {
2051 static std::string convert(std::chrono::duration<Value, std::ratio<1>> const& duration) {
2052 ReusableStringStream rss;
2053 rss << duration.count() << " s";
2054 return rss.str();
2055 }
2056 };
2057 template<typename Value>
2058 struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> {
2059 static std::string convert(std::chrono::duration<Value, std::ratio<60>> const& duration) {
2060 ReusableStringStream rss;
2061 rss << duration.count() << " m";
2062 return rss.str();
2063 }
2064 };
2065 template<typename Value>
2066 struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> {
2067 static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const& duration) {
2068 ReusableStringStream rss;
2069 rss << duration.count() << " h";
2070 return rss.str();
2071 }
2072 };
2073
2074 ////////////
2075 // std::chrono::time_point specialization
2076 // Generic time_point cannot be specialized, only std::chrono::time_point<system_clock>
2077 template<typename Clock, typename Duration>
2078 struct StringMaker<std::chrono::time_point<Clock, Duration>> {
2079 static std::string convert(std::chrono::time_point<Clock, Duration> const& time_point) {
2080 return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch";
2081 }
2082 };
2083 // std::chrono::time_point<system_clock> specialization
2084 template<typename Duration>
2085 struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {
2086 static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {
2087 auto converted = std::chrono::system_clock::to_time_t(time_point);
2088
2089 #ifdef _MSC_VER
2090 std::tm timeInfo = {};
2091 gmtime_s(&timeInfo, &converted);
2092 #else
2093 std::tm* timeInfo = std::gmtime(&converted);
2094 #endif
2095
2096 auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
2097 char timeStamp[timeStampSize];
2098 const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
2099
2100 #ifdef _MSC_VER
2101 std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
2102 #else
2103 std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
2104 #endif
2105 return std::string(timeStamp);
2106 }
2107 };
2108 }
2109 #endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
2110
2111 #define INTERNAL_CATCH_REGISTER_ENUM( enumName, ... ) \
2112 namespace Catch { \
2113 template<> struct StringMaker<enumName> { \
2114 static std::string convert( enumName value ) { \
2115 static const auto& enumInfo = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum( #enumName, #__VA_ARGS__, { __VA_ARGS__ } ); \
2116 return enumInfo.lookup( static_cast<int>( value ) ); \
2117 } \
2118 }; \
2119 }
2120
2121 #define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ )
2122
2123 #ifdef _MSC_VER
2124 #pragma warning(pop)
2125 #endif
2126
2127 // end catch_tostring.h
2128 #include <iosfwd>
2129
2130 #ifdef _MSC_VER
2131 #pragma warning(push)
2132 #pragma warning(disable:4389) // '==' : signed/unsigned mismatch
2133 #pragma warning(disable:4018) // more "signed/unsigned mismatch"
2134 #pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)
2135 #pragma warning(disable:4180) // qualifier applied to function type has no meaning
2136 #pragma warning(disable:4800) // Forcing result to true or false
2137 #endif
2138
2139 namespace Catch {
2140
2141 struct ITransientExpression {
2142 auto isBinaryExpression() const -> bool { return m_isBinaryExpression; }
2143 auto getResult() const -> bool { return m_result; }
2144 virtual void streamReconstructedExpression( std::ostream &os ) const = 0;
2145
2146 ITransientExpression( bool isBinaryExpression, bool result )
2147 : m_isBinaryExpression( isBinaryExpression ),
2148 m_result( result )
2149 {}
2150
2151 // We don't actually need a virtual destructor, but many static analysers
2152 // complain if it's not here :-(
2153 virtual ~ITransientExpression();
2154
2155 bool m_isBinaryExpression;
2156 bool m_result;
2157
2158 };
2159
2160 void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );
2161
2162 template<typename LhsT, typename RhsT>
2163 class BinaryExpr : public ITransientExpression {
2164 LhsT m_lhs;
2165 StringRef m_op;
2166 RhsT m_rhs;
2167
2168 void streamReconstructedExpression( std::ostream &os ) const override {
2169 formatReconstructedExpression
2170 ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) );
2171 }
2172
2173 public:
2174 BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )
2175 : ITransientExpression{ true, comparisonResult },
2176 m_lhs( lhs ),
2177 m_op( op ),
2178 m_rhs( rhs )
2179 {}
2180
2181 template<typename T>
2182 auto operator && ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2183 static_assert(always_false<T>::value,
2184 "chained comparisons are not supported inside assertions, "
2185 "wrap the expression inside parentheses, or decompose it");
2186 }
2187
2188 template<typename T>
2189 auto operator || ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2190 static_assert(always_false<T>::value,
2191 "chained comparisons are not supported inside assertions, "
2192 "wrap the expression inside parentheses, or decompose it");
2193 }
2194
2195 template<typename T>
2196 auto operator == ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2197 static_assert(always_false<T>::value,
2198 "chained comparisons are not supported inside assertions, "
2199 "wrap the expression inside parentheses, or decompose it");
2200 }
2201
2202 template<typename T>
2203 auto operator != ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2204 static_assert(always_false<T>::value,
2205 "chained comparisons are not supported inside assertions, "
2206 "wrap the expression inside parentheses, or decompose it");
2207 }
2208
2209 template<typename T>
2210 auto operator > ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2211 static_assert(always_false<T>::value,
2212 "chained comparisons are not supported inside assertions, "
2213 "wrap the expression inside parentheses, or decompose it");
2214 }
2215
2216 template<typename T>
2217 auto operator < ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2218 static_assert(always_false<T>::value,
2219 "chained comparisons are not supported inside assertions, "
2220 "wrap the expression inside parentheses, or decompose it");
2221 }
2222
2223 template<typename T>
2224 auto operator >= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2225 static_assert(always_false<T>::value,
2226 "chained comparisons are not supported inside assertions, "
2227 "wrap the expression inside parentheses, or decompose it");
2228 }
2229
2230 template<typename T>
2231 auto operator <= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2232 static_assert(always_false<T>::value,
2233 "chained comparisons are not supported inside assertions, "
2234 "wrap the expression inside parentheses, or decompose it");
2235 }
2236 };
2237
2238 template<typename LhsT>
2239 class UnaryExpr : public ITransientExpression {
2240 LhsT m_lhs;
2241
2242 void streamReconstructedExpression( std::ostream &os ) const override {
2243 os << Catch::Detail::stringify( m_lhs );
2244 }
2245
2246 public:
2247 explicit UnaryExpr( LhsT lhs )
2248 : ITransientExpression{ false, static_cast<bool>(lhs) },
2249 m_lhs( lhs )
2250 {}
2251 };
2252
2253 // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
2254 template<typename LhsT, typename RhsT>
2255 auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); }
2256 template<typename T>
2257 auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
2258 template<typename T>
2259 auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
2260 template<typename T>
2261 auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
2262 template<typename T>
2263 auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
2264
2265 template<typename LhsT, typename RhsT>
2266 auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); }
2267 template<typename T>
2268 auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
2269 template<typename T>
2270 auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
2271 template<typename T>
2272 auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
2273 template<typename T>
2274 auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
2275
2276 template<typename LhsT>
2277 class ExprLhs {
2278 LhsT m_lhs;
2279 public:
2280 explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}
2281
2282 template<typename RhsT>
2283 auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2284 return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs };
2285 }
2286 auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
2287 return { m_lhs == rhs, m_lhs, "==", rhs };
2288 }
2289
2290 template<typename RhsT>
2291 auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2292 return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs };
2293 }
2294 auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
2295 return { m_lhs != rhs, m_lhs, "!=", rhs };
2296 }
2297
2298 template<typename RhsT>
2299 auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2300 return { static_cast<bool>(m_lhs > rhs), m_lhs, ">", rhs };
2301 }
2302 template<typename RhsT>
2303 auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2304 return { static_cast<bool>(m_lhs < rhs), m_lhs, "<", rhs };
2305 }
2306 template<typename RhsT>
2307 auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2308 return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">=", rhs };
2309 }
2310 template<typename RhsT>
2311 auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2312 return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs };
2313 }
2314
2315 template<typename RhsT>
2316 auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {
2317 static_assert(always_false<RhsT>::value,
2318 "operator&& is not supported inside assertions, "
2319 "wrap the expression inside parentheses, or decompose it");
2320 }
2321
2322 template<typename RhsT>
2323 auto operator || ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {
2324 static_assert(always_false<RhsT>::value,
2325 "operator|| is not supported inside assertions, "
2326 "wrap the expression inside parentheses, or decompose it");
2327 }
2328
2329 auto makeUnaryExpr() const -> UnaryExpr<LhsT> {
2330 return UnaryExpr<LhsT>{ m_lhs };
2331 }
2332 };
2333
2334 void handleExpression( ITransientExpression const& expr );
2335
2336 template<typename T>
2337 void handleExpression( ExprLhs<T> const& expr ) {
2338 handleExpression( expr.makeUnaryExpr() );
2339 }
2340
2341 struct Decomposer {
2342 template<typename T>
2343 auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {
2344 return ExprLhs<T const&>{ lhs };
2345 }
2346
2347 auto operator <=( bool value ) -> ExprLhs<bool> {
2348 return ExprLhs<bool>{ value };
2349 }
2350 };
2351
2352 } // end namespace Catch
2353
2354 #ifdef _MSC_VER
2355 #pragma warning(pop)
2356 #endif
2357
2358 // end catch_decomposer.h
2359 // start catch_interfaces_capture.h
2360
2361 #include <string>
2362 #include <chrono>
2363
2364 namespace Catch {
2365
2366 class AssertionResult;
2367 struct AssertionInfo;
2368 struct SectionInfo;
2369 struct SectionEndInfo;
2370 struct MessageInfo;
2371 struct MessageBuilder;
2372 struct Counts;
2373 struct AssertionReaction;
2374 struct SourceLineInfo;
2375
2376 struct ITransientExpression;
2377 struct IGeneratorTracker;
2378
2379 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
2380 struct BenchmarkInfo;
2381 template <typename Duration = std::chrono::duration<double, std::nano>>
2382 struct BenchmarkStats;
2383 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
2384
2385 struct IResultCapture {
2386
2387 virtual ~IResultCapture();
2388
2389 virtual bool sectionStarted( SectionInfo const& sectionInfo,
2390 Counts& assertions ) = 0;
2391 virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
2392 virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
2393
2394 virtual auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
2395
2396 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
2397 virtual void benchmarkPreparing( std::string const& name ) = 0;
2398 virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;
2399 virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0;
2400 virtual void benchmarkFailed( std::string const& error ) = 0;
2401 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
2402
2403 virtual void pushScopedMessage( MessageInfo const& message ) = 0;
2404 virtual void popScopedMessage( MessageInfo const& message ) = 0;
2405
2406 virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 0;
2407
2408 virtual void handleFatalErrorCondition( StringRef message ) = 0;
2409
2410 virtual void handleExpr
2411 ( AssertionInfo const& info,
2412 ITransientExpression const& expr,
2413 AssertionReaction& reaction ) = 0;
2414 virtual void handleMessage
2415 ( AssertionInfo const& info,
2416 ResultWas::OfType resultType,
2417 StringRef const& message,
2418 AssertionReaction& reaction ) = 0;
2419 virtual void handleUnexpectedExceptionNotThrown
2420 ( AssertionInfo const& info,
2421 AssertionReaction& reaction ) = 0;
2422 virtual void handleUnexpectedInflightException
2423 ( AssertionInfo const& info,
2424 std::string const& message,
2425 AssertionReaction& reaction ) = 0;
2426 virtual void handleIncomplete
2427 ( AssertionInfo const& info ) = 0;
2428 virtual void handleNonExpr
2429 ( AssertionInfo const &info,
2430 ResultWas::OfType resultType,
2431 AssertionReaction &reaction ) = 0;
2432
2433 virtual bool lastAssertionPassed() = 0;
2434 virtual void assertionPassed() = 0;
2435
2436 // Deprecated, do not use:
2437 virtual std::string getCurrentTestName() const = 0;
2438 virtual const AssertionResult* getLastResult() const = 0;
2439 virtual void exceptionEarlyReported() = 0;
2440 };
2441
2442 IResultCapture& getResultCapture();
2443 }
2444
2445 // end catch_interfaces_capture.h
2446 namespace Catch {
2447
2448 struct TestFailureException{};
2449 struct AssertionResultData;
2450 struct IResultCapture;
2451 class RunContext;
2452
2453 class LazyExpression {
2454 friend class AssertionHandler;
2455 friend struct AssertionStats;
2456 friend class RunContext;
2457
2458 ITransientExpression const* m_transientExpression = nullptr;
2459 bool m_isNegated;
2460 public:
2461 LazyExpression( bool isNegated );
2462 LazyExpression( LazyExpression const& other );
2463 LazyExpression& operator = ( LazyExpression const& ) = delete;
2464
2465 explicit operator bool() const;
2466
2467 friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&;
2468 };
2469
2470 struct AssertionReaction {
2471 bool shouldDebugBreak = false;
2472 bool shouldThrow = false;
2473 };
2474
2475 class AssertionHandler {
2476 AssertionInfo m_assertionInfo;
2477 AssertionReaction m_reaction;
2478 bool m_completed = false;
2479 IResultCapture& m_resultCapture;
2480
2481 public:
2482 AssertionHandler
2483 ( StringRef const& macroName,
2484 SourceLineInfo const& lineInfo,
2485 StringRef capturedExpression,
2486 ResultDisposition::Flags resultDisposition );
2487 ~AssertionHandler() {
2488 if ( !m_completed ) {
2489 m_resultCapture.handleIncomplete( m_assertionInfo );
2490 }
2491 }
2492
2493 template<typename T>
2494 void handleExpr( ExprLhs<T> const& expr ) {
2495 handleExpr( expr.makeUnaryExpr() );
2496 }
2497 void handleExpr( ITransientExpression const& expr );
2498
2499 void handleMessage(ResultWas::OfType resultType, StringRef const& message);
2500
2501 void handleExceptionThrownAsExpected();
2502 void handleUnexpectedExceptionNotThrown();
2503 void handleExceptionNotThrownAsExpected();
2504 void handleThrowingCallSkipped();
2505 void handleUnexpectedInflightException();
2506
2507 void complete();
2508 void setCompleted();
2509
2510 // query
2511 auto allowThrows() const -> bool;
2512 };
2513
2514 void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString );
2515
2516 } // namespace Catch
2517
2518 // end catch_assertionhandler.h
2519 // start catch_message.h
2520
2521 #include <string>
2522 #include <vector>
2523
2524 namespace Catch {
2525
2526 struct MessageInfo {
2527 MessageInfo( StringRef const& _macroName,
2528 SourceLineInfo const& _lineInfo,
2529 ResultWas::OfType _type );
2530
2531 StringRef macroName;
2532 std::string message;
2533 SourceLineInfo lineInfo;
2534 ResultWas::OfType type;
2535 unsigned int sequence;
2536
2537 bool operator == ( MessageInfo const& other ) const;
2538 bool operator < ( MessageInfo const& other ) const;
2539 private:
2540 static unsigned int globalCount;
2541 };
2542
2543 struct MessageStream {
2544
2545 template<typename T>
2546 MessageStream& operator << ( T const& value ) {
2547 m_stream << value;
2548 return *this;
2549 }
2550
2551 ReusableStringStream m_stream;
2552 };
2553
2554 struct MessageBuilder : MessageStream {
2555 MessageBuilder( StringRef const& macroName,
2556 SourceLineInfo const& lineInfo,
2557 ResultWas::OfType type );
2558
2559 template<typename T>
2560 MessageBuilder& operator << ( T const& value ) {
2561 m_stream << value;
2562 return *this;
2563 }
2564
2565 MessageInfo m_info;
2566 };
2567
2568 class ScopedMessage {
2569 public:
2570 explicit ScopedMessage( MessageBuilder const& builder );
2571 ScopedMessage( ScopedMessage& duplicate ) = delete;
2572 ScopedMessage( ScopedMessage&& old );
2573 ~ScopedMessage();
2574
2575 MessageInfo m_info;
2576 bool m_moved;
2577 };
2578
2579 class Capturer {
2580 std::vector<MessageInfo> m_messages;
2581 IResultCapture& m_resultCapture = getResultCapture();
2582 size_t m_captured = 0;
2583 public:
2584 Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names );
2585 ~Capturer();
2586
2587 void captureValue( size_t index, std::string const& value );
2588
2589 template<typename T>
2590 void captureValues( size_t index, T const& value ) {
2591 captureValue( index, Catch::Detail::stringify( value ) );
2592 }
2593
2594 template<typename T, typename... Ts>
2595 void captureValues( size_t index, T const& value, Ts const&... values ) {
2596 captureValue( index, Catch::Detail::stringify(value) );
2597 captureValues( index+1, values... );
2598 }
2599 };
2600
2601 } // end namespace Catch
2602
2603 // end catch_message.h
2604 #if !defined(CATCH_CONFIG_DISABLE)
2605
2606 #if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
2607 #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__
2608 #else
2609 #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"
2610 #endif
2611
2612 #if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
2613
2614 ///////////////////////////////////////////////////////////////////////////////
2615 // Another way to speed-up compilation is to omit local try-catch for REQUIRE*
2616 // macros.
2617 #define INTERNAL_CATCH_TRY
2618 #define INTERNAL_CATCH_CATCH( capturer )
2619
2620 #else // CATCH_CONFIG_FAST_COMPILE
2621
2622 #define INTERNAL_CATCH_TRY try
2623 #define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); }
2624
2625 #endif
2626
2627 #define INTERNAL_CATCH_REACT( handler ) handler.complete();
2628
2629 ///////////////////////////////////////////////////////////////////////////////
2630 #define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \
2631 do { \
2632 Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
2633 INTERNAL_CATCH_TRY { \
2634 CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
2635 catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \
2636 CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
2637 } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
2638 INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2639 } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
2640 // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
2641
2642 ///////////////////////////////////////////////////////////////////////////////
2643 #define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \
2644 INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \
2645 if( Catch::getResultCapture().lastAssertionPassed() )
2646
2647 ///////////////////////////////////////////////////////////////////////////////
2648 #define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \
2649 INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \
2650 if( !Catch::getResultCapture().lastAssertionPassed() )
2651
2652 ///////////////////////////////////////////////////////////////////////////////
2653 #define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \
2654 do { \
2655 Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
2656 try { \
2657 static_cast<void>(__VA_ARGS__); \
2658 catchAssertionHandler.handleExceptionNotThrownAsExpected(); \
2659 } \
2660 catch( ... ) { \
2661 catchAssertionHandler.handleUnexpectedInflightException(); \
2662 } \
2663 INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2664 } while( false )
2665
2666 ///////////////////////////////////////////////////////////////////////////////
2667 #define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \
2668 do { \
2669 Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \
2670 if( catchAssertionHandler.allowThrows() ) \
2671 try { \
2672 static_cast<void>(__VA_ARGS__); \
2673 catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
2674 } \
2675 catch( ... ) { \
2676 catchAssertionHandler.handleExceptionThrownAsExpected(); \
2677 } \
2678 else \
2679 catchAssertionHandler.handleThrowingCallSkipped(); \
2680 INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2681 } while( false )
2682
2683 ///////////////////////////////////////////////////////////////////////////////
2684 #define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \
2685 do { \
2686 Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \
2687 if( catchAssertionHandler.allowThrows() ) \
2688 try { \
2689 static_cast<void>(expr); \
2690 catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
2691 } \
2692 catch( exceptionType const& ) { \
2693 catchAssertionHandler.handleExceptionThrownAsExpected(); \
2694 } \
2695 catch( ... ) { \
2696 catchAssertionHandler.handleUnexpectedInflightException(); \
2697 } \
2698 else \
2699 catchAssertionHandler.handleThrowingCallSkipped(); \
2700 INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2701 } while( false )
2702
2703 ///////////////////////////////////////////////////////////////////////////////
2704 #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \
2705 do { \
2706 Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \
2707 catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \
2708 INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2709 } while( false )
2710
2711 ///////////////////////////////////////////////////////////////////////////////
2712 #define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \
2713 auto varName = Catch::Capturer( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \
2714 varName.captureValues( 0, __VA_ARGS__ )
2715
2716 ///////////////////////////////////////////////////////////////////////////////
2717 #define INTERNAL_CATCH_INFO( macroName, log ) \
2718 Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log );
2719
2720 ///////////////////////////////////////////////////////////////////////////////
2721 #define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \
2722 Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
2723
2724 ///////////////////////////////////////////////////////////////////////////////
2725 // Although this is matcher-based, it can be used with just a string
2726 #define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \
2727 do { \
2728 Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
2729 if( catchAssertionHandler.allowThrows() ) \
2730 try { \
2731 static_cast<void>(__VA_ARGS__); \
2732 catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
2733 } \
2734 catch( ... ) { \
2735 Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher##_catch_sr ); \
2736 } \
2737 else \
2738 catchAssertionHandler.handleThrowingCallSkipped(); \
2739 INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2740 } while( false )
2741
2742 #endif // CATCH_CONFIG_DISABLE
2743
2744 // end catch_capture.hpp
2745 // start catch_section.h
2746
2747 // start catch_section_info.h
2748
2749 // start catch_totals.h
2750
2751 #include <cstddef>
2752
2753 namespace Catch {
2754
2755 struct Counts {
2756 Counts operator - ( Counts const& other ) const;
2757 Counts& operator += ( Counts const& other );
2758
2759 std::size_t total() const;
2760 bool allPassed() const;
2761 bool allOk() const;
2762
2763 std::size_t passed = 0;
2764 std::size_t failed = 0;
2765 std::size_t failedButOk = 0;
2766 };
2767
2768 struct Totals {
2769
2770 Totals operator - ( Totals const& other ) const;
2771 Totals& operator += ( Totals const& other );
2772
2773 Totals delta( Totals const& prevTotals ) const;
2774
2775 int error = 0;
2776 Counts assertions;
2777 Counts testCases;
2778 };
2779 }
2780
2781 // end catch_totals.h
2782 #include <string>
2783
2784 namespace Catch {
2785
2786 struct SectionInfo {
2787 SectionInfo
2788 ( SourceLineInfo const& _lineInfo,
2789 std::string const& _name );
2790
2791 // Deprecated
2792 SectionInfo
2793 ( SourceLineInfo const& _lineInfo,
2794 std::string const& _name,
2795 std::string const& ) : SectionInfo( _lineInfo, _name ) {}
2796
2797 std::string name;
2798 std::string description; // !Deprecated: this will always be empty
2799 SourceLineInfo lineInfo;
2800 };
2801
2802 struct SectionEndInfo {
2803 SectionInfo sectionInfo;
2804 Counts prevAssertions;
2805 double durationInSeconds;
2806 };
2807
2808 } // end namespace Catch
2809
2810 // end catch_section_info.h
2811 // start catch_timer.h
2812
2813 #include <cstdint>
2814
2815 namespace Catch {
2816
2817 auto getCurrentNanosecondsSinceEpoch() -> uint64_t;
2818 auto getEstimatedClockResolution() -> uint64_t;
2819
2820 class Timer {
2821 uint64_t m_nanoseconds = 0;
2822 public:
2823 void start();
2824 auto getElapsedNanoseconds() const -> uint64_t;
2825 auto getElapsedMicroseconds() const -> uint64_t;
2826 auto getElapsedMilliseconds() const -> unsigned int;
2827 auto getElapsedSeconds() const -> double;
2828 };
2829
2830 } // namespace Catch
2831
2832 // end catch_timer.h
2833 #include <string>
2834
2835 namespace Catch {
2836
2837 class Section : NonCopyable {
2838 public:
2839 Section( SectionInfo const& info );
2840 ~Section();
2841
2842 // This indicates whether the section should be executed or not
2843 explicit operator bool() const;
2844
2845 private:
2846 SectionInfo m_info;
2847
2848 std::string m_name;
2849 Counts m_assertions;
2850 bool m_sectionIncluded;
2851 Timer m_timer;
2852 };
2853
2854 } // end namespace Catch
2855
2856 #define INTERNAL_CATCH_SECTION( ... ) \
2857 CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
2858 if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \
2859 CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS
2860
2861 #define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \
2862 CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
2863 if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \
2864 CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS
2865
2866 // end catch_section.h
2867 // start catch_interfaces_exception.h
2868
2869 // start catch_interfaces_registry_hub.h
2870
2871 #include <string>
2872 #include <memory>
2873
2874 namespace Catch {
2875
2876 class TestCase;
2877 struct ITestCaseRegistry;
2878 struct IExceptionTranslatorRegistry;
2879 struct IExceptionTranslator;
2880 struct IReporterRegistry;
2881 struct IReporterFactory;
2882 struct ITagAliasRegistry;
2883 struct IMutableEnumValuesRegistry;
2884
2885 class StartupExceptionRegistry;
2886
2887 using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
2888
2889 struct IRegistryHub {
2890 virtual ~IRegistryHub();
2891
2892 virtual IReporterRegistry const& getReporterRegistry() const = 0;
2893 virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0;
2894 virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0;
2895 virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0;
2896
2897 virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0;
2898 };
2899
2900 struct IMutableRegistryHub {
2901 virtual ~IMutableRegistryHub();
2902 virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0;
2903 virtual void registerListener( IReporterFactoryPtr const& factory ) = 0;
2904 virtual void registerTest( TestCase const& testInfo ) = 0;
2905 virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
2906 virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;
2907 virtual void registerStartupException() noexcept = 0;
2908 virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0;
2909 };
2910
2911 IRegistryHub const& getRegistryHub();
2912 IMutableRegistryHub& getMutableRegistryHub();
2913 void cleanUp();
2914 std::string translateActiveException();
2915
2916 }
2917
2918 // end catch_interfaces_registry_hub.h
2919 #if defined(CATCH_CONFIG_DISABLE)
2920 #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \
2921 static std::string translatorName( signature )
2922 #endif
2923
2924 #include <exception>
2925 #include <string>
2926 #include <vector>
2927
2928 namespace Catch {
2929 using exceptionTranslateFunction = std::string(*)();
2930
2931 struct IExceptionTranslator;
2932 using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>;
2933
2934 struct IExceptionTranslator {
2935 virtual ~IExceptionTranslator();
2936 virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;
2937 };
2938
2939 struct IExceptionTranslatorRegistry {
2940 virtual ~IExceptionTranslatorRegistry();
2941
2942 virtual std::string translateActiveException() const = 0;
2943 };
2944
2945 class ExceptionTranslatorRegistrar {
2946 template<typename T>
2947 class ExceptionTranslator : public IExceptionTranslator {
2948 public:
2949
2950 ExceptionTranslator( std::string(*translateFunction)( T& ) )
2951 : m_translateFunction( translateFunction )
2952 {}
2953
2954 std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
2955 try {
2956 if( it == itEnd )
2957 std::rethrow_exception(std::current_exception());
2958 else
2959 return (*it)->translate( it+1, itEnd );
2960 }
2961 catch( T& ex ) {
2962 return m_translateFunction( ex );
2963 }
2964 }
2965
2966 protected:
2967 std::string(*m_translateFunction)( T& );
2968 };
2969
2970 public:
2971 template<typename T>
2972 ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) {
2973 getMutableRegistryHub().registerTranslator
2974 ( new ExceptionTranslator<T>( translateFunction ) );
2975 }
2976 };
2977 }
2978
2979 ///////////////////////////////////////////////////////////////////////////////
2980 #define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \
2981 static std::string translatorName( signature ); \
2982 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
2983 namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \
2984 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
2985 static std::string translatorName( signature )
2986
2987 #define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
2988
2989 // end catch_interfaces_exception.h
2990 // start catch_approx.h
2991
2992 #include <type_traits>
2993
2994 namespace Catch {
2995 namespace Detail {
2996
2997 class Approx {
2998 private:
2999 bool equalityComparisonImpl(double other) const;
3000 // Validates the new margin (margin >= 0)
3001 // out-of-line to avoid including stdexcept in the header
3002 void setMargin(double margin);
3003 // Validates the new epsilon (0 < epsilon < 1)
3004 // out-of-line to avoid including stdexcept in the header
3005 void setEpsilon(double epsilon);
3006
3007 public:
3008 explicit Approx ( double value );
3009
3010 static Approx custom();
3011
3012 Approx operator-() const;
3013
3014 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3015 Approx operator()( T const& value ) {
3016 Approx approx( static_cast<double>(value) );
3017 approx.m_epsilon = m_epsilon;
3018 approx.m_margin = m_margin;
3019 approx.m_scale = m_scale;
3020 return approx;
3021 }
3022
3023 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3024 explicit Approx( T const& value ): Approx(static_cast<double>(value))
3025 {}
3026
3027 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3028 friend bool operator == ( const T& lhs, Approx const& rhs ) {
3029 auto lhs_v = static_cast<double>(lhs);
3030 return rhs.equalityComparisonImpl(lhs_v);
3031 }
3032
3033 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3034 friend bool operator == ( Approx const& lhs, const T& rhs ) {
3035 return operator==( rhs, lhs );
3036 }
3037
3038 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3039 friend bool operator != ( T const& lhs, Approx const& rhs ) {
3040 return !operator==( lhs, rhs );
3041 }
3042
3043 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3044 friend bool operator != ( Approx const& lhs, T const& rhs ) {
3045 return !operator==( rhs, lhs );
3046 }
3047
3048 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3049 friend bool operator <= ( T const& lhs, Approx const& rhs ) {
3050 return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
3051 }
3052
3053 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3054 friend bool operator <= ( Approx const& lhs, T const& rhs ) {
3055 return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;
3056 }
3057
3058 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3059 friend bool operator >= ( T const& lhs, Approx const& rhs ) {
3060 return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;
3061 }
3062
3063 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3064 friend bool operator >= ( Approx const& lhs, T const& rhs ) {
3065 return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;
3066 }
3067
3068 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3069 Approx& epsilon( T const& newEpsilon ) {
3070 double epsilonAsDouble = static_cast<double>(newEpsilon);
3071 setEpsilon(epsilonAsDouble);
3072 return *this;
3073 }
3074
3075 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3076 Approx& margin( T const& newMargin ) {
3077 double marginAsDouble = static_cast<double>(newMargin);
3078 setMargin(marginAsDouble);
3079 return *this;
3080 }
3081
3082 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3083 Approx& scale( T const& newScale ) {
3084 m_scale = static_cast<double>(newScale);
3085 return *this;
3086 }
3087
3088 std::string toString() const;
3089
3090 private:
3091 double m_epsilon;
3092 double m_margin;
3093 double m_scale;
3094 double m_value;
3095 };
3096 } // end namespace Detail
3097
3098 namespace literals {
3099 Detail::Approx operator "" _a(long double val);
3100 Detail::Approx operator "" _a(unsigned long long val);
3101 } // end namespace literals
3102
3103 template<>
3104 struct StringMaker<Catch::Detail::Approx> {
3105 static std::string convert(Catch::Detail::Approx const& value);
3106 };
3107
3108 } // end namespace Catch
3109
3110 // end catch_approx.h
3111 // start catch_string_manip.h
3112
3113 #include <string>
3114 #include <iosfwd>
3115 #include <vector>
3116
3117 namespace Catch {
3118
3119 bool startsWith( std::string const& s, std::string const& prefix );
3120 bool startsWith( std::string const& s, char prefix );
3121 bool endsWith( std::string const& s, std::string const& suffix );
3122 bool endsWith( std::string const& s, char suffix );
3123 bool contains( std::string const& s, std::string const& infix );
3124 void toLowerInPlace( std::string& s );
3125 std::string toLower( std::string const& s );
3126 std::string trim( std::string const& str );
3127
3128 // !!! Be aware, returns refs into original string - make sure original string outlives them
3129 std::vector<StringRef> splitStringRef( StringRef str, char delimiter );
3130 bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
3131
3132 struct pluralise {
3133 pluralise( std::size_t count, std::string const& label );
3134
3135 friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
3136
3137 std::size_t m_count;
3138 std::string m_label;
3139 };
3140 }
3141
3142 // end catch_string_manip.h
3143 #ifndef CATCH_CONFIG_DISABLE_MATCHERS
3144 // start catch_capture_matchers.h
3145
3146 // start catch_matchers.h
3147
3148 #include <string>
3149 #include <vector>
3150
3151 namespace Catch {
3152 namespace Matchers {
3153 namespace Impl {
3154
3155 template<typename ArgT> struct MatchAllOf;
3156 template<typename ArgT> struct MatchAnyOf;
3157 template<typename ArgT> struct MatchNotOf;
3158
3159 class MatcherUntypedBase {
3160 public:
3161 MatcherUntypedBase() = default;
3162 MatcherUntypedBase ( MatcherUntypedBase const& ) = default;
3163 MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete;
3164 std::string toString() const;
3165
3166 protected:
3167 virtual ~MatcherUntypedBase();
3168 virtual std::string describe() const = 0;
3169 mutable std::string m_cachedToString;
3170 };
3171
3172 #ifdef __clang__
3173 # pragma clang diagnostic push
3174 # pragma clang diagnostic ignored "-Wnon-virtual-dtor"
3175 #endif
3176
3177 template<typename ObjectT>
3178 struct MatcherMethod {
3179 virtual bool match( ObjectT const& arg ) const = 0;
3180 };
3181
3182 #ifdef __clang__
3183 # pragma clang diagnostic pop
3184 #endif
3185
3186 template<typename T>
3187 struct MatcherBase : MatcherUntypedBase, MatcherMethod<T> {
3188
3189 MatchAllOf<T> operator && ( MatcherBase const& other ) const;
3190 MatchAnyOf<T> operator || ( MatcherBase const& other ) const;
3191 MatchNotOf<T> operator ! () const;
3192 };
3193
3194 template<typename ArgT>
3195 struct MatchAllOf : MatcherBase<ArgT> {
3196 bool match( ArgT const& arg ) const override {
3197 for( auto matcher : m_matchers ) {
3198 if (!matcher->match(arg))
3199 return false;
3200 }
3201 return true;
3202 }
3203 std::string describe() const override {
3204 std::string description;
3205 description.reserve( 4 + m_matchers.size()*32 );
3206 description += "( ";
3207 bool first = true;
3208 for( auto matcher : m_matchers ) {
3209 if( first )
3210 first = false;
3211 else
3212 description += " and ";
3213 description += matcher->toString();
3214 }
3215 description += " )";
3216 return description;
3217 }
3218
3219 MatchAllOf<ArgT>& operator && ( MatcherBase<ArgT> const& other ) {
3220 m_matchers.push_back( &other );
3221 return *this;
3222 }
3223
3224 std::vector<MatcherBase<ArgT> const*> m_matchers;
3225 };
3226 template<typename ArgT>
3227 struct MatchAnyOf : MatcherBase<ArgT> {
3228
3229 bool match( ArgT const& arg ) const override {
3230 for( auto matcher : m_matchers ) {
3231 if (matcher->match(arg))
3232 return true;
3233 }
3234 return false;
3235 }
3236 std::string describe() const override {
3237 std::string description;
3238 description.reserve( 4 + m_matchers.size()*32 );
3239 description += "( ";
3240 bool first = true;
3241 for( auto matcher : m_matchers ) {
3242 if( first )
3243 first = false;
3244 else
3245 description += " or ";
3246 description += matcher->toString();
3247 }
3248 description += " )";
3249 return description;
3250 }
3251
3252 MatchAnyOf<ArgT>& operator || ( MatcherBase<ArgT> const& other ) {
3253 m_matchers.push_back( &other );
3254 return *this;
3255 }
3256
3257 std::vector<MatcherBase<ArgT> const*> m_matchers;
3258 };
3259
3260 template<typename ArgT>
3261 struct MatchNotOf : MatcherBase<ArgT> {
3262
3263 MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}
3264
3265 bool match( ArgT const& arg ) const override {
3266 return !m_underlyingMatcher.match( arg );
3267 }
3268
3269 std::string describe() const override {
3270 return "not " + m_underlyingMatcher.toString();
3271 }
3272 MatcherBase<ArgT> const& m_underlyingMatcher;
3273 };
3274
3275 template<typename T>
3276 MatchAllOf<T> MatcherBase<T>::operator && ( MatcherBase const& other ) const {
3277 return MatchAllOf<T>() && *this && other;
3278 }
3279 template<typename T>
3280 MatchAnyOf<T> MatcherBase<T>::operator || ( MatcherBase const& other ) const {
3281 return MatchAnyOf<T>() || *this || other;
3282 }
3283 template<typename T>
3284 MatchNotOf<T> MatcherBase<T>::operator ! () const {
3285 return MatchNotOf<T>( *this );
3286 }
3287
3288 } // namespace Impl
3289
3290 } // namespace Matchers
3291
3292 using namespace Matchers;
3293 using Matchers::Impl::MatcherBase;
3294
3295 } // namespace Catch
3296
3297 // end catch_matchers.h
3298 // start catch_matchers_floating.h
3299
3300 #include <type_traits>
3301 #include <cmath>
3302
3303 namespace Catch {
3304 namespace Matchers {
3305
3306 namespace Floating {
3307
3308 enum class FloatingPointKind : uint8_t;
3309
3310 struct WithinAbsMatcher : MatcherBase<double> {
3311 WithinAbsMatcher(double target, double margin);
3312 bool match(double const& matchee) const override;
3313 std::string describe() const override;
3314 private:
3315 double m_target;
3316 double m_margin;
3317 };
3318
3319 struct WithinUlpsMatcher : MatcherBase<double> {
3320 WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType);
3321 bool match(double const& matchee) const override;
3322 std::string describe() const override;
3323 private:
3324 double m_target;
3325 int m_ulps;
3326 FloatingPointKind m_type;
3327 };
3328
3329 } // namespace Floating
3330
3331 // The following functions create the actual matcher objects.
3332 // This allows the types to be inferred
3333 Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff);
3334 Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff);
3335 Floating::WithinAbsMatcher WithinAbs(double target, double margin);
3336
3337 } // namespace Matchers
3338 } // namespace Catch
3339
3340 // end catch_matchers_floating.h
3341 // start catch_matchers_generic.hpp
3342
3343 #include <functional>
3344 #include <string>
3345
3346 namespace Catch {
3347 namespace Matchers {
3348 namespace Generic {
3349
3350 namespace Detail {
3351 std::string finalizeDescription(const std::string& desc);
3352 }
3353
3354 template <typename T>
3355 class PredicateMatcher : public MatcherBase<T> {
3356 std::function<bool(T const&)> m_predicate;
3357 std::string m_description;
3358 public:
3359
3360 PredicateMatcher(std::function<bool(T const&)> const& elem, std::string const& descr)
3361 :m_predicate(std::move(elem)),
3362 m_description(Detail::finalizeDescription(descr))
3363 {}
3364
3365 bool match( T const& item ) const override {
3366 return m_predicate(item);
3367 }
3368
3369 std::string describe() const override {
3370 return m_description;
3371 }
3372 };
3373
3374 } // namespace Generic
3375
3376 // The following functions create the actual matcher objects.
3377 // The user has to explicitly specify type to the function, because
3378 // inferring std::function<bool(T const&)> is hard (but possible) and
3379 // requires a lot of TMP.
3380 template<typename T>
3381 Generic::PredicateMatcher<T> Predicate(std::function<bool(T const&)> const& predicate, std::string const& description = "") {
3382 return Generic::PredicateMatcher<T>(predicate, description);
3383 }
3384
3385 } // namespace Matchers
3386 } // namespace Catch
3387
3388 // end catch_matchers_generic.hpp
3389 // start catch_matchers_string.h
3390
3391 #include <string>
3392
3393 namespace Catch {
3394 namespace Matchers {
3395
3396 namespace StdString {
3397
3398 struct CasedString
3399 {
3400 CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity );
3401 std::string adjustString( std::string const& str ) const;
3402 std::string caseSensitivitySuffix() const;
3403
3404 CaseSensitive::Choice m_caseSensitivity;
3405 std::string m_str;
3406 };
3407
3408 struct StringMatcherBase : MatcherBase<std::string> {
3409 StringMatcherBase( std::string const& operation, CasedString const& comparator );
3410 std::string describe() const override;
3411
3412 CasedString m_comparator;
3413 std::string m_operation;
3414 };
3415
3416 struct EqualsMatcher : StringMatcherBase {
3417 EqualsMatcher( CasedString const& comparator );
3418 bool match( std::string const& source ) const override;
3419 };
3420 struct ContainsMatcher : StringMatcherBase {
3421 ContainsMatcher( CasedString const& comparator );
3422 bool match( std::string const& source ) const override;
3423 };
3424 struct StartsWithMatcher : StringMatcherBase {
3425 StartsWithMatcher( CasedString const& comparator );
3426 bool match( std::string const& source ) const override;
3427 };
3428 struct EndsWithMatcher : StringMatcherBase {
3429 EndsWithMatcher( CasedString const& comparator );
3430 bool match( std::string const& source ) const override;
3431 };
3432
3433 struct RegexMatcher : MatcherBase<std::string> {
3434 RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity );
3435 bool match( std::string const& matchee ) const override;
3436 std::string describe() const override;
3437
3438 private:
3439 std::string m_regex;
3440 CaseSensitive::Choice m_caseSensitivity;
3441 };
3442
3443 } // namespace StdString
3444
3445 // The following functions create the actual matcher objects.
3446 // This allows the types to be inferred
3447
3448 StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
3449 StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
3450 StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
3451 StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
3452 StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
3453
3454 } // namespace Matchers
3455 } // namespace Catch
3456
3457 // end catch_matchers_string.h
3458 // start catch_matchers_vector.h
3459
3460 #include <algorithm>
3461
3462 namespace Catch {
3463 namespace Matchers {
3464
3465 namespace Vector {
3466 template<typename T>
3467 struct ContainsElementMatcher : MatcherBase<std::vector<T>> {
3468
3469 ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {}
3470
3471 bool match(std::vector<T> const &v) const override {
3472 for (auto const& el : v) {
3473 if (el == m_comparator) {
3474 return true;
3475 }
3476 }
3477 return false;
3478 }
3479
3480 std::string describe() const override {
3481 return "Contains: " + ::Catch::Detail::stringify( m_comparator );
3482 }
3483
3484 T const& m_comparator;
3485 };
3486
3487 template<typename T>
3488 struct ContainsMatcher : MatcherBase<std::vector<T>> {
3489
3490 ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
3491
3492 bool match(std::vector<T> const &v) const override {
3493 // !TBD: see note in EqualsMatcher
3494 if (m_comparator.size() > v.size())
3495 return false;
3496 for (auto const& comparator : m_comparator) {
3497 auto present = false;
3498 for (const auto& el : v) {
3499 if (el == comparator) {
3500 present = true;
3501 break;
3502 }
3503 }
3504 if (!present) {
3505 return false;
3506 }
3507 }
3508 return true;
3509 }
3510 std::string describe() const override {
3511 return "Contains: " + ::Catch::Detail::stringify( m_comparator );
3512 }
3513
3514 std::vector<T> const& m_comparator;
3515 };
3516
3517 template<typename T>
3518 struct EqualsMatcher : MatcherBase<std::vector<T>> {
3519
3520 EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
3521
3522 bool match(std::vector<T> const &v) const override {
3523 // !TBD: This currently works if all elements can be compared using !=
3524 // - a more general approach would be via a compare template that defaults
3525 // to using !=. but could be specialised for, e.g. std::vector<T> etc
3526 // - then just call that directly
3527 if (m_comparator.size() != v.size())
3528 return false;
3529 for (std::size_t i = 0; i < v.size(); ++i)
3530 if (m_comparator[i] != v[i])
3531 return false;
3532 return true;
3533 }
3534 std::string describe() const override {
3535 return "Equals: " + ::Catch::Detail::stringify( m_comparator );
3536 }
3537 std::vector<T> const& m_comparator;
3538 };
3539
3540 template<typename T>
3541 struct ApproxMatcher : MatcherBase<std::vector<T>> {
3542
3543 ApproxMatcher(std::vector<T> const& comparator) : m_comparator( comparator ) {}
3544
3545 bool match(std::vector<T> const &v) const override {
3546 if (m_comparator.size() != v.size())
3547 return false;
3548 for (std::size_t i = 0; i < v.size(); ++i)
3549 if (m_comparator[i] != approx(v[i]))
3550 return false;
3551 return true;
3552 }
3553 std::string describe() const override {
3554 return "is approx: " + ::Catch::Detail::stringify( m_comparator );
3555 }
3556 template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3557 ApproxMatcher& epsilon( T const& newEpsilon ) {
3558 approx.epsilon(newEpsilon);
3559 return *this;
3560 }
3561 template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3562 ApproxMatcher& margin( T const& newMargin ) {
3563 approx.margin(newMargin);
3564 return *this;
3565 }
3566 template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3567 ApproxMatcher& scale( T const& newScale ) {
3568 approx.scale(newScale);
3569 return *this;
3570 }
3571
3572 std::vector<T> const& m_comparator;
3573 mutable Catch::Detail::Approx approx = Catch::Detail::Approx::custom();
3574 };
3575
3576 template<typename T>
3577 struct UnorderedEqualsMatcher : MatcherBase<std::vector<T>> {
3578 UnorderedEqualsMatcher(std::vector<T> const& target) : m_target(target) {}
3579 bool match(std::vector<T> const& vec) const override {
3580 // Note: This is a reimplementation of std::is_permutation,
3581 // because I don't want to include <algorithm> inside the common path
3582 if (m_target.size() != vec.size()) {
3583 return false;
3584 }
3585 return std::is_permutation(m_target.begin(), m_target.end(), vec.begin());
3586 }
3587
3588 std::string describe() const override {
3589 return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target);
3590 }
3591 private:
3592 std::vector<T> const& m_target;
3593 };
3594
3595 } // namespace Vector
3596
3597 // The following functions create the actual matcher objects.
3598 // This allows the types to be inferred
3599
3600 template<typename T>
3601 Vector::ContainsMatcher<T> Contains( std::vector<T> const& comparator ) {
3602 return Vector::ContainsMatcher<T>( comparator );
3603 }
3604
3605 template<typename T>
3606 Vector::ContainsElementMatcher<T> VectorContains( T const& comparator ) {
3607 return Vector::ContainsElementMatcher<T>( comparator );
3608 }
3609
3610 template<typename T>
3611 Vector::EqualsMatcher<T> Equals( std::vector<T> const& comparator ) {
3612 return Vector::EqualsMatcher<T>( comparator );
3613 }
3614
3615 template<typename T>
3616 Vector::ApproxMatcher<T> Approx( std::vector<T> const& comparator ) {
3617 return Vector::ApproxMatcher<T>( comparator );
3618 }
3619
3620 template<typename T>
3621 Vector::UnorderedEqualsMatcher<T> UnorderedEquals(std::vector<T> const& target) {
3622 return Vector::UnorderedEqualsMatcher<T>(target);
3623 }
3624
3625 } // namespace Matchers
3626 } // namespace Catch
3627
3628 // end catch_matchers_vector.h
3629 namespace Catch {
3630
3631 template<typename ArgT, typename MatcherT>
3632 class MatchExpr : public ITransientExpression {
3633 ArgT const& m_arg;
3634 MatcherT m_matcher;
3635 StringRef m_matcherString;
3636 public:
3637 MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString )
3638 : ITransientExpression{ true, matcher.match( arg ) },
3639 m_arg( arg ),
3640 m_matcher( matcher ),
3641 m_matcherString( matcherString )
3642 {}
3643
3644 void streamReconstructedExpression( std::ostream &os ) const override {
3645 auto matcherAsString = m_matcher.toString();
3646 os << Catch::Detail::stringify( m_arg ) << ' ';
3647 if( matcherAsString == Detail::unprintableString )
3648 os << m_matcherString;
3649 else
3650 os << matcherAsString;
3651 }
3652 };
3653
3654 using StringMatcher = Matchers::Impl::MatcherBase<std::string>;
3655
3656 void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString );
3657
3658 template<typename ArgT, typename MatcherT>
3659 auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) -> MatchExpr<ArgT, MatcherT> {
3660 return MatchExpr<ArgT, MatcherT>( arg, matcher, matcherString );
3661 }
3662
3663 } // namespace Catch
3664
3665 ///////////////////////////////////////////////////////////////////////////////
3666 #define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \
3667 do { \
3668 Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
3669 INTERNAL_CATCH_TRY { \
3670 catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher##_catch_sr ) ); \
3671 } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
3672 INTERNAL_CATCH_REACT( catchAssertionHandler ) \
3673 } while( false )
3674
3675 ///////////////////////////////////////////////////////////////////////////////
3676 #define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \
3677 do { \
3678 Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
3679 if( catchAssertionHandler.allowThrows() ) \
3680 try { \
3681 static_cast<void>(__VA_ARGS__ ); \
3682 catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
3683 } \
3684 catch( exceptionType const& ex ) { \
3685 catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher##_catch_sr ) ); \
3686 } \
3687 catch( ... ) { \
3688 catchAssertionHandler.handleUnexpectedInflightException(); \
3689 } \
3690 else \
3691 catchAssertionHandler.handleThrowingCallSkipped(); \
3692 INTERNAL_CATCH_REACT( catchAssertionHandler ) \
3693 } while( false )
3694
3695 // end catch_capture_matchers.h
3696 #endif
3697 // start catch_generators.hpp
3698
3699 // start catch_interfaces_generatortracker.h
3700
3701
3702 #include <memory>
3703
3704 namespace Catch {
3705
3706 namespace Generators {
3707 class GeneratorUntypedBase {
3708 public:
3709 GeneratorUntypedBase() = default;
3710 virtual ~GeneratorUntypedBase();
3711 // Attempts to move the generator to the next element
3712 //
3713 // Returns true iff the move succeeded (and a valid element
3714 // can be retrieved).
3715 virtual bool next() = 0;
3716 };
3717 using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>;
3718
3719 } // namespace Generators
3720
3721 struct IGeneratorTracker {
3722 virtual ~IGeneratorTracker();
3723 virtual auto hasGenerator() const -> bool = 0;
3724 virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;
3725 virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;
3726 };
3727
3728 } // namespace Catch
3729
3730 // end catch_interfaces_generatortracker.h
3731 // start catch_enforce.h
3732
3733 #include <exception>
3734
3735 namespace Catch {
3736 #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
3737 template <typename Ex>
3738 [[noreturn]]
3739 void throw_exception(Ex const& e) {
3740 throw e;
3741 }
3742 #else // ^^ Exceptions are enabled // Exceptions are disabled vv
3743 [[noreturn]]
3744 void throw_exception(std::exception const& e);
3745 #endif
3746
3747 [[noreturn]]
3748 void throw_logic_error(std::string const& msg);
3749 [[noreturn]]
3750 void throw_domain_error(std::string const& msg);
3751 [[noreturn]]
3752 void throw_runtime_error(std::string const& msg);
3753
3754 } // namespace Catch;
3755
3756 #define CATCH_MAKE_MSG(...) \
3757 (Catch::ReusableStringStream() << __VA_ARGS__).str()
3758
3759 #define CATCH_INTERNAL_ERROR(...) \
3760 Catch::throw_logic_error(CATCH_MAKE_MSG( CATCH_INTERNAL_LINEINFO << ": Internal Catch2 error: " << __VA_ARGS__));
3761
3762 #define CATCH_ERROR(...) \
3763 Catch::throw_domain_error(CATCH_MAKE_MSG( __VA_ARGS__ ));
3764
3765 #define CATCH_RUNTIME_ERROR(...) \
3766 Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ ));
3767
3768 #define CATCH_ENFORCE( condition, ... ) \
3769 do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false)
3770
3771 // end catch_enforce.h
3772 #include <memory>
3773 #include <vector>
3774 #include <cassert>
3775
3776 #include <utility>
3777 #include <exception>
3778
3779 namespace Catch {
3780
3781 class GeneratorException : public std::exception {
3782 const char* const m_msg = "";
3783
3784 public:
3785 GeneratorException(const char* msg):
3786 m_msg(msg)
3787 {}
3788
3789 const char* what() const noexcept override final;
3790 };
3791
3792 namespace Generators {
3793
3794 // !TBD move this into its own location?
3795 namespace pf{
3796 template<typename T, typename... Args>
3797 std::unique_ptr<T> make_unique( Args&&... args ) {
3798 return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
3799 }
3800 }
3801
3802 template<typename T>
3803 struct IGenerator : GeneratorUntypedBase {
3804 virtual ~IGenerator() = default;
3805
3806 // Returns the current element of the generator
3807 //
3808 // \Precondition The generator is either freshly constructed,
3809 // or the last call to `next()` returned true
3810 virtual T const& get() const = 0;
3811 using type = T;
3812 };
3813
3814 template<typename T>
3815 class SingleValueGenerator final : public IGenerator<T> {
3816 T m_value;
3817 public:
3818 SingleValueGenerator(T const& value) : m_value( value ) {}
3819 SingleValueGenerator(T&& value) : m_value(std::move(value)) {}
3820
3821 T const& get() const override {
3822 return m_value;
3823 }
3824 bool next() override {
3825 return false;
3826 }
3827 };
3828
3829 template<typename T>
3830 class FixedValuesGenerator final : public IGenerator<T> {
3831 std::vector<T> m_values;
3832 size_t m_idx = 0;
3833 public:
3834 FixedValuesGenerator( std::initializer_list<T> values ) : m_values( values ) {}
3835
3836 T const& get() const override {
3837 return m_values[m_idx];
3838 }
3839 bool next() override {
3840 ++m_idx;
3841 return m_idx < m_values.size();
3842 }
3843 };
3844
3845 template <typename T>
3846 class GeneratorWrapper final {
3847 std::unique_ptr<IGenerator<T>> m_generator;
3848 public:
3849 GeneratorWrapper(std::unique_ptr<IGenerator<T>> generator):
3850 m_generator(std::move(generator))
3851 {}
3852 T const& get() const {
3853 return m_generator->get();
3854 }
3855 bool next() {
3856 return m_generator->next();
3857 }
3858 };
3859
3860 template <typename T>
3861 GeneratorWrapper<T> value(T&& value) {
3862 return GeneratorWrapper<T>(pf::make_unique<SingleValueGenerator<T>>(std::forward<T>(value)));
3863 }
3864 template <typename T>
3865 GeneratorWrapper<T> values(std::initializer_list<T> values) {
3866 return GeneratorWrapper<T>(pf::make_unique<FixedValuesGenerator<T>>(values));
3867 }
3868
3869 template<typename T>
3870 class Generators : public IGenerator<T> {
3871 std::vector<GeneratorWrapper<T>> m_generators;
3872 size_t m_current = 0;
3873
3874 void populate(GeneratorWrapper<T>&& generator) {
3875 m_generators.emplace_back(std::move(generator));
3876 }
3877 void populate(T&& val) {
3878 m_generators.emplace_back(value(std::move(val)));
3879 }
3880 template<typename U>
3881 void populate(U&& val) {
3882 populate(T(std::move(val)));
3883 }
3884 template<typename U, typename... Gs>
3885 void populate(U&& valueOrGenerator, Gs... moreGenerators) {
3886 populate(std::forward<U>(valueOrGenerator));
3887 populate(std::forward<Gs>(moreGenerators)...);
3888 }
3889
3890 public:
3891 template <typename... Gs>
3892 Generators(Gs... moreGenerators) {
3893 m_generators.reserve(sizeof...(Gs));
3894 populate(std::forward<Gs>(moreGenerators)...);
3895 }
3896
3897 T const& get() const override {
3898 return m_generators[m_current].get();
3899 }
3900
3901 bool next() override {
3902 if (m_current >= m_generators.size()) {
3903 return false;
3904 }
3905 const bool current_status = m_generators[m_current].next();
3906 if (!current_status) {
3907 ++m_current;
3908 }
3909 return m_current < m_generators.size();
3910 }
3911 };
3912
3913 template<typename... Ts>
3914 GeneratorWrapper<std::tuple<Ts...>> table( std::initializer_list<std::tuple<typename std::decay<Ts>::type...>> tuples ) {
3915 return values<std::tuple<Ts...>>( tuples );
3916 }
3917
3918 // Tag type to signal that a generator sequence should convert arguments to a specific type
3919 template <typename T>
3920 struct as {};
3921
3922 template<typename T, typename... Gs>
3923 auto makeGenerators( GeneratorWrapper<T>&& generator, Gs... moreGenerators ) -> Generators<T> {
3924 return Generators<T>(std::move(generator), std::forward<Gs>(moreGenerators)...);
3925 }
3926 template<typename T>
3927 auto makeGenerators( GeneratorWrapper<T>&& generator ) -> Generators<T> {
3928 return Generators<T>(std::move(generator));
3929 }
3930 template<typename T, typename... Gs>
3931 auto makeGenerators( T&& val, Gs... moreGenerators ) -> Generators<T> {
3932 return makeGenerators( value( std::forward<T>( val ) ), std::forward<Gs>( moreGenerators )... );
3933 }
3934 template<typename T, typename U, typename... Gs>
3935 auto makeGenerators( as<T>, U&& val, Gs... moreGenerators ) -> Generators<T> {
3936 return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... );
3937 }
3938
3939 auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker&;
3940
3941 template<typename L>
3942 // Note: The type after -> is weird, because VS2015 cannot parse
3943 // the expression used in the typedef inside, when it is in
3944 // return type. Yeah.
3945 auto generate( SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) {
3946 using UnderlyingType = typename decltype(generatorExpression())::type;
3947
3948 IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo );
3949 if (!tracker.hasGenerator()) {
3950 tracker.setGenerator(pf::make_unique<Generators<UnderlyingType>>(generatorExpression()));
3951 }
3952
3953 auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker.getGenerator() );
3954 return generator.get();
3955 }
3956
3957 } // namespace Generators
3958 } // namespace Catch
3959
3960 #define GENERATE( ... ) \
3961 Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } )
3962 #define GENERATE_COPY( ... ) \
3963 Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } )
3964 #define GENERATE_REF( ... ) \
3965 Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } )
3966
3967 // end catch_generators.hpp
3968 // start catch_generators_generic.hpp
3969
3970 namespace Catch {
3971 namespace Generators {
3972
3973 template <typename T>
3974 class TakeGenerator : public IGenerator<T> {
3975 GeneratorWrapper<T> m_generator;
3976 size_t m_returned = 0;
3977 size_t m_target;
3978 public:
3979 TakeGenerator(size_t target, GeneratorWrapper<T>&& generator):
3980 m_generator(std::move(generator)),
3981 m_target(target)
3982 {
3983 assert(target != 0 && "Empty generators are not allowed");
3984 }
3985 T const& get() const override {
3986 return m_generator.get();
3987 }
3988 bool next() override {
3989 ++m_returned;
3990 if (m_returned >= m_target) {
3991 return false;
3992 }
3993
3994 const auto success = m_generator.next();
3995 // If the underlying generator does not contain enough values
3996 // then we cut short as well
3997 if (!success) {
3998 m_returned = m_target;
3999 }
4000 return success;
4001 }
4002 };
4003
4004 template <typename T>
4005 GeneratorWrapper<T> take(size_t target, GeneratorWrapper<T>&& generator) {
4006 return GeneratorWrapper<T>(pf::make_unique<TakeGenerator<T>>(target, std::move(generator)));
4007 }
4008
4009 template <typename T, typename Predicate>
4010 class FilterGenerator : public IGenerator<T> {
4011 GeneratorWrapper<T> m_generator;
4012 Predicate m_predicate;
4013 public:
4014 template <typename P = Predicate>
4015 FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator):
4016 m_generator(std::move(generator)),
4017 m_predicate(std::forward<P>(pred))
4018 {
4019 if (!m_predicate(m_generator.get())) {
4020 // It might happen that there are no values that pass the
4021 // filter. In that case we throw an exception.
4022 auto has_initial_value = next();
4023 if (!has_initial_value) {
4024 Catch::throw_exception(GeneratorException("No valid value found in filtered generator"));
4025 }
4026 }
4027 }
4028
4029 T const& get() const override {
4030 return m_generator.get();
4031 }
4032
4033 bool next() override {
4034 bool success = m_generator.next();
4035 if (!success) {
4036 return false;
4037 }
4038 while (!m_predicate(m_generator.get()) && (success = m_generator.next()) == true);
4039 return success;
4040 }
4041 };
4042
4043 template <typename T, typename Predicate>
4044 GeneratorWrapper<T> filter(Predicate&& pred, GeneratorWrapper<T>&& generator) {
4045 return GeneratorWrapper<T>(std::unique_ptr<IGenerator<T>>(pf::make_unique<FilterGenerator<T, Predicate>>(std::forward<Predicate>(pred), std::move(generator))));
4046 }
4047
4048 template <typename T>
4049 class RepeatGenerator : public IGenerator<T> {
4050 GeneratorWrapper<T> m_generator;
4051 mutable std::vector<T> m_returned;
4052 size_t m_target_repeats;
4053 size_t m_current_repeat = 0;
4054 size_t m_repeat_index = 0;
4055 public:
4056 RepeatGenerator(size_t repeats, GeneratorWrapper<T>&& generator):
4057 m_generator(std::move(generator)),
4058 m_target_repeats(repeats)
4059 {
4060 assert(m_target_repeats > 0 && "Repeat generator must repeat at least once");
4061 }
4062
4063 T const& get() const override {
4064 if (m_current_repeat == 0) {
4065 m_returned.push_back(m_generator.get());
4066 return m_returned.back();
4067 }
4068 return m_returned[m_repeat_index];
4069 }
4070
4071 bool next() override {
4072 // There are 2 basic cases:
4073 // 1) We are still reading the generator
4074 // 2) We are reading our own cache
4075
4076 // In the first case, we need to poke the underlying generator.
4077 // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache
4078 if (m_current_repeat == 0) {
4079 const auto success = m_generator.next();
4080 if (!success) {
4081 ++m_current_repeat;
4082 }
4083 return m_current_repeat < m_target_repeats;
4084 }
4085
4086 // In the second case, we need to move indices forward and check that we haven't run up against the end
4087 ++m_repeat_index;
4088 if (m_repeat_index == m_returned.size()) {
4089 m_repeat_index = 0;
4090 ++m_current_repeat;
4091 }
4092 return m_current_repeat < m_target_repeats;
4093 }
4094 };
4095
4096 template <typename T>
4097 GeneratorWrapper<T> repeat(size_t repeats, GeneratorWrapper<T>&& generator) {
4098 return GeneratorWrapper<T>(pf::make_unique<RepeatGenerator<T>>(repeats, std::move(generator)));
4099 }
4100
4101 template <typename T, typename U, typename Func>
4102 class MapGenerator : public IGenerator<T> {
4103 // TBD: provide static assert for mapping function, for friendly error message
4104 GeneratorWrapper<U> m_generator;
4105 Func m_function;
4106 // To avoid returning dangling reference, we have to save the values
4107 T m_cache;
4108 public:
4109 template <typename F2 = Func>
4110 MapGenerator(F2&& function, GeneratorWrapper<U>&& generator) :
4111 m_generator(std::move(generator)),
4112 m_function(std::forward<F2>(function)),
4113 m_cache(m_function(m_generator.get()))
4114 {}
4115
4116 T const& get() const override {
4117 return m_cache;
4118 }
4119 bool next() override {
4120 const auto success = m_generator.next();
4121 if (success) {
4122 m_cache = m_function(m_generator.get());
4123 }
4124 return success;
4125 }
4126 };
4127
4128 #if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703
4129 // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is
4130 // replaced with std::invoke_result here. Also *_t format is preferred over
4131 // typename *::type format.
4132 template <typename Func, typename U>
4133 using MapFunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U>>>;
4134 #else
4135 template <typename Func, typename U>
4136 using MapFunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U)>::type>::type>::type;
4137 #endif
4138
4139 template <typename Func, typename U, typename T = MapFunctionReturnType<Func, U>>
4140 GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) {
4141 return GeneratorWrapper<T>(
4142 pf::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator))
4143 );
4144 }
4145
4146 template <typename T, typename U, typename Func>
4147 GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) {
4148 return GeneratorWrapper<T>(
4149 pf::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator))
4150 );
4151 }
4152
4153 template <typename T>
4154 class ChunkGenerator final : public IGenerator<std::vector<T>> {
4155 std::vector<T> m_chunk;
4156 size_t m_chunk_size;
4157 GeneratorWrapper<T> m_generator;
4158 bool m_used_up = false;
4159 public:
4160 ChunkGenerator(size_t size, GeneratorWrapper<T> generator) :
4161 m_chunk_size(size), m_generator(std::move(generator))
4162 {
4163 m_chunk.reserve(m_chunk_size);
4164 m_chunk.push_back(m_generator.get());
4165 for (size_t i = 1; i < m_chunk_size; ++i) {
4166 if (!m_generator.next()) {
4167 Catch::throw_exception(GeneratorException("Not enough values to initialize the first chunk"));
4168 }
4169 m_chunk.push_back(m_generator.get());
4170 }
4171 }
4172 std::vector<T> const& get() const override {
4173 return m_chunk;
4174 }
4175 bool next() override {
4176 m_chunk.clear();
4177 for (size_t idx = 0; idx < m_chunk_size; ++idx) {
4178 if (!m_generator.next()) {
4179 return false;
4180 }
4181 m_chunk.push_back(m_generator.get());
4182 }
4183 return true;
4184 }
4185 };
4186
4187 template <typename T>
4188 GeneratorWrapper<std::vector<T>> chunk(size_t size, GeneratorWrapper<T>&& generator) {
4189 return GeneratorWrapper<std::vector<T>>(
4190 pf::make_unique<ChunkGenerator<T>>(size, std::move(generator))
4191 );
4192 }
4193
4194 } // namespace Generators
4195 } // namespace Catch
4196
4197 // end catch_generators_generic.hpp
4198 // start catch_generators_specific.hpp
4199
4200 // start catch_context.h
4201
4202 #include <memory>
4203
4204 namespace Catch {
4205
4206 struct IResultCapture;
4207 struct IRunner;
4208 struct IConfig;
4209 struct IMutableContext;
4210
4211 using IConfigPtr = std::shared_ptr<IConfig const>;
4212
4213 struct IContext
4214 {
4215 virtual ~IContext();
4216
4217 virtual IResultCapture* getResultCapture() = 0;
4218 virtual IRunner* getRunner() = 0;
4219 virtual IConfigPtr const& getConfig() const = 0;
4220 };
4221
4222 struct IMutableContext : IContext
4223 {
4224 virtual ~IMutableContext();
4225 virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
4226 virtual void setRunner( IRunner* runner ) = 0;
4227 virtual void setConfig( IConfigPtr const& config ) = 0;
4228
4229 private:
4230 static IMutableContext *currentContext;
4231 friend IMutableContext& getCurrentMutableContext();
4232 friend void cleanUpContext();
4233 static void createContext();
4234 };
4235
4236 inline IMutableContext& getCurrentMutableContext()
4237 {
4238 if( !IMutableContext::currentContext )
4239 IMutableContext::createContext();
4240 return *IMutableContext::currentContext;
4241 }
4242
4243 inline IContext& getCurrentContext()
4244 {
4245 return getCurrentMutableContext();
4246 }
4247
4248 void cleanUpContext();
4249 }
4250
4251 // end catch_context.h
4252 // start catch_interfaces_config.h
4253
4254 // start catch_option.hpp
4255
4256 namespace Catch {
4257
4258 // An optional type
4259 template<typename T>
4260 class Option {
4261 public:
4262 Option() : nullableValue( nullptr ) {}
4263 Option( T const& _value )
4264 : nullableValue( new( storage ) T( _value ) )
4265 {}
4266 Option( Option const& _other )
4267 : nullableValue( _other ? new( storage ) T( *_other ) : nullptr )
4268 {}
4269
4270 ~Option() {
4271 reset();
4272 }
4273
4274 Option& operator= ( Option const& _other ) {
4275 if( &_other != this ) {
4276 reset();
4277 if( _other )
4278 nullableValue = new( storage ) T( *_other );
4279 }
4280 return *this;
4281 }
4282 Option& operator = ( T const& _value ) {
4283 reset();
4284 nullableValue = new( storage ) T( _value );
4285 return *this;
4286 }
4287
4288 void reset() {
4289 if( nullableValue )
4290 nullableValue->~T();
4291 nullableValue = nullptr;
4292 }
4293
4294 T& operator*() { return *nullableValue; }
4295 T const& operator*() const { return *nullableValue; }
4296 T* operator->() { return nullableValue; }
4297 const T* operator->() const { return nullableValue; }
4298
4299 T valueOr( T const& defaultValue ) const {
4300 return nullableValue ? *nullableValue : defaultValue;
4301 }
4302
4303 bool some() const { return nullableValue != nullptr; }
4304 bool none() const { return nullableValue == nullptr; }
4305
4306 bool operator !() const { return nullableValue == nullptr; }
4307 explicit operator bool() const {
4308 return some();
4309 }
4310
4311 private:
4312 T *nullableValue;
4313 alignas(alignof(T)) char storage[sizeof(T)];
4314 };
4315
4316 } // end namespace Catch
4317
4318 // end catch_option.hpp
4319 #include <iosfwd>
4320 #include <string>
4321 #include <vector>
4322 #include <memory>
4323
4324 namespace Catch {
4325
4326 enum class Verbosity {
4327 Quiet = 0,
4328 Normal,
4329 High
4330 };
4331
4332 struct WarnAbout { enum What {
4333 Nothing = 0x00,
4334 NoAssertions = 0x01,
4335 NoTests = 0x02
4336 }; };
4337
4338 struct ShowDurations { enum OrNot {
4339 DefaultForReporter,
4340 Always,
4341 Never
4342 }; };
4343 struct RunTests { enum InWhatOrder {
4344 InDeclarationOrder,
4345 InLexicographicalOrder,
4346 InRandomOrder
4347 }; };
4348 struct UseColour { enum YesOrNo {
4349 Auto,
4350 Yes,
4351 No
4352 }; };
4353 struct WaitForKeypress { enum When {
4354 Never,
4355 BeforeStart = 1,
4356 BeforeExit = 2,
4357 BeforeStartAndExit = BeforeStart | BeforeExit
4358 }; };
4359
4360 class TestSpec;
4361
4362 struct IConfig : NonCopyable {
4363
4364 virtual ~IConfig();
4365
4366 virtual bool allowThrows() const = 0;
4367 virtual std::ostream& stream() const = 0;
4368 virtual std::string name() const = 0;
4369 virtual bool includeSuccessfulResults() const = 0;
4370 virtual bool shouldDebugBreak() const = 0;
4371 virtual bool warnAboutMissingAssertions() const = 0;
4372 virtual bool warnAboutNoTests() const = 0;
4373 virtual int abortAfter() const = 0;
4374 virtual bool showInvisibles() const = 0;
4375 virtual ShowDurations::OrNot showDurations() const = 0;
4376 virtual TestSpec const& testSpec() const = 0;
4377 virtual bool hasTestFilters() const = 0;
4378 virtual std::vector<std::string> const& getTestsOrTags() const = 0;
4379 virtual RunTests::InWhatOrder runOrder() const = 0;
4380 virtual unsigned int rngSeed() const = 0;
4381 virtual UseColour::YesOrNo useColour() const = 0;
4382 virtual std::vector<std::string> const& getSectionsToRun() const = 0;
4383 virtual Verbosity verbosity() const = 0;
4384
4385 virtual bool benchmarkNoAnalysis() const = 0;
4386 virtual int benchmarkSamples() const = 0;
4387 virtual double benchmarkConfidenceInterval() const = 0;
4388 virtual unsigned int benchmarkResamples() const = 0;
4389 };
4390
4391 using IConfigPtr = std::shared_ptr<IConfig const>;
4392 }
4393
4394 // end catch_interfaces_config.h
4395 #include <random>
4396
4397 namespace Catch {
4398 namespace Generators {
4399
4400 template <typename Float>
4401 class RandomFloatingGenerator final : public IGenerator<Float> {
4402 // FIXME: What is the right seed?
4403 std::minstd_rand m_rand;
4404 std::uniform_real_distribution<Float> m_dist;
4405 Float m_current_number;
4406 public:
4407
4408 RandomFloatingGenerator(Float a, Float b):
4409 m_rand(getCurrentContext().getConfig()->rngSeed()),
4410 m_dist(a, b) {
4411 static_cast<void>(next());
4412 }
4413
4414 Float const& get() const override {
4415 return m_current_number;
4416 }
4417 bool next() override {
4418 m_current_number = m_dist(m_rand);
4419 return true;
4420 }
4421 };
4422
4423 template <typename Integer>
4424 class RandomIntegerGenerator final : public IGenerator<Integer> {
4425 std::minstd_rand m_rand;
4426 std::uniform_int_distribution<Integer> m_dist;
4427 Integer m_current_number;
4428 public:
4429
4430 RandomIntegerGenerator(Integer a, Integer b):
4431 m_rand(getCurrentContext().getConfig()->rngSeed()),
4432 m_dist(a, b) {
4433 static_cast<void>(next());
4434 }
4435
4436 Integer const& get() const override {
4437 return m_current_number;
4438 }
4439 bool next() override {
4440 m_current_number = m_dist(m_rand);
4441 return true;
4442 }
4443 };
4444
4445 // TODO: Ideally this would be also constrained against the various char types,
4446 // but I don't expect users to run into that in practice.
4447 template <typename T>
4448 typename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value,
4449 GeneratorWrapper<T>>::type
4450 random(T a, T b) {
4451 return GeneratorWrapper<T>(
4452 pf::make_unique<RandomIntegerGenerator<T>>(a, b)
4453 );
4454 }
4455
4456 template <typename T>
4457 typename std::enable_if<std::is_floating_point<T>::value,
4458 GeneratorWrapper<T>>::type
4459 random(T a, T b) {
4460 return GeneratorWrapper<T>(
4461 pf::make_unique<RandomFloatingGenerator<T>>(a, b)
4462 );
4463 }
4464
4465 template <typename T>
4466 class RangeGenerator final : public IGenerator<T> {
4467 T m_current;
4468 T m_end;
4469 T m_step;
4470 bool m_positive;
4471
4472 public:
4473 RangeGenerator(T const& start, T const& end, T const& step):
4474 m_current(start),
4475 m_end(end),
4476 m_step(step),
4477 m_positive(m_step > T(0))
4478 {
4479 assert(m_current != m_end && "Range start and end cannot be equal");
4480 assert(m_step != T(0) && "Step size cannot be zero");
4481 assert(((m_positive && m_current <= m_end) || (!m_positive && m_current >= m_end)) && "Step moves away from end");
4482 }
4483
4484 RangeGenerator(T const& start, T const& end):
4485 RangeGenerator(start, end, (start < end) ? T(1) : T(-1))
4486 {}
4487
4488 T const& get() const override {
4489 return m_current;
4490 }
4491
4492 bool next() override {
4493 m_current += m_step;
4494 return (m_positive) ? (m_current < m_end) : (m_current > m_end);
4495 }
4496 };
4497
4498 template <typename T>
4499 GeneratorWrapper<T> range(T const& start, T const& end, T const& step) {
4500 static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer");
4501 return GeneratorWrapper<T>(pf::make_unique<RangeGenerator<T>>(start, end, step));
4502 }
4503
4504 template <typename T>
4505 GeneratorWrapper<T> range(T const& start, T const& end) {
4506 static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer");
4507 return GeneratorWrapper<T>(pf::make_unique<RangeGenerator<T>>(start, end));
4508 }
4509
4510 } // namespace Generators
4511 } // namespace Catch
4512
4513 // end catch_generators_specific.hpp
4514
4515 // These files are included here so the single_include script doesn't put them
4516 // in the conditionally compiled sections
4517 // start catch_test_case_info.h
4518
4519 #include <string>
4520 #include <vector>
4521 #include <memory>
4522
4523 #ifdef __clang__
4524 #pragma clang diagnostic push
4525 #pragma clang diagnostic ignored "-Wpadded"
4526 #endif
4527
4528 namespace Catch {
4529
4530 struct ITestInvoker;
4531
4532 struct TestCaseInfo {
4533 enum SpecialProperties{
4534 None = 0,
4535 IsHidden = 1 << 1,
4536 ShouldFail = 1 << 2,
4537 MayFail = 1 << 3,
4538 Throws = 1 << 4,
4539 NonPortable = 1 << 5,
4540 Benchmark = 1 << 6
4541 };
4542
4543 TestCaseInfo( std::string const& _name,
4544 std::string const& _className,
4545 std::string const& _description,
4546 std::vector<std::string> const& _tags,
4547 SourceLineInfo const& _lineInfo );
4548
4549 friend void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags );
4550
4551 bool isHidden() const;
4552 bool throws() const;
4553 bool okToFail() const;
4554 bool expectedToFail() const;
4555
4556 std::string tagsAsString() const;
4557
4558 std::string name;
4559 std::string className;
4560 std::string description;
4561 std::vector<std::string> tags;
4562 std::vector<std::string> lcaseTags;
4563 SourceLineInfo lineInfo;
4564 SpecialProperties properties;
4565 };
4566
4567 class TestCase : public TestCaseInfo {
4568 public:
4569
4570 TestCase( ITestInvoker* testCase, TestCaseInfo&& info );
4571
4572 TestCase withName( std::string const& _newName ) const;
4573
4574 void invoke() const;
4575
4576 TestCaseInfo const& getTestCaseInfo() const;
4577
4578 bool operator == ( TestCase const& other ) const;
4579 bool operator < ( TestCase const& other ) const;
4580
4581 private:
4582 std::shared_ptr<ITestInvoker> test;
4583 };
4584
4585 TestCase makeTestCase( ITestInvoker* testCase,
4586 std::string const& className,
4587 NameAndTags const& nameAndTags,
4588 SourceLineInfo const& lineInfo );
4589 }
4590
4591 #ifdef __clang__
4592 #pragma clang diagnostic pop
4593 #endif
4594
4595 // end catch_test_case_info.h
4596 // start catch_interfaces_runner.h
4597
4598 namespace Catch {
4599
4600 struct IRunner {
4601 virtual ~IRunner();
4602 virtual bool aborting() const = 0;
4603 };
4604 }
4605
4606 // end catch_interfaces_runner.h
4607
4608 #ifdef __OBJC__
4609 // start catch_objc.hpp
4610
4611 #import <objc/runtime.h>
4612
4613 #include <string>
4614
4615 // NB. Any general catch headers included here must be included
4616 // in catch.hpp first to make sure they are included by the single
4617 // header for non obj-usage
4618
4619 ///////////////////////////////////////////////////////////////////////////////
4620 // This protocol is really only here for (self) documenting purposes, since
4621 // all its methods are optional.
4622 @protocol OcFixture
4623
4624 @optional
4625
4626 -(void) setUp;
4627 -(void) tearDown;
4628
4629 @end
4630
4631 namespace Catch {
4632
4633 class OcMethod : public ITestInvoker {
4634
4635 public:
4636 OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {}
4637
4638 virtual void invoke() const {
4639 id obj = [[m_cls alloc] init];
4640
4641 performOptionalSelector( obj, @selector(setUp) );
4642 performOptionalSelector( obj, m_sel );
4643 performOptionalSelector( obj, @selector(tearDown) );
4644
4645 arcSafeRelease( obj );
4646 }
4647 private:
4648 virtual ~OcMethod() {}
4649
4650 Class m_cls;
4651 SEL m_sel;
4652 };
4653
4654 namespace Detail{
4655
4656 inline std::string getAnnotation( Class cls,
4657 std::string const& annotationName,
4658 std::string const& testCaseName ) {
4659 NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()];
4660 SEL sel = NSSelectorFromString( selStr );
4661 arcSafeRelease( selStr );
4662 id value = performOptionalSelector( cls, sel );
4663 if( value )
4664 return [(NSString*)value UTF8String];
4665 return "";
4666 }
4667 }
4668
4669 inline std::size_t registerTestMethods() {
4670 std::size_t noTestMethods = 0;
4671 int noClasses = objc_getClassList( nullptr, 0 );
4672
4673 Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
4674 objc_getClassList( classes, noClasses );
4675
4676 for( int c = 0; c < noClasses; c++ ) {
4677 Class cls = classes[c];
4678 {
4679 u_int count;
4680 Method* methods = class_copyMethodList( cls, &count );
4681 for( u_int m = 0; m < count ; m++ ) {
4682 SEL selector = method_getName(methods[m]);
4683 std::string methodName = sel_getName(selector);
4684 if( startsWith( methodName, "Catch_TestCase_" ) ) {
4685 std::string testCaseName = methodName.substr( 15 );
4686 std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
4687 std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
4688 const char* className = class_getName( cls );
4689
4690 getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) );
4691 noTestMethods++;
4692 }
4693 }
4694 free(methods);
4695 }
4696 }
4697 return noTestMethods;
4698 }
4699
4700 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
4701
4702 namespace Matchers {
4703 namespace Impl {
4704 namespace NSStringMatchers {
4705
4706 struct StringHolder : MatcherBase<NSString*>{
4707 StringHolder( NSString* substr ) : m_substr( [substr copy] ){}
4708 StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){}
4709 StringHolder() {
4710 arcSafeRelease( m_substr );
4711 }
4712
4713 bool match( NSString* const& str ) const override {
4714 return false;
4715 }
4716
4717 NSString* CATCH_ARC_STRONG m_substr;
4718 };
4719
4720 struct Equals : StringHolder {
4721 Equals( NSString* substr ) : StringHolder( substr ){}
4722
4723 bool match( NSString* const& str ) const override {
4724 return (str != nil || m_substr == nil ) &&
4725 [str isEqualToString:m_substr];
4726 }
4727
4728 std::string describe() const override {
4729 return "equals string: " + Catch::Detail::stringify( m_substr );
4730 }
4731 };
4732
4733 struct Contains : StringHolder {
4734 Contains( NSString* substr ) : StringHolder( substr ){}
4735
4736 bool match( NSString* const& str ) const override {
4737 return (str != nil || m_substr == nil ) &&
4738 [str rangeOfString:m_substr].location != NSNotFound;
4739 }
4740
4741 std::string describe() const override {
4742 return "contains string: " + Catch::Detail::stringify( m_substr );
4743 }
4744 };
4745
4746 struct StartsWith : StringHolder {
4747 StartsWith( NSString* substr ) : StringHolder( substr ){}
4748
4749 bool match( NSString* const& str ) const override {
4750 return (str != nil || m_substr == nil ) &&
4751 [str rangeOfString:m_substr].location == 0;
4752 }
4753
4754 std::string describe() const override {
4755 return "starts with: " + Catch::Detail::stringify( m_substr );
4756 }
4757 };
4758 struct EndsWith : StringHolder {
4759 EndsWith( NSString* substr ) : StringHolder( substr ){}
4760
4761 bool match( NSString* const& str ) const override {
4762 return (str != nil || m_substr == nil ) &&
4763 [str rangeOfString:m_substr].location == [str length] - [m_substr length];
4764 }
4765
4766 std::string describe() const override {
4767 return "ends with: " + Catch::Detail::stringify( m_substr );
4768 }
4769 };
4770
4771 } // namespace NSStringMatchers
4772 } // namespace Impl
4773
4774 inline Impl::NSStringMatchers::Equals
4775 Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); }
4776
4777 inline Impl::NSStringMatchers::Contains
4778 Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); }
4779
4780 inline Impl::NSStringMatchers::StartsWith
4781 StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); }
4782
4783 inline Impl::NSStringMatchers::EndsWith
4784 EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); }
4785
4786 } // namespace Matchers
4787
4788 using namespace Matchers;
4789
4790 #endif // CATCH_CONFIG_DISABLE_MATCHERS
4791
4792 } // namespace Catch
4793
4794 ///////////////////////////////////////////////////////////////////////////////
4795 #define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix
4796 #define OC_TEST_CASE2( name, desc, uniqueSuffix ) \
4797 +(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \
4798 { \
4799 return @ name; \
4800 } \
4801 +(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \
4802 { \
4803 return @ desc; \
4804 } \
4805 -(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix )
4806
4807 #define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ )
4808
4809 // end catch_objc.hpp
4810 #endif
4811
4812 // Benchmarking needs the externally-facing parts of reporters to work
4813 #if defined(CATCH_CONFIG_EXTERNAL_INTERFACES) || defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
4814 // start catch_external_interfaces.h
4815
4816 // start catch_reporter_bases.hpp
4817
4818 // start catch_interfaces_reporter.h
4819
4820 // start catch_config.hpp
4821
4822 // start catch_test_spec_parser.h
4823
4824 #ifdef __clang__
4825 #pragma clang diagnostic push
4826 #pragma clang diagnostic ignored "-Wpadded"
4827 #endif
4828
4829 // start catch_test_spec.h
4830
4831 #ifdef __clang__
4832 #pragma clang diagnostic push
4833 #pragma clang diagnostic ignored "-Wpadded"
4834 #endif
4835
4836 // start catch_wildcard_pattern.h
4837
4838 namespace Catch
4839 {
4840 class WildcardPattern {
4841 enum WildcardPosition {
4842 NoWildcard = 0,
4843 WildcardAtStart = 1,
4844 WildcardAtEnd = 2,
4845 WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd
4846 };
4847
4848 public:
4849
4850 WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity );
4851 virtual ~WildcardPattern() = default;
4852 virtual bool matches( std::string const& str ) const;
4853
4854 private:
4855 std::string adjustCase( std::string const& str ) const;
4856 CaseSensitive::Choice m_caseSensitivity;
4857 WildcardPosition m_wildcard = NoWildcard;
4858 std::string m_pattern;
4859 };
4860 }
4861
4862 // end catch_wildcard_pattern.h
4863 #include <string>
4864 #include <vector>
4865 #include <memory>
4866
4867 namespace Catch {
4868
4869 class TestSpec {
4870 struct Pattern {
4871 virtual ~Pattern();
4872 virtual bool matches( TestCaseInfo const& testCase ) const = 0;
4873 };
4874 using PatternPtr = std::shared_ptr<Pattern>;
4875
4876 class NamePattern : public Pattern {
4877 public:
4878 NamePattern( std::string const& name );
4879 virtual ~NamePattern();
4880 bool matches( TestCaseInfo const& testCase ) const override;
4881 private:
4882 WildcardPattern m_wildcardPattern;
4883 };
4884
4885 class TagPattern : public Pattern {
4886 public:
4887 TagPattern( std::string const& tag );
4888 virtual ~TagPattern();
4889 bool matches( TestCaseInfo const& testCase ) const override;
4890 private:
4891 std::string m_tag;
4892 };
4893
4894 class ExcludedPattern : public Pattern {
4895 public:
4896 ExcludedPattern( PatternPtr const& underlyingPattern );
4897 virtual ~ExcludedPattern();
4898 bool matches( TestCaseInfo const& testCase ) const override;
4899 private:
4900 PatternPtr m_underlyingPattern;
4901 };
4902
4903 struct Filter {
4904 std::vector<PatternPtr> m_patterns;
4905
4906 bool matches( TestCaseInfo const& testCase ) const;
4907 };
4908
4909 public:
4910 bool hasFilters() const;
4911 bool matches( TestCaseInfo const& testCase ) const;
4912
4913 private:
4914 std::vector<Filter> m_filters;
4915
4916 friend class TestSpecParser;
4917 };
4918 }
4919
4920 #ifdef __clang__
4921 #pragma clang diagnostic pop
4922 #endif
4923
4924 // end catch_test_spec.h
4925 // start catch_interfaces_tag_alias_registry.h
4926
4927 #include <string>
4928
4929 namespace Catch {
4930
4931 struct TagAlias;
4932
4933 struct ITagAliasRegistry {
4934 virtual ~ITagAliasRegistry();
4935 // Nullptr if not present
4936 virtual TagAlias const* find( std::string const& alias ) const = 0;
4937 virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0;
4938
4939 static ITagAliasRegistry const& get();
4940 };
4941
4942 } // end namespace Catch
4943
4944 // end catch_interfaces_tag_alias_registry.h
4945 namespace Catch {
4946
4947 class TestSpecParser {
4948 enum Mode{ None, Name, QuotedName, Tag, EscapedName };
4949 Mode m_mode = None;
4950 bool m_exclusion = false;
4951 std::size_t m_start = std::string::npos, m_pos = 0;
4952 std::string m_arg;
4953 std::vector<std::size_t> m_escapeChars;
4954 TestSpec::Filter m_currentFilter;
4955 TestSpec m_testSpec;
4956 ITagAliasRegistry const* m_tagAliases = nullptr;
4957
4958 public:
4959 TestSpecParser( ITagAliasRegistry const& tagAliases );
4960
4961 TestSpecParser& parse( std::string const& arg );
4962 TestSpec testSpec();
4963
4964 private:
4965 void visitChar( char c );
4966 void startNewMode( Mode mode, std::size_t start );
4967 void escape();
4968 std::string subString() const;
4969
4970 template<typename T>
4971 void addPattern() {
4972 std::string token = subString();
4973 for( std::size_t i = 0; i < m_escapeChars.size(); ++i )
4974 token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 );
4975 m_escapeChars.clear();
4976 if( startsWith( token, "exclude:" ) ) {
4977 m_exclusion = true;
4978 token = token.substr( 8 );
4979 }
4980 if( !token.empty() ) {
4981 TestSpec::PatternPtr pattern = std::make_shared<T>( token );
4982 if( m_exclusion )
4983 pattern = std::make_shared<TestSpec::ExcludedPattern>( pattern );
4984 m_currentFilter.m_patterns.push_back( pattern );
4985 }
4986 m_exclusion = false;
4987 m_mode = None;
4988 }
4989
4990 void addFilter();
4991 };
4992 TestSpec parseTestSpec( std::string const& arg );
4993
4994 } // namespace Catch
4995
4996 #ifdef __clang__
4997 #pragma clang diagnostic pop
4998 #endif
4999
5000 // end catch_test_spec_parser.h
5001 // Libstdc++ doesn't like incomplete classes for unique_ptr
5002
5003 #include <memory>
5004 #include <vector>
5005 #include <string>
5006
5007 #ifndef CATCH_CONFIG_CONSOLE_WIDTH
5008 #define CATCH_CONFIG_CONSOLE_WIDTH 80
5009 #endif
5010
5011 namespace Catch {
5012
5013 struct IStream;
5014
5015 struct ConfigData {
5016 bool listTests = false;
5017 bool listTags = false;
5018 bool listReporters = false;
5019 bool listTestNamesOnly = false;
5020
5021 bool showSuccessfulTests = false;
5022 bool shouldDebugBreak = false;
5023 bool noThrow = false;
5024 bool showHelp = false;
5025 bool showInvisibles = false;
5026 bool filenamesAsTags = false;
5027 bool libIdentify = false;
5028
5029 int abortAfter = -1;
5030 unsigned int rngSeed = 0;
5031
5032 bool benchmarkNoAnalysis = false;
5033 unsigned int benchmarkSamples = 100;
5034 double benchmarkConfidenceInterval = 0.95;
5035 unsigned int benchmarkResamples = 100000;
5036
5037 Verbosity verbosity = Verbosity::Normal;
5038 WarnAbout::What warnings = WarnAbout::Nothing;
5039 ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;
5040 RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;
5041 UseColour::YesOrNo useColour = UseColour::Auto;
5042 WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
5043
5044 std::string outputFilename;
5045 std::string name;
5046 std::string processName;
5047 #ifndef CATCH_CONFIG_DEFAULT_REPORTER
5048 #define CATCH_CONFIG_DEFAULT_REPORTER "console"
5049 #endif
5050 std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER;
5051 #undef CATCH_CONFIG_DEFAULT_REPORTER
5052
5053 std::vector<std::string> testsOrTags;
5054 std::vector<std::string> sectionsToRun;
5055 };
5056
5057 class Config : public IConfig {
5058 public:
5059
5060 Config() = default;
5061 Config( ConfigData const& data );
5062 virtual ~Config() = default;
5063
5064 std::string const& getFilename() const;
5065
5066 bool listTests() const;
5067 bool listTestNamesOnly() const;
5068 bool listTags() const;
5069 bool listReporters() const;
5070
5071 std::string getProcessName() const;
5072 std::string const& getReporterName() const;
5073
5074 std::vector<std::string> const& getTestsOrTags() const override;
5075 std::vector<std::string> const& getSectionsToRun() const override;
5076
5077 TestSpec const& testSpec() const override;
5078 bool hasTestFilters() const override;
5079
5080 bool showHelp() const;
5081
5082 // IConfig interface
5083 bool allowThrows() const override;
5084 std::ostream& stream() const override;
5085 std::string name() const override;
5086 bool includeSuccessfulResults() const override;
5087 bool warnAboutMissingAssertions() const override;
5088 bool warnAboutNoTests() const override;
5089 ShowDurations::OrNot showDurations() const override;
5090 RunTests::InWhatOrder runOrder() const override;
5091 unsigned int rngSeed() const override;
5092 UseColour::YesOrNo useColour() const override;
5093 bool shouldDebugBreak() const override;
5094 int abortAfter() const override;
5095 bool showInvisibles() const override;
5096 Verbosity verbosity() const override;
5097 bool benchmarkNoAnalysis() const override;
5098 int benchmarkSamples() const override;
5099 double benchmarkConfidenceInterval() const override;
5100 unsigned int benchmarkResamples() const override;
5101
5102 private:
5103
5104 IStream const* openStream();
5105 ConfigData m_data;
5106
5107 std::unique_ptr<IStream const> m_stream;
5108 TestSpec m_testSpec;
5109 bool m_hasTestFilters = false;
5110 };
5111
5112 } // end namespace Catch
5113
5114 // end catch_config.hpp
5115 // start catch_assertionresult.h
5116
5117 #include <string>
5118
5119 namespace Catch {
5120
5121 struct AssertionResultData
5122 {
5123 AssertionResultData() = delete;
5124
5125 AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
5126
5127 std::string message;
5128 mutable std::string reconstructedExpression;
5129 LazyExpression lazyExpression;
5130 ResultWas::OfType resultType;
5131
5132 std::string reconstructExpression() const;
5133 };
5134
5135 class AssertionResult {
5136 public:
5137 AssertionResult() = delete;
5138 AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
5139
5140 bool isOk() const;
5141 bool succeeded() const;
5142 ResultWas::OfType getResultType() const;
5143 bool hasExpression() const;
5144 bool hasMessage() const;
5145 std::string getExpression() const;
5146 std::string getExpressionInMacro() const;
5147 bool hasExpandedExpression() const;
5148 std::string getExpandedExpression() const;
5149 std::string getMessage() const;
5150 SourceLineInfo getSourceInfo() const;
5151 StringRef getTestMacroName() const;
5152
5153 //protected:
5154 AssertionInfo m_info;
5155 AssertionResultData m_resultData;
5156 };
5157
5158 } // end namespace Catch
5159
5160 // end catch_assertionresult.h
5161 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
5162 // start catch_estimate.hpp
5163
5164 // Statistics estimates
5165
5166
5167 namespace Catch {
5168 namespace Benchmark {
5169 template <typename Duration>
5170 struct Estimate {
5171 Duration point;
5172 Duration lower_bound;
5173 Duration upper_bound;
5174 double confidence_interval;
5175
5176 template <typename Duration2>
5177 operator Estimate<Duration2>() const {
5178 return { point, lower_bound, upper_bound, confidence_interval };
5179 }
5180 };
5181 } // namespace Benchmark
5182 } // namespace Catch
5183
5184 // end catch_estimate.hpp
5185 // start catch_outlier_classification.hpp
5186
5187 // Outlier information
5188
5189 namespace Catch {
5190 namespace Benchmark {
5191 struct OutlierClassification {
5192 int samples_seen = 0;
5193 int low_severe = 0; // more than 3 times IQR below Q1
5194 int low_mild = 0; // 1.5 to 3 times IQR below Q1
5195 int high_mild = 0; // 1.5 to 3 times IQR above Q3
5196 int high_severe = 0; // more than 3 times IQR above Q3
5197
5198 int total() const {
5199 return low_severe + low_mild + high_mild + high_severe;
5200 }
5201 };
5202 } // namespace Benchmark
5203 } // namespace Catch
5204
5205 // end catch_outlier_classification.hpp
5206 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
5207
5208 #include <string>
5209 #include <iosfwd>
5210 #include <map>
5211 #include <set>
5212 #include <memory>
5213 #include <algorithm>
5214
5215 namespace Catch {
5216
5217 struct ReporterConfig {
5218 explicit ReporterConfig( IConfigPtr const& _fullConfig );
5219
5220 ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream );
5221
5222 std::ostream& stream() const;
5223 IConfigPtr fullConfig() const;
5224
5225 private:
5226 std::ostream* m_stream;
5227 IConfigPtr m_fullConfig;
5228 };
5229
5230 struct ReporterPreferences {
5231 bool shouldRedirectStdOut = false;
5232 bool shouldReportAllAssertions = false;
5233 };
5234
5235 template<typename T>
5236 struct LazyStat : Option<T> {
5237 LazyStat& operator=( T const& _value ) {
5238 Option<T>::operator=( _value );
5239 used = false;
5240 return *this;
5241 }
5242 void reset() {
5243 Option<T>::reset();
5244 used = false;
5245 }
5246 bool used = false;
5247 };
5248
5249 struct TestRunInfo {
5250 TestRunInfo( std::string const& _name );
5251 std::string name;
5252 };
5253 struct GroupInfo {
5254 GroupInfo( std::string const& _name,
5255 std::size_t _groupIndex,
5256 std::size_t _groupsCount );
5257
5258 std::string name;
5259 std::size_t groupIndex;
5260 std::size_t groupsCounts;
5261 };
5262
5263 struct AssertionStats {
5264 AssertionStats( AssertionResult const& _assertionResult,
5265 std::vector<MessageInfo> const& _infoMessages,
5266 Totals const& _totals );
5267
5268 AssertionStats( AssertionStats const& ) = default;
5269 AssertionStats( AssertionStats && ) = default;
5270 AssertionStats& operator = ( AssertionStats const& ) = delete;
5271 AssertionStats& operator = ( AssertionStats && ) = delete;
5272 virtual ~AssertionStats();
5273
5274 AssertionResult assertionResult;
5275 std::vector<MessageInfo> infoMessages;
5276 Totals totals;
5277 };
5278
5279 struct SectionStats {
5280 SectionStats( SectionInfo const& _sectionInfo,
5281 Counts const& _assertions,
5282 double _durationInSeconds,
5283 bool _missingAssertions );
5284 SectionStats( SectionStats const& ) = default;
5285 SectionStats( SectionStats && ) = default;
5286 SectionStats& operator = ( SectionStats const& ) = default;
5287 SectionStats& operator = ( SectionStats && ) = default;
5288 virtual ~SectionStats();
5289
5290 SectionInfo sectionInfo;
5291 Counts assertions;
5292 double durationInSeconds;
5293 bool missingAssertions;
5294 };
5295
5296 struct TestCaseStats {
5297 TestCaseStats( TestCaseInfo const& _testInfo,
5298 Totals const& _totals,
5299 std::string const& _stdOut,
5300 std::string const& _stdErr,
5301 bool _aborting );
5302
5303 TestCaseStats( TestCaseStats const& ) = default;
5304 TestCaseStats( TestCaseStats && ) = default;
5305 TestCaseStats& operator = ( TestCaseStats const& ) = default;
5306 TestCaseStats& operator = ( TestCaseStats && ) = default;
5307 virtual ~TestCaseStats();
5308
5309 TestCaseInfo testInfo;
5310 Totals totals;
5311 std::string stdOut;
5312 std::string stdErr;
5313 bool aborting;
5314 };
5315
5316 struct TestGroupStats {
5317 TestGroupStats( GroupInfo const& _groupInfo,
5318 Totals const& _totals,
5319 bool _aborting );
5320 TestGroupStats( GroupInfo const& _groupInfo );
5321
5322 TestGroupStats( TestGroupStats const& ) = default;
5323 TestGroupStats( TestGroupStats && ) = default;
5324 TestGroupStats& operator = ( TestGroupStats const& ) = default;
5325 TestGroupStats& operator = ( TestGroupStats && ) = default;
5326 virtual ~TestGroupStats();
5327
5328 GroupInfo groupInfo;
5329 Totals totals;
5330 bool aborting;
5331 };
5332
5333 struct TestRunStats {
5334 TestRunStats( TestRunInfo const& _runInfo,
5335 Totals const& _totals,
5336 bool _aborting );
5337
5338 TestRunStats( TestRunStats const& ) = default;
5339 TestRunStats( TestRunStats && ) = default;
5340 TestRunStats& operator = ( TestRunStats const& ) = default;
5341 TestRunStats& operator = ( TestRunStats && ) = default;
5342 virtual ~TestRunStats();
5343
5344 TestRunInfo runInfo;
5345 Totals totals;
5346 bool aborting;
5347 };
5348
5349 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
5350 struct BenchmarkInfo {
5351 std::string name;
5352 double estimatedDuration;
5353 int iterations;
5354 int samples;
5355 unsigned int resamples;
5356 double clockResolution;
5357 double clockCost;
5358 };
5359
5360 template <class Duration>
5361 struct BenchmarkStats {
5362 BenchmarkInfo info;
5363
5364 std::vector<Duration> samples;
5365 Benchmark::Estimate<Duration> mean;
5366 Benchmark::Estimate<Duration> standardDeviation;
5367 Benchmark::OutlierClassification outliers;
5368 double outlierVariance;
5369
5370 template <typename Duration2>
5371 operator BenchmarkStats<Duration2>() const {
5372 std::vector<Duration2> samples2;
5373 samples2.reserve(samples.size());
5374 std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); });
5375 return {
5376 info,
5377 std::move(samples2),
5378 mean,
5379 standardDeviation,
5380 outliers,
5381 outlierVariance,
5382 };
5383 }
5384 };
5385 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
5386
5387 struct IStreamingReporter {
5388 virtual ~IStreamingReporter() = default;
5389
5390 // Implementing class must also provide the following static methods:
5391 // static std::string getDescription();
5392 // static std::set<Verbosity> getSupportedVerbosities()
5393
5394 virtual ReporterPreferences getPreferences() const = 0;
5395
5396 virtual void noMatchingTestCases( std::string const& spec ) = 0;
5397
5398 virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;
5399 virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;
5400
5401 virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;
5402 virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
5403
5404 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
5405 virtual void benchmarkPreparing( std::string const& ) {}
5406 virtual void benchmarkStarting( BenchmarkInfo const& ) {}
5407 virtual void benchmarkEnded( BenchmarkStats<> const& ) {}
5408 virtual void benchmarkFailed( std::string const& ) {}
5409 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
5410
5411 virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
5412
5413 // The return value indicates if the messages buffer should be cleared:
5414 virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0;
5415
5416 virtual void sectionEnded( SectionStats const& sectionStats ) = 0;
5417 virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0;
5418 virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0;
5419 virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;
5420
5421 virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
5422
5423 // Default empty implementation provided
5424 virtual void fatalErrorEncountered( StringRef name );
5425
5426 virtual bool isMulti() const;
5427 };
5428 using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>;
5429
5430 struct IReporterFactory {
5431 virtual ~IReporterFactory();
5432 virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;
5433 virtual std::string getDescription() const = 0;
5434 };
5435 using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
5436
5437 struct IReporterRegistry {
5438 using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
5439 using Listeners = std::vector<IReporterFactoryPtr>;
5440
5441 virtual ~IReporterRegistry();
5442 virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0;
5443 virtual FactoryMap const& getFactories() const = 0;
5444 virtual Listeners const& getListeners() const = 0;
5445 };
5446
5447 } // end namespace Catch
5448
5449 // end catch_interfaces_reporter.h
5450 #include <algorithm>
5451 #include <cstring>
5452 #include <cfloat>
5453 #include <cstdio>
5454 #include <cassert>
5455 #include <memory>
5456 #include <ostream>
5457
5458 namespace Catch {
5459 void prepareExpandedExpression(AssertionResult& result);
5460
5461 // Returns double formatted as %.3f (format expected on output)
5462 std::string getFormattedDuration( double duration );
5463
5464 std::string serializeFilters( std::vector<std::string> const& container );
5465
5466 template<typename DerivedT>
5467 struct StreamingReporterBase : IStreamingReporter {
5468
5469 StreamingReporterBase( ReporterConfig const& _config )
5470 : m_config( _config.fullConfig() ),
5471 stream( _config.stream() )
5472 {
5473 m_reporterPrefs.shouldRedirectStdOut = false;
5474 if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )
5475 CATCH_ERROR( "Verbosity level not supported by this reporter" );
5476 }
5477
5478 ReporterPreferences getPreferences() const override {
5479 return m_reporterPrefs;
5480 }
5481
5482 static std::set<Verbosity> getSupportedVerbosities() {
5483 return { Verbosity::Normal };
5484 }
5485
5486 ~StreamingReporterBase() override = default;
5487
5488 void noMatchingTestCases(std::string const&) override {}
5489
5490 void testRunStarting(TestRunInfo const& _testRunInfo) override {
5491 currentTestRunInfo = _testRunInfo;
5492 }
5493
5494 void testGroupStarting(GroupInfo const& _groupInfo) override {
5495 currentGroupInfo = _groupInfo;
5496 }
5497
5498 void testCaseStarting(TestCaseInfo const& _testInfo) override {
5499 currentTestCaseInfo = _testInfo;
5500 }
5501 void sectionStarting(SectionInfo const& _sectionInfo) override {
5502 m_sectionStack.push_back(_sectionInfo);
5503 }
5504
5505 void sectionEnded(SectionStats const& /* _sectionStats */) override {
5506 m_sectionStack.pop_back();
5507 }
5508 void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {
5509 currentTestCaseInfo.reset();
5510 }
5511 void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override {
5512 currentGroupInfo.reset();
5513 }
5514 void testRunEnded(TestRunStats const& /* _testRunStats */) override {
5515 currentTestCaseInfo.reset();
5516 currentGroupInfo.reset();
5517 currentTestRunInfo.reset();
5518 }
5519
5520 void skipTest(TestCaseInfo const&) override {
5521 // Don't do anything with this by default.
5522 // It can optionally be overridden in the derived class.
5523 }
5524
5525 IConfigPtr m_config;
5526 std::ostream& stream;
5527
5528 LazyStat<TestRunInfo> currentTestRunInfo;
5529 LazyStat<GroupInfo> currentGroupInfo;
5530 LazyStat<TestCaseInfo> currentTestCaseInfo;
5531
5532 std::vector<SectionInfo> m_sectionStack;
5533 ReporterPreferences m_reporterPrefs;
5534 };
5535
5536 template<typename DerivedT>
5537 struct CumulativeReporterBase : IStreamingReporter {
5538 template<typename T, typename ChildNodeT>
5539 struct Node {
5540 explicit Node( T const& _value ) : value( _value ) {}
5541 virtual ~Node() {}
5542
5543 using ChildNodes = std::vector<std::shared_ptr<ChildNodeT>>;
5544 T value;
5545 ChildNodes children;
5546 };
5547 struct SectionNode {
5548 explicit SectionNode(SectionStats const& _stats) : stats(_stats) {}
5549 virtual ~SectionNode() = default;
5550
5551 bool operator == (SectionNode const& other) const {
5552 return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo;
5553 }
5554 bool operator == (std::shared_ptr<SectionNode> const& other) const {
5555 return operator==(*other);
5556 }
5557
5558 SectionStats stats;
5559 using ChildSections = std::vector<std::shared_ptr<SectionNode>>;
5560 using Assertions = std::vector<AssertionStats>;
5561 ChildSections childSections;
5562 Assertions assertions;
5563 std::string stdOut;
5564 std::string stdErr;
5565 };
5566
5567 struct BySectionInfo {
5568 BySectionInfo( SectionInfo const& other ) : m_other( other ) {}
5569 BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {}
5570 bool operator() (std::shared_ptr<SectionNode> const& node) const {
5571 return ((node->stats.sectionInfo.name == m_other.name) &&
5572 (node->stats.sectionInfo.lineInfo == m_other.lineInfo));
5573 }
5574 void operator=(BySectionInfo const&) = delete;
5575
5576 private:
5577 SectionInfo const& m_other;
5578 };
5579
5580 using TestCaseNode = Node<TestCaseStats, SectionNode>;
5581 using TestGroupNode = Node<TestGroupStats, TestCaseNode>;
5582 using TestRunNode = Node<TestRunStats, TestGroupNode>;
5583
5584 CumulativeReporterBase( ReporterConfig const& _config )
5585 : m_config( _config.fullConfig() ),
5586 stream( _config.stream() )
5587 {
5588 m_reporterPrefs.shouldRedirectStdOut = false;
5589 if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )
5590 CATCH_ERROR( "Verbosity level not supported by this reporter" );
5591 }
5592 ~CumulativeReporterBase() override = default;
5593
5594 ReporterPreferences getPreferences() const override {
5595 return m_reporterPrefs;
5596 }
5597
5598 static std::set<Verbosity> getSupportedVerbosities() {
5599 return { Verbosity::Normal };
5600 }
5601
5602 void testRunStarting( TestRunInfo const& ) override {}
5603 void testGroupStarting( GroupInfo const& ) override {}
5604
5605 void testCaseStarting( TestCaseInfo const& ) override {}
5606
5607 void sectionStarting( SectionInfo const& sectionInfo ) override {
5608 SectionStats incompleteStats( sectionInfo, Counts(), 0, false );
5609 std::shared_ptr<SectionNode> node;
5610 if( m_sectionStack.empty() ) {
5611 if( !m_rootSection )
5612 m_rootSection = std::make_shared<SectionNode>( incompleteStats );
5613 node = m_rootSection;
5614 }
5615 else {
5616 SectionNode& parentNode = *m_sectionStack.back();
5617 auto it =
5618 std::find_if( parentNode.childSections.begin(),
5619 parentNode.childSections.end(),
5620 BySectionInfo( sectionInfo ) );
5621 if( it == parentNode.childSections.end() ) {
5622 node = std::make_shared<SectionNode>( incompleteStats );
5623 parentNode.childSections.push_back( node );
5624 }
5625 else
5626 node = *it;
5627 }
5628 m_sectionStack.push_back( node );
5629 m_deepestSection = std::move(node);
5630 }
5631
5632 void assertionStarting(AssertionInfo const&) override {}
5633
5634 bool assertionEnded(AssertionStats const& assertionStats) override {
5635 assert(!m_sectionStack.empty());
5636 // AssertionResult holds a pointer to a temporary DecomposedExpression,
5637 // which getExpandedExpression() calls to build the expression string.
5638 // Our section stack copy of the assertionResult will likely outlive the
5639 // temporary, so it must be expanded or discarded now to avoid calling
5640 // a destroyed object later.
5641 prepareExpandedExpression(const_cast<AssertionResult&>( assertionStats.assertionResult ) );
5642 SectionNode& sectionNode = *m_sectionStack.back();
5643 sectionNode.assertions.push_back(assertionStats);
5644 return true;
5645 }
5646 void sectionEnded(SectionStats const& sectionStats) override {
5647 assert(!m_sectionStack.empty());
5648 SectionNode& node = *m_sectionStack.back();
5649 node.stats = sectionStats;
5650 m_sectionStack.pop_back();
5651 }
5652 void testCaseEnded(TestCaseStats const& testCaseStats) override {
5653 auto node = std::make_shared<TestCaseNode>(testCaseStats);
5654 assert(m_sectionStack.size() == 0);
5655 node->children.push_back(m_rootSection);
5656 m_testCases.push_back(node);
5657 m_rootSection.reset();
5658
5659 assert(m_deepestSection);
5660 m_deepestSection->stdOut = testCaseStats.stdOut;
5661 m_deepestSection->stdErr = testCaseStats.stdErr;
5662 }
5663 void testGroupEnded(TestGroupStats const& testGroupStats) override {
5664 auto node = std::make_shared<TestGroupNode>(testGroupStats);
5665 node->children.swap(m_testCases);
5666 m_testGroups.push_back(node);
5667 }
5668 void testRunEnded(TestRunStats const& testRunStats) override {
5669 auto node = std::make_shared<TestRunNode>(testRunStats);
5670 node->children.swap(m_testGroups);
5671 m_testRuns.push_back(node);
5672 testRunEndedCumulative();
5673 }
5674 virtual void testRunEndedCumulative() = 0;
5675
5676 void skipTest(TestCaseInfo const&) override {}
5677
5678 IConfigPtr m_config;
5679 std::ostream& stream;
5680 std::vector<AssertionStats> m_assertions;
5681 std::vector<std::vector<std::shared_ptr<SectionNode>>> m_sections;
5682 std::vector<std::shared_ptr<TestCaseNode>> m_testCases;
5683 std::vector<std::shared_ptr<TestGroupNode>> m_testGroups;
5684
5685 std::vector<std::shared_ptr<TestRunNode>> m_testRuns;
5686
5687 std::shared_ptr<SectionNode> m_rootSection;
5688 std::shared_ptr<SectionNode> m_deepestSection;
5689 std::vector<std::shared_ptr<SectionNode>> m_sectionStack;
5690 ReporterPreferences m_reporterPrefs;
5691 };
5692
5693 template<char C>
5694 char const* getLineOfChars() {
5695 static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};
5696 if( !*line ) {
5697 std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 );
5698 line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;
5699 }
5700 return line;
5701 }
5702
5703 struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {
5704 TestEventListenerBase( ReporterConfig const& _config );
5705
5706 static std::set<Verbosity> getSupportedVerbosities();
5707
5708 void assertionStarting(AssertionInfo const&) override;
5709 bool assertionEnded(AssertionStats const&) override;
5710 };
5711
5712 } // end namespace Catch
5713
5714 // end catch_reporter_bases.hpp
5715 // start catch_console_colour.h
5716
5717 namespace Catch {
5718
5719 struct Colour {
5720 enum Code {
5721 None = 0,
5722
5723 White,
5724 Red,
5725 Green,
5726 Blue,
5727 Cyan,
5728 Yellow,
5729 Grey,
5730
5731 Bright = 0x10,
5732
5733 BrightRed = Bright | Red,
5734 BrightGreen = Bright | Green,
5735 LightGrey = Bright | Grey,
5736 BrightWhite = Bright | White,
5737 BrightYellow = Bright | Yellow,
5738
5739 // By intention
5740 FileName = LightGrey,
5741 Warning = BrightYellow,
5742 ResultError = BrightRed,
5743 ResultSuccess = BrightGreen,
5744 ResultExpectedFailure = Warning,
5745
5746 Error = BrightRed,
5747 Success = Green,
5748
5749 OriginalExpression = Cyan,
5750 ReconstructedExpression = BrightYellow,
5751
5752 SecondaryText = LightGrey,
5753 Headers = White
5754 };
5755
5756 // Use constructed object for RAII guard
5757 Colour( Code _colourCode );
5758 Colour( Colour&& other ) noexcept;
5759 Colour& operator=( Colour&& other ) noexcept;
5760 ~Colour();
5761
5762 // Use static method for one-shot changes
5763 static void use( Code _colourCode );
5764
5765 private:
5766 bool m_moved = false;
5767 };
5768
5769 std::ostream& operator << ( std::ostream& os, Colour const& );
5770
5771 } // end namespace Catch
5772
5773 // end catch_console_colour.h
5774 // start catch_reporter_registrars.hpp
5775
5776
5777 namespace Catch {
5778
5779 template<typename T>
5780 class ReporterRegistrar {
5781
5782 class ReporterFactory : public IReporterFactory {
5783
5784 IStreamingReporterPtr create( ReporterConfig const& config ) const override {
5785 return std::unique_ptr<T>( new T( config ) );
5786 }
5787
5788 std::string getDescription() const override {
5789 return T::getDescription();
5790 }
5791 };
5792
5793 public:
5794
5795 explicit ReporterRegistrar( std::string const& name ) {
5796 getMutableRegistryHub().registerReporter( name, std::make_shared<ReporterFactory>() );
5797 }
5798 };
5799
5800 template<typename T>
5801 class ListenerRegistrar {
5802
5803 class ListenerFactory : public IReporterFactory {
5804
5805 IStreamingReporterPtr create( ReporterConfig const& config ) const override {
5806 return std::unique_ptr<T>( new T( config ) );
5807 }
5808 std::string getDescription() const override {
5809 return std::string();
5810 }
5811 };
5812
5813 public:
5814
5815 ListenerRegistrar() {
5816 getMutableRegistryHub().registerListener( std::make_shared<ListenerFactory>() );
5817 }
5818 };
5819 }
5820
5821 #if !defined(CATCH_CONFIG_DISABLE)
5822
5823 #define CATCH_REGISTER_REPORTER( name, reporterType ) \
5824 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
5825 namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \
5826 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
5827
5828 #define CATCH_REGISTER_LISTENER( listenerType ) \
5829 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
5830 namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \
5831 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
5832 #else // CATCH_CONFIG_DISABLE
5833
5834 #define CATCH_REGISTER_REPORTER(name, reporterType)
5835 #define CATCH_REGISTER_LISTENER(listenerType)
5836
5837 #endif // CATCH_CONFIG_DISABLE
5838
5839 // end catch_reporter_registrars.hpp
5840 // Allow users to base their work off existing reporters
5841 // start catch_reporter_compact.h
5842
5843 namespace Catch {
5844
5845 struct CompactReporter : StreamingReporterBase<CompactReporter> {
5846
5847 using StreamingReporterBase::StreamingReporterBase;
5848
5849 ~CompactReporter() override;
5850
5851 static std::string getDescription();
5852
5853 ReporterPreferences getPreferences() const override;
5854
5855 void noMatchingTestCases(std::string const& spec) override;
5856
5857 void assertionStarting(AssertionInfo const&) override;
5858
5859 bool assertionEnded(AssertionStats const& _assertionStats) override;
5860
5861 void sectionEnded(SectionStats const& _sectionStats) override;
5862
5863 void testRunEnded(TestRunStats const& _testRunStats) override;
5864
5865 };
5866
5867 } // end namespace Catch
5868
5869 // end catch_reporter_compact.h
5870 // start catch_reporter_console.h
5871
5872 #if defined(_MSC_VER)
5873 #pragma warning(push)
5874 #pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
5875 // Note that 4062 (not all labels are handled
5876 // and default is missing) is enabled
5877 #endif
5878
5879 namespace Catch {
5880 // Fwd decls
5881 struct SummaryColumn;
5882 class TablePrinter;
5883
5884 struct ConsoleReporter : StreamingReporterBase<ConsoleReporter> {
5885 std::unique_ptr<TablePrinter> m_tablePrinter;
5886
5887 ConsoleReporter(ReporterConfig const& config);
5888 ~ConsoleReporter() override;
5889 static std::string getDescription();
5890
5891 void noMatchingTestCases(std::string const& spec) override;
5892
5893 void assertionStarting(AssertionInfo const&) override;
5894
5895 bool assertionEnded(AssertionStats const& _assertionStats) override;
5896
5897 void sectionStarting(SectionInfo const& _sectionInfo) override;
5898 void sectionEnded(SectionStats const& _sectionStats) override;
5899
5900 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
5901 void benchmarkPreparing(std::string const& name) override;
5902 void benchmarkStarting(BenchmarkInfo const& info) override;
5903 void benchmarkEnded(BenchmarkStats<> const& stats) override;
5904 void benchmarkFailed(std::string const& error) override;
5905 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
5906
5907 void testCaseEnded(TestCaseStats const& _testCaseStats) override;
5908 void testGroupEnded(TestGroupStats const& _testGroupStats) override;
5909 void testRunEnded(TestRunStats const& _testRunStats) override;
5910 void testRunStarting(TestRunInfo const& _testRunInfo) override;
5911 private:
5912
5913 void lazyPrint();
5914
5915 void lazyPrintWithoutClosingBenchmarkTable();
5916 void lazyPrintRunInfo();
5917 void lazyPrintGroupInfo();
5918 void printTestCaseAndSectionHeader();
5919
5920 void printClosedHeader(std::string const& _name);
5921 void printOpenHeader(std::string const& _name);
5922
5923 // if string has a : in first line will set indent to follow it on
5924 // subsequent lines
5925 void printHeaderString(std::string const& _string, std::size_t indent = 0);
5926
5927 void printTotals(Totals const& totals);
5928 void printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row);
5929
5930 void printTotalsDivider(Totals const& totals);
5931 void printSummaryDivider();
5932 void printTestFilters();
5933
5934 private:
5935 bool m_headerPrinted = false;
5936 };
5937
5938 } // end namespace Catch
5939
5940 #if defined(_MSC_VER)
5941 #pragma warning(pop)
5942 #endif
5943
5944 // end catch_reporter_console.h
5945 // start catch_reporter_junit.h
5946
5947 // start catch_xmlwriter.h
5948
5949 #include <vector>
5950
5951 namespace Catch {
5952
5953 class XmlEncode {
5954 public:
5955 enum ForWhat { ForTextNodes, ForAttributes };
5956
5957 XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes );
5958
5959 void encodeTo( std::ostream& os ) const;
5960
5961 friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode );
5962
5963 private:
5964 std::string m_str;
5965 ForWhat m_forWhat;
5966 };
5967
5968 class XmlWriter {
5969 public:
5970
5971 class ScopedElement {
5972 public:
5973 ScopedElement( XmlWriter* writer );
5974
5975 ScopedElement( ScopedElement&& other ) noexcept;
5976 ScopedElement& operator=( ScopedElement&& other ) noexcept;
5977
5978 ~ScopedElement();
5979
5980 ScopedElement& writeText( std::string const& text, bool indent = true );
5981
5982 template<typename T>
5983 ScopedElement& writeAttribute( std::string const& name, T const& attribute ) {
5984 m_writer->writeAttribute( name, attribute );
5985 return *this;
5986 }
5987
5988 private:
5989 mutable XmlWriter* m_writer = nullptr;
5990 };
5991
5992 XmlWriter( std::ostream& os = Catch::cout() );
5993 ~XmlWriter();
5994
5995 XmlWriter( XmlWriter const& ) = delete;
5996 XmlWriter& operator=( XmlWriter const& ) = delete;
5997
5998 XmlWriter& startElement( std::string const& name );
5999
6000 ScopedElement scopedElement( std::string const& name );
6001
6002 XmlWriter& endElement();
6003
6004 XmlWriter& writeAttribute( std::string const& name, std::string const& attribute );
6005
6006 XmlWriter& writeAttribute( std::string const& name, bool attribute );
6007
6008 template<typename T>
6009 XmlWriter& writeAttribute( std::string const& name, T const& attribute ) {
6010 ReusableStringStream rss;
6011 rss << attribute;
6012 return writeAttribute( name, rss.str() );
6013 }
6014
6015 XmlWriter& writeText( std::string const& text, bool indent = true );
6016
6017 XmlWriter& writeComment( std::string const& text );
6018
6019 void writeStylesheetRef( std::string const& url );
6020
6021 XmlWriter& writeBlankLine();
6022
6023 void ensureTagClosed();
6024
6025 private:
6026
6027 void writeDeclaration();
6028
6029 void newlineIfNecessary();
6030
6031 bool m_tagIsOpen = false;
6032 bool m_needsNewline = false;
6033 std::vector<std::string> m_tags;
6034 std::string m_indent;
6035 std::ostream& m_os;
6036 };
6037
6038 }
6039
6040 // end catch_xmlwriter.h
6041 namespace Catch {
6042
6043 class JunitReporter : public CumulativeReporterBase<JunitReporter> {
6044 public:
6045 JunitReporter(ReporterConfig const& _config);
6046
6047 ~JunitReporter() override;
6048
6049 static std::string getDescription();
6050
6051 void noMatchingTestCases(std::string const& /*spec*/) override;
6052
6053 void testRunStarting(TestRunInfo const& runInfo) override;
6054
6055 void testGroupStarting(GroupInfo const& groupInfo) override;
6056
6057 void testCaseStarting(TestCaseInfo const& testCaseInfo) override;
6058 bool assertionEnded(AssertionStats const& assertionStats) override;
6059
6060 void testCaseEnded(TestCaseStats const& testCaseStats) override;
6061
6062 void testGroupEnded(TestGroupStats const& testGroupStats) override;
6063
6064 void testRunEndedCumulative() override;
6065
6066 void writeGroup(TestGroupNode const& groupNode, double suiteTime);
6067
6068 void writeTestCase(TestCaseNode const& testCaseNode);
6069
6070 void writeSection(std::string const& className,
6071 std::string const& rootName,
6072 SectionNode const& sectionNode);
6073
6074 void writeAssertions(SectionNode const& sectionNode);
6075 void writeAssertion(AssertionStats const& stats);
6076
6077 XmlWriter xml;
6078 Timer suiteTimer;
6079 std::string stdOutForSuite;
6080 std::string stdErrForSuite;
6081 unsigned int unexpectedExceptions = 0;
6082 bool m_okToFail = false;
6083 };
6084
6085 } // end namespace Catch
6086
6087 // end catch_reporter_junit.h
6088 // start catch_reporter_xml.h
6089
6090 namespace Catch {
6091 class XmlReporter : public StreamingReporterBase<XmlReporter> {
6092 public:
6093 XmlReporter(ReporterConfig const& _config);
6094
6095 ~XmlReporter() override;
6096
6097 static std::string getDescription();
6098
6099 virtual std::string getStylesheetRef() const;
6100
6101 void writeSourceInfo(SourceLineInfo const& sourceInfo);
6102
6103 public: // StreamingReporterBase
6104
6105 void noMatchingTestCases(std::string const& s) override;
6106
6107 void testRunStarting(TestRunInfo const& testInfo) override;
6108
6109 void testGroupStarting(GroupInfo const& groupInfo) override;
6110
6111 void testCaseStarting(TestCaseInfo const& testInfo) override;
6112
6113 void sectionStarting(SectionInfo const& sectionInfo) override;
6114
6115 void assertionStarting(AssertionInfo const&) override;
6116
6117 bool assertionEnded(AssertionStats const& assertionStats) override;
6118
6119 void sectionEnded(SectionStats const& sectionStats) override;
6120
6121 void testCaseEnded(TestCaseStats const& testCaseStats) override;
6122
6123 void testGroupEnded(TestGroupStats const& testGroupStats) override;
6124
6125 void testRunEnded(TestRunStats const& testRunStats) override;
6126
6127 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
6128 void benchmarkStarting(BenchmarkInfo const&) override;
6129 void benchmarkEnded(BenchmarkStats<> const&) override;
6130 void benchmarkFailed(std::string const&) override;
6131 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
6132
6133 private:
6134 Timer m_testCaseTimer;
6135 XmlWriter m_xml;
6136 int m_sectionDepth = 0;
6137 };
6138
6139 } // end namespace Catch
6140
6141 // end catch_reporter_xml.h
6142
6143 // end catch_external_interfaces.h
6144 #endif
6145
6146 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
6147 // start catch_benchmark.hpp
6148
6149 // Benchmark
6150
6151 // start catch_chronometer.hpp
6152
6153 // User-facing chronometer
6154
6155
6156 // start catch_clock.hpp
6157
6158 // Clocks
6159
6160
6161 #include <chrono>
6162 #include <ratio>
6163
6164 namespace Catch {
6165 namespace Benchmark {
6166 template <typename Clock>
6167 using ClockDuration = typename Clock::duration;
6168 template <typename Clock>
6169 using FloatDuration = std::chrono::duration<double, typename Clock::period>;
6170
6171 template <typename Clock>
6172 using TimePoint = typename Clock::time_point;
6173
6174 using default_clock = std::chrono::steady_clock;
6175
6176 template <typename Clock>
6177 struct now {
6178 TimePoint<Clock> operator()() const {
6179 return Clock::now();
6180 }
6181 };
6182
6183 using fp_seconds = std::chrono::duration<double, std::ratio<1>>;
6184 } // namespace Benchmark
6185 } // namespace Catch
6186
6187 // end catch_clock.hpp
6188 // start catch_optimizer.hpp
6189
6190 // Hinting the optimizer
6191
6192
6193 #if defined(_MSC_VER)
6194 # include <atomic> // atomic_thread_fence
6195 #endif
6196
6197 namespace Catch {
6198 namespace Benchmark {
6199 #if defined(__GNUC__) || defined(__clang__)
6200 template <typename T>
6201 inline void keep_memory(T* p) {
6202 asm volatile("" : : "g"(p) : "memory");
6203 }
6204 inline void keep_memory() {
6205 asm volatile("" : : : "memory");
6206 }
6207
6208 namespace Detail {
6209 inline void optimizer_barrier() { keep_memory(); }
6210 } // namespace Detail
6211 #elif defined(_MSC_VER)
6212
6213 #pragma optimize("", off)
6214 template <typename T>
6215 inline void keep_memory(T* p) {
6216 // thanks @milleniumbug
6217 *reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p);
6218 }
6219 // TODO equivalent keep_memory()
6220 #pragma optimize("", on)
6221
6222 namespace Detail {
6223 inline void optimizer_barrier() {
6224 std::atomic_thread_fence(std::memory_order_seq_cst);
6225 }
6226 } // namespace Detail
6227
6228 #endif
6229
6230 template <typename T>
6231 inline void deoptimize_value(T&& x) {
6232 keep_memory(&x);
6233 }
6234
6235 template <typename Fn, typename... Args>
6236 inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<!std::is_same<void, decltype(fn(args...))>::value>::type {
6237 deoptimize_value(std::forward<Fn>(fn) (std::forward<Args...>(args...)));
6238 }
6239
6240 template <typename Fn, typename... Args>
6241 inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<std::is_same<void, decltype(fn(args...))>::value>::type {
6242 std::forward<Fn>(fn) (std::forward<Args...>(args...));
6243 }
6244 } // namespace Benchmark
6245 } // namespace Catch
6246
6247 // end catch_optimizer.hpp
6248 // start catch_complete_invoke.hpp
6249
6250 // Invoke with a special case for void
6251
6252
6253 #include <type_traits>
6254 #include <utility>
6255
6256 namespace Catch {
6257 namespace Benchmark {
6258 namespace Detail {
6259 template <typename T>
6260 struct CompleteType { using type = T; };
6261 template <>
6262 struct CompleteType<void> { struct type {}; };
6263
6264 template <typename T>
6265 using CompleteType_t = typename CompleteType<T>::type;
6266
6267 template <typename Result>
6268 struct CompleteInvoker {
6269 template <typename Fun, typename... Args>
6270 static Result invoke(Fun&& fun, Args&&... args) {
6271 return std::forward<Fun>(fun)(std::forward<Args>(args)...);
6272 }
6273 };
6274 template <>
6275 struct CompleteInvoker<void> {
6276 template <typename Fun, typename... Args>
6277 static CompleteType_t<void> invoke(Fun&& fun, Args&&... args) {
6278 std::forward<Fun>(fun)(std::forward<Args>(args)...);
6279 return {};
6280 }
6281 };
6282 template <typename Sig>
6283 using ResultOf_t = typename std::result_of<Sig>::type;
6284
6285 // invoke and not return void :(
6286 template <typename Fun, typename... Args>
6287 CompleteType_t<ResultOf_t<Fun(Args...)>> complete_invoke(Fun&& fun, Args&&... args) {
6288 return CompleteInvoker<ResultOf_t<Fun(Args...)>>::invoke(std::forward<Fun>(fun), std::forward<Args>(args)...);
6289 }
6290
6291 const std::string benchmarkErrorMsg = "a benchmark failed to run successfully";
6292 } // namespace Detail
6293
6294 template <typename Fun>
6295 Detail::CompleteType_t<Detail::ResultOf_t<Fun()>> user_code(Fun&& fun) {
6296 CATCH_TRY{
6297 return Detail::complete_invoke(std::forward<Fun>(fun));
6298 } CATCH_CATCH_ALL{
6299 getResultCapture().benchmarkFailed(translateActiveException());
6300 CATCH_RUNTIME_ERROR(Detail::benchmarkErrorMsg);
6301 }
6302 }
6303 } // namespace Benchmark
6304 } // namespace Catch
6305
6306 // end catch_complete_invoke.hpp
6307 namespace Catch {
6308 namespace Benchmark {
6309 namespace Detail {
6310 struct ChronometerConcept {
6311 virtual void start() = 0;
6312 virtual void finish() = 0;
6313 virtual ~ChronometerConcept() = default;
6314 };
6315 template <typename Clock>
6316 struct ChronometerModel final : public ChronometerConcept {
6317 void start() override { started = Clock::now(); }
6318 void finish() override { finished = Clock::now(); }
6319
6320 ClockDuration<Clock> elapsed() const { return finished - started; }
6321
6322 TimePoint<Clock> started;
6323 TimePoint<Clock> finished;
6324 };
6325 } // namespace Detail
6326
6327 struct Chronometer {
6328 public:
6329 template <typename Fun>
6330 void measure(Fun&& fun) { measure(std::forward<Fun>(fun), is_callable<Fun(int)>()); }
6331
6332 int runs() const { return k; }
6333
6334 Chronometer(Detail::ChronometerConcept& meter, int k)
6335 : impl(&meter)
6336 , k(k) {}
6337
6338 private:
6339 template <typename Fun>
6340 void measure(Fun&& fun, std::false_type) {
6341 measure([&fun](int) { return fun(); }, std::true_type());
6342 }
6343
6344 template <typename Fun>
6345 void measure(Fun&& fun, std::true_type) {
6346 Detail::optimizer_barrier();
6347 impl->start();
6348 for (int i = 0; i < k; ++i) invoke_deoptimized(fun, i);
6349 impl->finish();
6350 Detail::optimizer_barrier();
6351 }
6352
6353 Detail::ChronometerConcept* impl;
6354 int k;
6355 };
6356 } // namespace Benchmark
6357 } // namespace Catch
6358
6359 // end catch_chronometer.hpp
6360 // start catch_environment.hpp
6361
6362 // Environment information
6363
6364
6365 namespace Catch {
6366 namespace Benchmark {
6367 template <typename Duration>
6368 struct EnvironmentEstimate {
6369 Duration mean;
6370 OutlierClassification outliers;
6371
6372 template <typename Duration2>
6373 operator EnvironmentEstimate<Duration2>() const {
6374 return { mean, outliers };
6375 }
6376 };
6377 template <typename Clock>
6378 struct Environment {
6379 using clock_type = Clock;
6380 EnvironmentEstimate<FloatDuration<Clock>> clock_resolution;
6381 EnvironmentEstimate<FloatDuration<Clock>> clock_cost;
6382 };
6383 } // namespace Benchmark
6384 } // namespace Catch
6385
6386 // end catch_environment.hpp
6387 // start catch_execution_plan.hpp
6388
6389 // Execution plan
6390
6391
6392 // start catch_benchmark_function.hpp
6393
6394 // Dumb std::function implementation for consistent call overhead
6395
6396
6397 #include <cassert>
6398 #include <type_traits>
6399 #include <utility>
6400 #include <memory>
6401
6402 namespace Catch {
6403 namespace Benchmark {
6404 namespace Detail {
6405 template <typename T>
6406 using Decay = typename std::decay<T>::type;
6407 template <typename T, typename U>
6408 struct is_related
6409 : std::is_same<Decay<T>, Decay<U>> {};
6410
6411 /// We need to reinvent std::function because every piece of code that might add overhead
6412 /// in a measurement context needs to have consistent performance characteristics so that we
6413 /// can account for it in the measurement.
6414 /// Implementations of std::function with optimizations that aren't always applicable, like
6415 /// small buffer optimizations, are not uncommon.
6416 /// This is effectively an implementation of std::function without any such optimizations;
6417 /// it may be slow, but it is consistently slow.
6418 struct BenchmarkFunction {
6419 private:
6420 struct callable {
6421 virtual void call(Chronometer meter) const = 0;
6422 virtual callable* clone() const = 0;
6423 virtual ~callable() = default;
6424 };
6425 template <typename Fun>
6426 struct model : public callable {
6427 model(Fun&& fun) : fun(std::move(fun)) {}
6428 model(Fun const& fun) : fun(fun) {}
6429
6430 model<Fun>* clone() const override { return new model<Fun>(*this); }
6431
6432 void call(Chronometer meter) const override {
6433 call(meter, is_callable<Fun(Chronometer)>());
6434 }
6435 void call(Chronometer meter, std::true_type) const {
6436 fun(meter);
6437 }
6438 void call(Chronometer meter, std::false_type) const {
6439 meter.measure(fun);
6440 }
6441
6442 Fun fun;
6443 };
6444
6445 struct do_nothing { void operator()() const {} };
6446
6447 template <typename T>
6448 BenchmarkFunction(model<T>* c) : f(c) {}
6449
6450 public:
6451 BenchmarkFunction()
6452 : f(new model<do_nothing>{ {} }) {}
6453
6454 template <typename Fun,
6455 typename std::enable_if<!is_related<Fun, BenchmarkFunction>::value, int>::type = 0>
6456 BenchmarkFunction(Fun&& fun)
6457 : f(new model<typename std::decay<Fun>::type>(std::forward<Fun>(fun))) {}
6458
6459 BenchmarkFunction(BenchmarkFunction&& that)
6460 : f(std::move(that.f)) {}
6461
6462 BenchmarkFunction(BenchmarkFunction const& that)
6463 : f(that.f->clone()) {}
6464
6465 BenchmarkFunction& operator=(BenchmarkFunction&& that) {
6466 f = std::move(that.f);
6467 return *this;
6468 }
6469
6470 BenchmarkFunction& operator=(BenchmarkFunction const& that) {
6471 f.reset(that.f->clone());
6472 return *this;
6473 }
6474
6475 void operator()(Chronometer meter) const { f->call(meter); }
6476
6477 private:
6478 std::unique_ptr<callable> f;
6479 };
6480 } // namespace Detail
6481 } // namespace Benchmark
6482 } // namespace Catch
6483
6484 // end catch_benchmark_function.hpp
6485 // start catch_repeat.hpp
6486
6487 // repeat algorithm
6488
6489
6490 #include <type_traits>
6491 #include <utility>
6492
6493 namespace Catch {
6494 namespace Benchmark {
6495 namespace Detail {
6496 template <typename Fun>
6497 struct repeater {
6498 void operator()(int k) const {
6499 for (int i = 0; i < k; ++i) {
6500 fun();
6501 }
6502 }
6503 Fun fun;
6504 };
6505 template <typename Fun>
6506 repeater<typename std::decay<Fun>::type> repeat(Fun&& fun) {
6507 return { std::forward<Fun>(fun) };
6508 }
6509 } // namespace Detail
6510 } // namespace Benchmark
6511 } // namespace Catch
6512
6513 // end catch_repeat.hpp
6514 // start catch_run_for_at_least.hpp
6515
6516 // Run a function for a minimum amount of time
6517
6518
6519 // start catch_measure.hpp
6520
6521 // Measure
6522
6523
6524 // start catch_timing.hpp
6525
6526 // Timing
6527
6528
6529 #include <tuple>
6530 #include <type_traits>
6531
6532 namespace Catch {
6533 namespace Benchmark {
6534 template <typename Duration, typename Result>
6535 struct Timing {
6536 Duration elapsed;
6537 Result result;
6538 int iterations;
6539 };
6540 template <typename Clock, typename Sig>
6541 using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<Detail::ResultOf_t<Sig>>>;
6542 } // namespace Benchmark
6543 } // namespace Catch
6544
6545 // end catch_timing.hpp
6546 #include <utility>
6547
6548 namespace Catch {
6549 namespace Benchmark {
6550 namespace Detail {
6551 template <typename Clock, typename Fun, typename... Args>
6552 TimingOf<Clock, Fun(Args...)> measure(Fun&& fun, Args&&... args) {
6553 auto start = Clock::now();
6554 auto&& r = Detail::complete_invoke(fun, std::forward<Args>(args)...);
6555 auto end = Clock::now();
6556 auto delta = end - start;
6557 return { delta, std::forward<decltype(r)>(r), 1 };
6558 }
6559 } // namespace Detail
6560 } // namespace Benchmark
6561 } // namespace Catch
6562
6563 // end catch_measure.hpp
6564 #include <utility>
6565 #include <type_traits>
6566
6567 namespace Catch {
6568 namespace Benchmark {
6569 namespace Detail {
6570 template <typename Clock, typename Fun>
6571 TimingOf<Clock, Fun(int)> measure_one(Fun&& fun, int iters, std::false_type) {
6572 return Detail::measure<Clock>(fun, iters);
6573 }
6574 template <typename Clock, typename Fun>
6575 TimingOf<Clock, Fun(Chronometer)> measure_one(Fun&& fun, int iters, std::true_type) {
6576 Detail::ChronometerModel<Clock> meter;
6577 auto&& result = Detail::complete_invoke(fun, Chronometer(meter, iters));
6578
6579 return { meter.elapsed(), std::move(result), iters };
6580 }
6581
6582 template <typename Clock, typename Fun>
6583 using run_for_at_least_argument_t = typename std::conditional<is_callable<Fun(Chronometer)>::value, Chronometer, int>::type;
6584
6585 struct optimized_away_error : std::exception {
6586 const char* what() const noexcept override {
6587 return "could not measure benchmark, maybe it was optimized away";
6588 }
6589 };
6590
6591 template <typename Clock, typename Fun>
6592 TimingOf<Clock, Fun(run_for_at_least_argument_t<Clock, Fun>)> run_for_at_least(ClockDuration<Clock> how_long, int seed, Fun&& fun) {
6593 auto iters = seed;
6594 while (iters < (1 << 30)) {
6595 auto&& Timing = measure_one<Clock>(fun, iters, is_callable<Fun(Chronometer)>());
6596
6597 if (Timing.elapsed >= how_long) {
6598 return { Timing.elapsed, std::move(Timing.result), iters };
6599 }
6600 iters *= 2;
6601 }
6602 throw optimized_away_error{};
6603 }
6604 } // namespace Detail
6605 } // namespace Benchmark
6606 } // namespace Catch
6607
6608 // end catch_run_for_at_least.hpp
6609 #include <algorithm>
6610
6611 namespace Catch {
6612 namespace Benchmark {
6613 template <typename Duration>
6614 struct ExecutionPlan {
6615 int iterations_per_sample;
6616 Duration estimated_duration;
6617 Detail::BenchmarkFunction benchmark;
6618 Duration warmup_time;
6619 int warmup_iterations;
6620
6621 template <typename Duration2>
6622 operator ExecutionPlan<Duration2>() const {
6623 return { iterations_per_sample, estimated_duration, benchmark, warmup_time, warmup_iterations };
6624 }
6625
6626 template <typename Clock>
6627 std::vector<FloatDuration<Clock>> run(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const {
6628 // warmup a bit
6629 Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_iterations, Detail::repeat(now<Clock>{}));
6630
6631 std::vector<FloatDuration<Clock>> times;
6632 times.reserve(cfg.benchmarkSamples());
6633 std::generate_n(std::back_inserter(times), cfg.benchmarkSamples(), [this, env] {
6634 Detail::ChronometerModel<Clock> model;
6635 this->benchmark(Chronometer(model, iterations_per_sample));
6636 auto sample_time = model.elapsed() - env.clock_cost.mean;
6637 if (sample_time < FloatDuration<Clock>::zero()) sample_time = FloatDuration<Clock>::zero();
6638 return sample_time / iterations_per_sample;
6639 });
6640 return times;
6641 }
6642 };
6643 } // namespace Benchmark
6644 } // namespace Catch
6645
6646 // end catch_execution_plan.hpp
6647 // start catch_estimate_clock.hpp
6648
6649 // Environment measurement
6650
6651
6652 // start catch_stats.hpp
6653
6654 // Statistical analysis tools
6655
6656
6657 #include <algorithm>
6658 #include <functional>
6659 #include <vector>
6660 #include <numeric>
6661 #include <tuple>
6662 #include <cmath>
6663 #include <utility>
6664 #include <cstddef>
6665
6666 namespace Catch {
6667 namespace Benchmark {
6668 namespace Detail {
6669 using sample = std::vector<double>;
6670
6671 double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last);
6672
6673 template <typename Iterator>
6674 OutlierClassification classify_outliers(Iterator first, Iterator last) {
6675 std::vector<double> copy(first, last);
6676
6677 auto q1 = weighted_average_quantile(1, 4, copy.begin(), copy.end());
6678 auto q3 = weighted_average_quantile(3, 4, copy.begin(), copy.end());
6679 auto iqr = q3 - q1;
6680 auto los = q1 - (iqr * 3.);
6681 auto lom = q1 - (iqr * 1.5);
6682 auto him = q3 + (iqr * 1.5);
6683 auto his = q3 + (iqr * 3.);
6684
6685 OutlierClassification o;
6686 for (; first != last; ++first) {
6687 auto&& t = *first;
6688 if (t < los) ++o.low_severe;
6689 else if (t < lom) ++o.low_mild;
6690 else if (t > his) ++o.high_severe;
6691 else if (t > him) ++o.high_mild;
6692 ++o.samples_seen;
6693 }
6694 return o;
6695 }
6696
6697 template <typename Iterator>
6698 double mean(Iterator first, Iterator last) {
6699 auto count = last - first;
6700 double sum = std::accumulate(first, last, 0.);
6701 return sum / count;
6702 }
6703
6704 template <typename URng, typename Iterator, typename Estimator>
6705 sample resample(URng& rng, int resamples, Iterator first, Iterator last, Estimator& estimator) {
6706 auto n = last - first;
6707 std::uniform_int_distribution<decltype(n)> dist(0, n - 1);
6708
6709 sample out;
6710 out.reserve(resamples);
6711 std::generate_n(std::back_inserter(out), resamples, [n, first, &estimator, &dist, &rng] {
6712 std::vector<double> resampled;
6713 resampled.reserve(n);
6714 std::generate_n(std::back_inserter(resampled), n, [first, &dist, &rng] { return first[dist(rng)]; });
6715 return estimator(resampled.begin(), resampled.end());
6716 });
6717 std::sort(out.begin(), out.end());
6718 return out;
6719 }
6720
6721 template <typename Estimator, typename Iterator>
6722 sample jackknife(Estimator&& estimator, Iterator first, Iterator last) {
6723 auto n = last - first;
6724 auto second = std::next(first);
6725 sample results;
6726 results.reserve(n);
6727
6728 for (auto it = first; it != last; ++it) {
6729 std::iter_swap(it, first);
6730 results.push_back(estimator(second, last));
6731 }
6732
6733 return results;
6734 }
6735
6736 inline double normal_cdf(double x) {
6737 return std::erfc(-x / std::sqrt(2.0)) / 2.0;
6738 }
6739
6740 double erfc_inv(double x);
6741
6742 double normal_quantile(double p);
6743
6744 template <typename Iterator, typename Estimator>
6745 Estimate<double> bootstrap(double confidence_level, Iterator first, Iterator last, sample const& resample, Estimator&& estimator) {
6746 auto n_samples = last - first;
6747
6748 double point = estimator(first, last);
6749 // Degenerate case with a single sample
6750 if (n_samples == 1) return { point, point, point, confidence_level };
6751
6752 sample jack = jackknife(estimator, first, last);
6753 double jack_mean = mean(jack.begin(), jack.end());
6754 double sum_squares, sum_cubes;
6755 std::tie(sum_squares, sum_cubes) = std::accumulate(jack.begin(), jack.end(), std::make_pair(0., 0.), [jack_mean](std::pair<double, double> sqcb, double x) -> std::pair<double, double> {
6756 auto d = jack_mean - x;
6757 auto d2 = d * d;
6758 auto d3 = d2 * d;
6759 return { sqcb.first + d2, sqcb.second + d3 };
6760 });
6761
6762 double accel = sum_cubes / (6 * std::pow(sum_squares, 1.5));
6763 int n = static_cast<int>(resample.size());
6764 double prob_n = std::count_if(resample.begin(), resample.end(), [point](double x) { return x < point; }) / (double)n;
6765 // degenerate case with uniform samples
6766 if (prob_n == 0) return { point, point, point, confidence_level };
6767
6768 double bias = normal_quantile(prob_n);
6769 double z1 = normal_quantile((1. - confidence_level) / 2.);
6770
6771 auto cumn = [n](double x) -> int {
6772 return std::lround(normal_cdf(x) * n); };
6773 auto a = [bias, accel](double b) { return bias + b / (1. - accel * b); };
6774 double b1 = bias + z1;
6775 double b2 = bias - z1;
6776 double a1 = a(b1);
6777 double a2 = a(b2);
6778 auto lo = std::max(cumn(a1), 0);
6779 auto hi = std::min(cumn(a2), n - 1);
6780
6781 return { point, resample[lo], resample[hi], confidence_level };
6782 }
6783
6784 double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n);
6785
6786 struct bootstrap_analysis {
6787 Estimate<double> mean;
6788 Estimate<double> standard_deviation;
6789 double outlier_variance;
6790 };
6791
6792 bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last);
6793 } // namespace Detail
6794 } // namespace Benchmark
6795 } // namespace Catch
6796
6797 // end catch_stats.hpp
6798 #include <algorithm>
6799 #include <iterator>
6800 #include <tuple>
6801 #include <vector>
6802 #include <cmath>
6803
6804 namespace Catch {
6805 namespace Benchmark {
6806 namespace Detail {
6807 template <typename Clock>
6808 std::vector<double> resolution(int k) {
6809 std::vector<TimePoint<Clock>> times;
6810 times.reserve(k + 1);
6811 std::generate_n(std::back_inserter(times), k + 1, now<Clock>{});
6812
6813 std::vector<double> deltas;
6814 deltas.reserve(k);
6815 std::transform(std::next(times.begin()), times.end(), times.begin(),
6816 std::back_inserter(deltas),
6817 [](TimePoint<Clock> a, TimePoint<Clock> b) { return static_cast<double>((a - b).count()); });
6818
6819 return deltas;
6820 }
6821
6822 const auto warmup_iterations = 10000;
6823 const auto warmup_time = std::chrono::milliseconds(100);
6824 const auto minimum_ticks = 1000;
6825 const auto warmup_seed = 10000;
6826 const auto clock_resolution_estimation_time = std::chrono::milliseconds(500);
6827 const auto clock_cost_estimation_time_limit = std::chrono::seconds(1);
6828 const auto clock_cost_estimation_tick_limit = 100000;
6829 const auto clock_cost_estimation_time = std::chrono::milliseconds(10);
6830 const auto clock_cost_estimation_iterations = 10000;
6831
6832 template <typename Clock>
6833 int warmup() {
6834 return run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_seed, &resolution<Clock>)
6835 .iterations;
6836 }
6837 template <typename Clock>
6838 EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_resolution(int iterations) {
6839 auto r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_resolution_estimation_time), iterations, &resolution<Clock>)
6840 .result;
6841 return {
6842 FloatDuration<Clock>(mean(r.begin(), r.end())),
6843 classify_outliers(r.begin(), r.end()),
6844 };
6845 }
6846 template <typename Clock>
6847 EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_cost(FloatDuration<Clock> resolution) {
6848 auto time_limit = std::min(resolution * clock_cost_estimation_tick_limit, FloatDuration<Clock>(clock_cost_estimation_time_limit));
6849 auto time_clock = [](int k) {
6850 return Detail::measure<Clock>([k] {
6851 for (int i = 0; i < k; ++i) {
6852 volatile auto ignored = Clock::now();
6853 (void)ignored;
6854 }
6855 }).elapsed;
6856 };
6857 time_clock(1);
6858 int iters = clock_cost_estimation_iterations;
6859 auto&& r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_cost_estimation_time), iters, time_clock);
6860 std::vector<double> times;
6861 int nsamples = static_cast<int>(std::ceil(time_limit / r.elapsed));
6862 times.reserve(nsamples);
6863 std::generate_n(std::back_inserter(times), nsamples, [time_clock, &r] {
6864 return static_cast<double>((time_clock(r.iterations) / r.iterations).count());
6865 });
6866 return {
6867 FloatDuration<Clock>(mean(times.begin(), times.end())),
6868 classify_outliers(times.begin(), times.end()),
6869 };
6870 }
6871
6872 template <typename Clock>
6873 Environment<FloatDuration<Clock>> measure_environment() {
6874 static Environment<FloatDuration<Clock>>* env = nullptr;
6875 if (env) {
6876 return *env;
6877 }
6878
6879 auto iters = Detail::warmup<Clock>();
6880 auto resolution = Detail::estimate_clock_resolution<Clock>(iters);
6881 auto cost = Detail::estimate_clock_cost<Clock>(resolution.mean);
6882
6883 env = new Environment<FloatDuration<Clock>>{ resolution, cost };
6884 return *env;
6885 }
6886 } // namespace Detail
6887 } // namespace Benchmark
6888 } // namespace Catch
6889
6890 // end catch_estimate_clock.hpp
6891 // start catch_analyse.hpp
6892
6893 // Run and analyse one benchmark
6894
6895
6896 // start catch_sample_analysis.hpp
6897
6898 // Benchmark results
6899
6900
6901 #include <algorithm>
6902 #include <vector>
6903 #include <string>
6904 #include <iterator>
6905
6906 namespace Catch {
6907 namespace Benchmark {
6908 template <typename Duration>
6909 struct SampleAnalysis {
6910 std::vector<Duration> samples;
6911 Estimate<Duration> mean;
6912 Estimate<Duration> standard_deviation;
6913 OutlierClassification outliers;
6914 double outlier_variance;
6915
6916 template <typename Duration2>
6917 operator SampleAnalysis<Duration2>() const {
6918 std::vector<Duration2> samples2;
6919 samples2.reserve(samples.size());
6920 std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); });
6921 return {
6922 std::move(samples2),
6923 mean,
6924 standard_deviation,
6925 outliers,
6926 outlier_variance,
6927 };
6928 }
6929 };
6930 } // namespace Benchmark
6931 } // namespace Catch
6932
6933 // end catch_sample_analysis.hpp
6934 #include <algorithm>
6935 #include <iterator>
6936 #include <vector>
6937
6938 namespace Catch {
6939 namespace Benchmark {
6940 namespace Detail {
6941 template <typename Duration, typename Iterator>
6942 SampleAnalysis<Duration> analyse(const IConfig &cfg, Environment<Duration>, Iterator first, Iterator last) {
6943 if (!cfg.benchmarkNoAnalysis()) {
6944 std::vector<double> samples;
6945 samples.reserve(last - first);
6946 std::transform(first, last, std::back_inserter(samples), [](Duration d) { return d.count(); });
6947
6948 auto analysis = Catch::Benchmark::Detail::analyse_samples(cfg.benchmarkConfidenceInterval(), cfg.benchmarkResamples(), samples.begin(), samples.end());
6949 auto outliers = Catch::Benchmark::Detail::classify_outliers(samples.begin(), samples.end());
6950
6951 auto wrap_estimate = [](Estimate<double> e) {
6952 return Estimate<Duration> {
6953 Duration(e.point),
6954 Duration(e.lower_bound),
6955 Duration(e.upper_bound),
6956 e.confidence_interval,
6957 };
6958 };
6959 std::vector<Duration> samples2;
6960 samples2.reserve(samples.size());
6961 std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](double d) { return Duration(d); });
6962 return {
6963 std::move(samples2),
6964 wrap_estimate(analysis.mean),
6965 wrap_estimate(analysis.standard_deviation),
6966 outliers,
6967 analysis.outlier_variance,
6968 };
6969 } else {
6970 std::vector<Duration> samples;
6971 samples.reserve(last - first);
6972
6973 Duration mean = Duration(0);
6974 int i = 0;
6975 for (auto it = first; it < last; ++it, ++i) {
6976 samples.push_back(Duration(*it));
6977 mean += Duration(*it);
6978 }
6979 mean /= i;
6980
6981 return {
6982 std::move(samples),
6983 Estimate<Duration>{mean, mean, mean, 0.0},
6984 Estimate<Duration>{Duration(0), Duration(0), Duration(0), 0.0},
6985 OutlierClassification{},
6986 0.0
6987 };
6988 }
6989 }
6990 } // namespace Detail
6991 } // namespace Benchmark
6992 } // namespace Catch
6993
6994 // end catch_analyse.hpp
6995 #include <algorithm>
6996 #include <functional>
6997 #include <string>
6998 #include <vector>
6999 #include <cmath>
7000
7001 namespace Catch {
7002 namespace Benchmark {
7003 struct Benchmark {
7004 Benchmark(std::string &&name)
7005 : name(std::move(name)) {}
7006
7007 template <class FUN>
7008 Benchmark(std::string &&name, FUN &&func)
7009 : fun(std::move(func)), name(std::move(name)) {}
7010
7011 template <typename Clock>
7012 ExecutionPlan<FloatDuration<Clock>> prepare(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const {
7013 auto min_time = env.clock_resolution.mean * Detail::minimum_ticks;
7014 auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(Detail::warmup_time));
7015 auto&& test = Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(run_time), 1, fun);
7016 int new_iters = static_cast<int>(std::ceil(min_time * test.iterations / test.elapsed));
7017 return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), fun, std::chrono::duration_cast<FloatDuration<Clock>>(Detail::warmup_time), Detail::warmup_iterations };
7018 }
7019
7020 template <typename Clock = default_clock>
7021 void run() {
7022 IConfigPtr cfg = getCurrentContext().getConfig();
7023
7024 auto env = Detail::measure_environment<Clock>();
7025
7026 getResultCapture().benchmarkPreparing(name);
7027 CATCH_TRY{
7028 auto plan = user_code([&] {
7029 return prepare<Clock>(*cfg, env);
7030 });
7031
7032 BenchmarkInfo info {
7033 name,
7034 plan.estimated_duration.count(),
7035 plan.iterations_per_sample,
7036 cfg->benchmarkSamples(),
7037 cfg->benchmarkResamples(),
7038 env.clock_resolution.mean.count(),
7039 env.clock_cost.mean.count()
7040 };
7041
7042 getResultCapture().benchmarkStarting(info);
7043
7044 auto samples = user_code([&] {
7045 return plan.template run<Clock>(*cfg, env);
7046 });
7047
7048 auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end());
7049 BenchmarkStats<std::chrono::duration<double, std::nano>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance };
7050 getResultCapture().benchmarkEnded(stats);
7051
7052 } CATCH_CATCH_ALL{
7053 if (translateActiveException() != Detail::benchmarkErrorMsg) // benchmark errors have been reported, otherwise rethrow.
7054 std::rethrow_exception(std::current_exception());
7055 }
7056 }
7057
7058 // sets lambda to be used in fun *and* executes benchmark!
7059 template <typename Fun,
7060 typename std::enable_if<!Detail::is_related<Fun, Benchmark>::value, int>::type = 0>
7061 Benchmark & operator=(Fun func) {
7062 fun = Detail::BenchmarkFunction(func);
7063 run();
7064 return *this;
7065 }
7066
7067 explicit operator bool() {
7068 return true;
7069 }
7070
7071 private:
7072 Detail::BenchmarkFunction fun;
7073 std::string name;
7074 };
7075 }
7076 } // namespace Catch
7077
7078 #define INTERNAL_CATCH_GET_1_ARG(arg1, arg2, ...) arg1
7079 #define INTERNAL_CATCH_GET_2_ARG(arg1, arg2, ...) arg2
7080
7081 #define INTERNAL_CATCH_BENCHMARK(BenchmarkName, name, benchmarkIndex)\
7082 if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \
7083 BenchmarkName = [&](int benchmarkIndex)
7084
7085 #define INTERNAL_CATCH_BENCHMARK_ADVANCED(BenchmarkName, name)\
7086 if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \
7087 BenchmarkName = [&]
7088
7089 // end catch_benchmark.hpp
7090 #endif
7091
7092 #endif // ! CATCH_CONFIG_IMPL_ONLY
7093
7094 #ifdef CATCH_IMPL
7095 // start catch_impl.hpp
7096
7097 #ifdef __clang__
7098 #pragma clang diagnostic push
7099 #pragma clang diagnostic ignored "-Wweak-vtables"
7100 #endif
7101
7102 // Keep these here for external reporters
7103 // start catch_test_case_tracker.h
7104
7105 #include <string>
7106 #include <vector>
7107 #include <memory>
7108
7109 namespace Catch {
7110 namespace TestCaseTracking {
7111
7112 struct NameAndLocation {
7113 std::string name;
7114 SourceLineInfo location;
7115
7116 NameAndLocation( std::string const& _name, SourceLineInfo const& _location );
7117 };
7118
7119 struct ITracker;
7120
7121 using ITrackerPtr = std::shared_ptr<ITracker>;
7122
7123 struct ITracker {
7124 virtual ~ITracker();
7125
7126 // static queries
7127 virtual NameAndLocation const& nameAndLocation() const = 0;
7128
7129 // dynamic queries
7130 virtual bool isComplete() const = 0; // Successfully completed or failed
7131 virtual bool isSuccessfullyCompleted() const = 0;
7132 virtual bool isOpen() const = 0; // Started but not complete
7133 virtual bool hasChildren() const = 0;
7134
7135 virtual ITracker& parent() = 0;
7136
7137 // actions
7138 virtual void close() = 0; // Successfully complete
7139 virtual void fail() = 0;
7140 virtual void markAsNeedingAnotherRun() = 0;
7141
7142 virtual void addChild( ITrackerPtr const& child ) = 0;
7143 virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0;
7144 virtual void openChild() = 0;
7145
7146 // Debug/ checking
7147 virtual bool isSectionTracker() const = 0;
7148 virtual bool isGeneratorTracker() const = 0;
7149 };
7150
7151 class TrackerContext {
7152
7153 enum RunState {
7154 NotStarted,
7155 Executing,
7156 CompletedCycle
7157 };
7158
7159 ITrackerPtr m_rootTracker;
7160 ITracker* m_currentTracker = nullptr;
7161 RunState m_runState = NotStarted;
7162
7163 public:
7164
7165 ITracker& startRun();
7166 void endRun();
7167
7168 void startCycle();
7169 void completeCycle();
7170
7171 bool completedCycle() const;
7172 ITracker& currentTracker();
7173 void setCurrentTracker( ITracker* tracker );
7174 };
7175
7176 class TrackerBase : public ITracker {
7177 protected:
7178 enum CycleState {
7179 NotStarted,
7180 Executing,
7181 ExecutingChildren,
7182 NeedsAnotherRun,
7183 CompletedSuccessfully,
7184 Failed
7185 };
7186
7187 using Children = std::vector<ITrackerPtr>;
7188 NameAndLocation m_nameAndLocation;
7189 TrackerContext& m_ctx;
7190 ITracker* m_parent;
7191 Children m_children;
7192 CycleState m_runState = NotStarted;
7193
7194 public:
7195 TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
7196
7197 NameAndLocation const& nameAndLocation() const override;
7198 bool isComplete() const override;
7199 bool isSuccessfullyCompleted() const override;
7200 bool isOpen() const override;
7201 bool hasChildren() const override;
7202
7203 void addChild( ITrackerPtr const& child ) override;
7204
7205 ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override;
7206 ITracker& parent() override;
7207
7208 void openChild() override;
7209
7210 bool isSectionTracker() const override;
7211 bool isGeneratorTracker() const override;
7212
7213 void open();
7214
7215 void close() override;
7216 void fail() override;
7217 void markAsNeedingAnotherRun() override;
7218
7219 private:
7220 void moveToParent();
7221 void moveToThis();
7222 };
7223
7224 class SectionTracker : public TrackerBase {
7225 std::vector<std::string> m_filters;
7226 public:
7227 SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
7228
7229 bool isSectionTracker() const override;
7230
7231 bool isComplete() const override;
7232
7233 static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation );
7234
7235 void tryOpen();
7236
7237 void addInitialFilters( std::vector<std::string> const& filters );
7238 void addNextFilters( std::vector<std::string> const& filters );
7239 };
7240
7241 } // namespace TestCaseTracking
7242
7243 using TestCaseTracking::ITracker;
7244 using TestCaseTracking::TrackerContext;
7245 using TestCaseTracking::SectionTracker;
7246
7247 } // namespace Catch
7248
7249 // end catch_test_case_tracker.h
7250
7251 // start catch_leak_detector.h
7252
7253 namespace Catch {
7254
7255 struct LeakDetector {
7256 LeakDetector();
7257 ~LeakDetector();
7258 };
7259
7260 }
7261 // end catch_leak_detector.h
7262 // Cpp files will be included in the single-header file here
7263 // start catch_stats.cpp
7264
7265 // Statistical analysis tools
7266
7267 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
7268
7269 #include <cassert>
7270 #include <random>
7271
7272 #if defined(CATCH_CONFIG_USE_ASYNC)
7273 #include <future>
7274 #endif
7275
7276 namespace {
7277 double erf_inv(double x) {
7278 // Code accompanying the article "Approximating the erfinv function" in GPU Computing Gems, Volume 2
7279 double w, p;
7280
7281 w = -log((1.0 - x) * (1.0 + x));
7282
7283 if (w < 6.250000) {
7284 w = w - 3.125000;
7285 p = -3.6444120640178196996e-21;
7286 p = -1.685059138182016589e-19 + p * w;
7287 p = 1.2858480715256400167e-18 + p * w;
7288 p = 1.115787767802518096e-17 + p * w;
7289 p = -1.333171662854620906e-16 + p * w;
7290 p = 2.0972767875968561637e-17 + p * w;
7291 p = 6.6376381343583238325e-15 + p * w;
7292 p = -4.0545662729752068639e-14 + p * w;
7293 p = -8.1519341976054721522e-14 + p * w;
7294 p = 2.6335093153082322977e-12 + p * w;
7295 p = -1.2975133253453532498e-11 + p * w;
7296 p = -5.4154120542946279317e-11 + p * w;
7297 p = 1.051212273321532285e-09 + p * w;
7298 p = -4.1126339803469836976e-09 + p * w;
7299 p = -2.9070369957882005086e-08 + p * w;
7300 p = 4.2347877827932403518e-07 + p * w;
7301 p = -1.3654692000834678645e-06 + p * w;
7302 p = -1.3882523362786468719e-05 + p * w;
7303 p = 0.0001867342080340571352 + p * w;
7304 p = -0.00074070253416626697512 + p * w;
7305 p = -0.0060336708714301490533 + p * w;
7306 p = 0.24015818242558961693 + p * w;
7307 p = 1.6536545626831027356 + p * w;
7308 } else if (w < 16.000000) {
7309 w = sqrt(w) - 3.250000;
7310 p = 2.2137376921775787049e-09;
7311 p = 9.0756561938885390979e-08 + p * w;
7312 p = -2.7517406297064545428e-07 + p * w;
7313 p = 1.8239629214389227755e-08 + p * w;
7314 p = 1.5027403968909827627e-06 + p * w;
7315 p = -4.013867526981545969e-06 + p * w;
7316 p = 2.9234449089955446044e-06 + p * w;
7317 p = 1.2475304481671778723e-05 + p * w;
7318 p = -4.7318229009055733981e-05 + p * w;
7319 p = 6.8284851459573175448e-05 + p * w;
7320 p = 2.4031110387097893999e-05 + p * w;
7321 p = -0.0003550375203628474796 + p * w;
7322 p = 0.00095328937973738049703 + p * w;
7323 p = -0.0016882755560235047313 + p * w;
7324 p = 0.0024914420961078508066 + p * w;
7325 p = -0.0037512085075692412107 + p * w;
7326 p = 0.005370914553590063617 + p * w;
7327 p = 1.0052589676941592334 + p * w;
7328 p = 3.0838856104922207635 + p * w;
7329 } else {
7330 w = sqrt(w) - 5.000000;
7331 p = -2.7109920616438573243e-11;
7332 p = -2.5556418169965252055e-10 + p * w;
7333 p = 1.5076572693500548083e-09 + p * w;
7334 p = -3.7894654401267369937e-09 + p * w;
7335 p = 7.6157012080783393804e-09 + p * w;
7336 p = -1.4960026627149240478e-08 + p * w;
7337 p = 2.9147953450901080826e-08 + p * w;
7338 p = -6.7711997758452339498e-08 + p * w;
7339 p = 2.2900482228026654717e-07 + p * w;
7340 p = -9.9298272942317002539e-07 + p * w;
7341 p = 4.5260625972231537039e-06 + p * w;
7342 p = -1.9681778105531670567e-05 + p * w;
7343 p = 7.5995277030017761139e-05 + p * w;
7344 p = -0.00021503011930044477347 + p * w;
7345 p = -0.00013871931833623122026 + p * w;
7346 p = 1.0103004648645343977 + p * w;
7347 p = 4.8499064014085844221 + p * w;
7348 }
7349 return p * x;
7350 }
7351
7352 double standard_deviation(std::vector<double>::iterator first, std::vector<double>::iterator last) {
7353 auto m = Catch::Benchmark::Detail::mean(first, last);
7354 double variance = std::accumulate(first, last, 0., [m](double a, double b) {
7355 double diff = b - m;
7356 return a + diff * diff;
7357 }) / (last - first);
7358 return std::sqrt(variance);
7359 }
7360
7361 }
7362
7363 namespace Catch {
7364 namespace Benchmark {
7365 namespace Detail {
7366
7367 double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last) {
7368 auto count = last - first;
7369 double idx = (count - 1) * k / static_cast<double>(q);
7370 int j = static_cast<int>(idx);
7371 double g = idx - j;
7372 std::nth_element(first, first + j, last);
7373 auto xj = first[j];
7374 if (g == 0) return xj;
7375
7376 auto xj1 = *std::min_element(first + (j + 1), last);
7377 return xj + g * (xj1 - xj);
7378 }
7379
7380 double erfc_inv(double x) {
7381 return erf_inv(1.0 - x);
7382 }
7383
7384 double normal_quantile(double p) {
7385 static const double ROOT_TWO = std::sqrt(2.0);
7386
7387 double result = 0.0;
7388 assert(p >= 0 && p <= 1);
7389 if (p < 0 || p > 1) {
7390 return result;
7391 }
7392
7393 result = -erfc_inv(2.0 * p);
7394 // result *= normal distribution standard deviation (1.0) * sqrt(2)
7395 result *= /*sd * */ ROOT_TWO;
7396 // result += normal disttribution mean (0)
7397 return result;
7398 }
7399
7400 double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n) {
7401 double sb = stddev.point;
7402 double mn = mean.point / n;
7403 double mg_min = mn / 2.;
7404 double sg = std::min(mg_min / 4., sb / std::sqrt(n));
7405 double sg2 = sg * sg;
7406 double sb2 = sb * sb;
7407
7408 auto c_max = [n, mn, sb2, sg2](double x) -> double {
7409 double k = mn - x;
7410 double d = k * k;
7411 double nd = n * d;
7412 double k0 = -n * nd;
7413 double k1 = sb2 - n * sg2 + nd;
7414 double det = k1 * k1 - 4 * sg2 * k0;
7415 return (int)(-2. * k0 / (k1 + std::sqrt(det)));
7416 };
7417
7418 auto var_out = [n, sb2, sg2](double c) {
7419 double nc = n - c;
7420 return (nc / n) * (sb2 - nc * sg2);
7421 };
7422
7423 return std::min(var_out(1), var_out(std::min(c_max(0.), c_max(mg_min)))) / sb2;
7424 }
7425
7426 bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) {
7427 CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
7428 static std::random_device entropy;
7429 CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
7430
7431 auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++
7432
7433 auto mean = &Detail::mean<std::vector<double>::iterator>;
7434 auto stddev = &standard_deviation;
7435
7436 #if defined(CATCH_CONFIG_USE_ASYNC)
7437 auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {
7438 auto seed = entropy();
7439 return std::async(std::launch::async, [=] {
7440 std::mt19937 rng(seed);
7441 auto resampled = resample(rng, n_resamples, first, last, f);
7442 return bootstrap(confidence_level, first, last, resampled, f);
7443 });
7444 };
7445
7446 auto mean_future = Estimate(mean);
7447 auto stddev_future = Estimate(stddev);
7448
7449 auto mean_estimate = mean_future.get();
7450 auto stddev_estimate = stddev_future.get();
7451 #else
7452 auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {
7453 auto seed = entropy();
7454 std::mt19937 rng(seed);
7455 auto resampled = resample(rng, n_resamples, first, last, f);
7456 return bootstrap(confidence_level, first, last, resampled, f);
7457 };
7458
7459 auto mean_estimate = Estimate(mean);
7460 auto stddev_estimate = Estimate(stddev);
7461 #endif // CATCH_USE_ASYNC
7462
7463 double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n);
7464
7465 return { mean_estimate, stddev_estimate, outlier_variance };
7466 }
7467 } // namespace Detail
7468 } // namespace Benchmark
7469 } // namespace Catch
7470
7471 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
7472 // end catch_stats.cpp
7473 // start catch_approx.cpp
7474
7475 #include <cmath>
7476 #include <limits>
7477
7478 namespace {
7479
7480 // Performs equivalent check of std::fabs(lhs - rhs) <= margin
7481 // But without the subtraction to allow for INFINITY in comparison
7482 bool marginComparison(double lhs, double rhs, double margin) {
7483 return (lhs + margin >= rhs) && (rhs + margin >= lhs);
7484 }
7485
7486 }
7487
7488 namespace Catch {
7489 namespace Detail {
7490
7491 Approx::Approx ( double value )
7492 : m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
7493 m_margin( 0.0 ),
7494 m_scale( 0.0 ),
7495 m_value( value )
7496 {}
7497
7498 Approx Approx::custom() {
7499 return Approx( 0 );
7500 }
7501
7502 Approx Approx::operator-() const {
7503 auto temp(*this);
7504 temp.m_value = -temp.m_value;
7505 return temp;
7506 }
7507
7508 std::string Approx::toString() const {
7509 ReusableStringStream rss;
7510 rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )";
7511 return rss.str();
7512 }
7513
7514 bool Approx::equalityComparisonImpl(const double other) const {
7515 // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
7516 // Thanks to Richard Harris for his help refining the scaled margin value
7517 return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value)));
7518 }
7519
7520 void Approx::setMargin(double newMargin) {
7521 CATCH_ENFORCE(newMargin >= 0,
7522 "Invalid Approx::margin: " << newMargin << '.'
7523 << " Approx::Margin has to be non-negative.");
7524 m_margin = newMargin;
7525 }
7526
7527 void Approx::setEpsilon(double newEpsilon) {
7528 CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0,
7529 "Invalid Approx::epsilon: " << newEpsilon << '.'
7530 << " Approx::epsilon has to be in [0, 1]");
7531 m_epsilon = newEpsilon;
7532 }
7533
7534 } // end namespace Detail
7535
7536 namespace literals {
7537 Detail::Approx operator "" _a(long double val) {
7538 return Detail::Approx(val);
7539 }
7540 Detail::Approx operator "" _a(unsigned long long val) {
7541 return Detail::Approx(val);
7542 }
7543 } // end namespace literals
7544
7545 std::string StringMaker<Catch::Detail::Approx>::convert(Catch::Detail::Approx const& value) {
7546 return value.toString();
7547 }
7548
7549 } // end namespace Catch
7550 // end catch_approx.cpp
7551 // start catch_assertionhandler.cpp
7552
7553 // start catch_debugger.h
7554
7555 namespace Catch {
7556 bool isDebuggerActive();
7557 }
7558
7559 #ifdef CATCH_PLATFORM_MAC
7560
7561 #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
7562
7563 #elif defined(CATCH_PLATFORM_LINUX)
7564 // If we can use inline assembler, do it because this allows us to break
7565 // directly at the location of the failing check instead of breaking inside
7566 // raise() called from it, i.e. one stack frame below.
7567 #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64))
7568 #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */
7569 #else // Fall back to the generic way.
7570 #include <signal.h>
7571
7572 #define CATCH_TRAP() raise(SIGTRAP)
7573 #endif
7574 #elif defined(_MSC_VER)
7575 #define CATCH_TRAP() __debugbreak()
7576 #elif defined(__MINGW32__)
7577 extern "C" __declspec(dllimport) void __stdcall DebugBreak();
7578 #define CATCH_TRAP() DebugBreak()
7579 #endif
7580
7581 #ifdef CATCH_TRAP
7582 #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }()
7583 #else
7584 #define CATCH_BREAK_INTO_DEBUGGER() []{}()
7585 #endif
7586
7587 // end catch_debugger.h
7588 // start catch_run_context.h
7589
7590 // start catch_fatal_condition.h
7591
7592 // start catch_windows_h_proxy.h
7593
7594
7595 #if defined(CATCH_PLATFORM_WINDOWS)
7596
7597 #if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX)
7598 # define CATCH_DEFINED_NOMINMAX
7599 # define NOMINMAX
7600 #endif
7601 #if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN)
7602 # define CATCH_DEFINED_WIN32_LEAN_AND_MEAN
7603 # define WIN32_LEAN_AND_MEAN
7604 #endif
7605
7606 #ifdef __AFXDLL
7607 #include <AfxWin.h>
7608 #else
7609 #include <windows.h>
7610 #endif
7611
7612 #ifdef CATCH_DEFINED_NOMINMAX
7613 # undef NOMINMAX
7614 #endif
7615 #ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN
7616 # undef WIN32_LEAN_AND_MEAN
7617 #endif
7618
7619 #endif // defined(CATCH_PLATFORM_WINDOWS)
7620
7621 // end catch_windows_h_proxy.h
7622 #if defined( CATCH_CONFIG_WINDOWS_SEH )
7623
7624 namespace Catch {
7625
7626 struct FatalConditionHandler {
7627
7628 static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo);
7629 FatalConditionHandler();
7630 static void reset();
7631 ~FatalConditionHandler();
7632
7633 private:
7634 static bool isSet;
7635 static ULONG guaranteeSize;
7636 static PVOID exceptionHandlerHandle;
7637 };
7638
7639 } // namespace Catch
7640
7641 #elif defined ( CATCH_CONFIG_POSIX_SIGNALS )
7642
7643 #include <signal.h>
7644
7645 namespace Catch {
7646
7647 struct FatalConditionHandler {
7648
7649 static bool isSet;
7650 static struct sigaction oldSigActions[];
7651 static stack_t oldSigStack;
7652 static char altStackMem[];
7653
7654 static void handleSignal( int sig );
7655
7656 FatalConditionHandler();
7657 ~FatalConditionHandler();
7658 static void reset();
7659 };
7660
7661 } // namespace Catch
7662
7663 #else
7664
7665 namespace Catch {
7666 struct FatalConditionHandler {
7667 void reset();
7668 };
7669 }
7670
7671 #endif
7672
7673 // end catch_fatal_condition.h
7674 #include <string>
7675
7676 namespace Catch {
7677
7678 struct IMutableContext;
7679
7680 ///////////////////////////////////////////////////////////////////////////
7681
7682 class RunContext : public IResultCapture, public IRunner {
7683
7684 public:
7685 RunContext( RunContext const& ) = delete;
7686 RunContext& operator =( RunContext const& ) = delete;
7687
7688 explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter );
7689
7690 ~RunContext() override;
7691
7692 void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount );
7693 void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount );
7694
7695 Totals runTest(TestCase const& testCase);
7696
7697 IConfigPtr config() const;
7698 IStreamingReporter& reporter() const;
7699
7700 public: // IResultCapture
7701
7702 // Assertion handlers
7703 void handleExpr
7704 ( AssertionInfo const& info,
7705 ITransientExpression const& expr,
7706 AssertionReaction& reaction ) override;
7707 void handleMessage
7708 ( AssertionInfo const& info,
7709 ResultWas::OfType resultType,
7710 StringRef const& message,
7711 AssertionReaction& reaction ) override;
7712 void handleUnexpectedExceptionNotThrown
7713 ( AssertionInfo const& info,
7714 AssertionReaction& reaction ) override;
7715 void handleUnexpectedInflightException
7716 ( AssertionInfo const& info,
7717 std::string const& message,
7718 AssertionReaction& reaction ) override;
7719 void handleIncomplete
7720 ( AssertionInfo const& info ) override;
7721 void handleNonExpr
7722 ( AssertionInfo const &info,
7723 ResultWas::OfType resultType,
7724 AssertionReaction &reaction ) override;
7725
7726 bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;
7727
7728 void sectionEnded( SectionEndInfo const& endInfo ) override;
7729 void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
7730
7731 auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
7732
7733 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
7734 void benchmarkPreparing( std::string const& name ) override;
7735 void benchmarkStarting( BenchmarkInfo const& info ) override;
7736 void benchmarkEnded( BenchmarkStats<> const& stats ) override;
7737 void benchmarkFailed( std::string const& error ) override;
7738 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
7739
7740 void pushScopedMessage( MessageInfo const& message ) override;
7741 void popScopedMessage( MessageInfo const& message ) override;
7742
7743 void emplaceUnscopedMessage( MessageBuilder const& builder ) override;
7744
7745 std::string getCurrentTestName() const override;
7746
7747 const AssertionResult* getLastResult() const override;
7748
7749 void exceptionEarlyReported() override;
7750
7751 void handleFatalErrorCondition( StringRef message ) override;
7752
7753 bool lastAssertionPassed() override;
7754
7755 void assertionPassed() override;
7756
7757 public:
7758 // !TBD We need to do this another way!
7759 bool aborting() const final;
7760
7761 private:
7762
7763 void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr );
7764 void invokeActiveTestCase();
7765
7766 void resetAssertionInfo();
7767 bool testForMissingAssertions( Counts& assertions );
7768
7769 void assertionEnded( AssertionResult const& result );
7770 void reportExpr
7771 ( AssertionInfo const &info,
7772 ResultWas::OfType resultType,
7773 ITransientExpression const *expr,
7774 bool negated );
7775
7776 void populateReaction( AssertionReaction& reaction );
7777
7778 private:
7779
7780 void handleUnfinishedSections();
7781
7782 TestRunInfo m_runInfo;
7783 IMutableContext& m_context;
7784 TestCase const* m_activeTestCase = nullptr;
7785 ITracker* m_testCaseTracker = nullptr;
7786 Option<AssertionResult> m_lastResult;
7787
7788 IConfigPtr m_config;
7789 Totals m_totals;
7790 IStreamingReporterPtr m_reporter;
7791 std::vector<MessageInfo> m_messages;
7792 std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped messages. */
7793 AssertionInfo m_lastAssertionInfo;
7794 std::vector<SectionEndInfo> m_unfinishedSections;
7795 std::vector<ITracker*> m_activeSections;
7796 TrackerContext m_trackerContext;
7797 bool m_lastAssertionPassed = false;
7798 bool m_shouldReportUnexpected = true;
7799 bool m_includeSuccessfulResults;
7800 };
7801
7802 } // end namespace Catch
7803
7804 // end catch_run_context.h
7805 namespace Catch {
7806
7807 namespace {
7808 auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& {
7809 expr.streamReconstructedExpression( os );
7810 return os;
7811 }
7812 }
7813
7814 LazyExpression::LazyExpression( bool isNegated )
7815 : m_isNegated( isNegated )
7816 {}
7817
7818 LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {}
7819
7820 LazyExpression::operator bool() const {
7821 return m_transientExpression != nullptr;
7822 }
7823
7824 auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& {
7825 if( lazyExpr.m_isNegated )
7826 os << "!";
7827
7828 if( lazyExpr ) {
7829 if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() )
7830 os << "(" << *lazyExpr.m_transientExpression << ")";
7831 else
7832 os << *lazyExpr.m_transientExpression;
7833 }
7834 else {
7835 os << "{** error - unchecked empty expression requested **}";
7836 }
7837 return os;
7838 }
7839
7840 AssertionHandler::AssertionHandler
7841 ( StringRef const& macroName,
7842 SourceLineInfo const& lineInfo,
7843 StringRef capturedExpression,
7844 ResultDisposition::Flags resultDisposition )
7845 : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
7846 m_resultCapture( getResultCapture() )
7847 {}
7848
7849 void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
7850 m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
7851 }
7852 void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) {
7853 m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );
7854 }
7855
7856 auto AssertionHandler::allowThrows() const -> bool {
7857 return getCurrentContext().getConfig()->allowThrows();
7858 }
7859
7860 void AssertionHandler::complete() {
7861 setCompleted();
7862 if( m_reaction.shouldDebugBreak ) {
7863
7864 // If you find your debugger stopping you here then go one level up on the
7865 // call-stack for the code that caused it (typically a failed assertion)
7866
7867 // (To go back to the test and change execution, jump over the throw, next)
7868 CATCH_BREAK_INTO_DEBUGGER();
7869 }
7870 if (m_reaction.shouldThrow) {
7871 #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
7872 throw Catch::TestFailureException();
7873 #else
7874 CATCH_ERROR( "Test failure requires aborting test!" );
7875 #endif
7876 }
7877 }
7878 void AssertionHandler::setCompleted() {
7879 m_completed = true;
7880 }
7881
7882 void AssertionHandler::handleUnexpectedInflightException() {
7883 m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction );
7884 }
7885
7886 void AssertionHandler::handleExceptionThrownAsExpected() {
7887 m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
7888 }
7889 void AssertionHandler::handleExceptionNotThrownAsExpected() {
7890 m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
7891 }
7892
7893 void AssertionHandler::handleUnexpectedExceptionNotThrown() {
7894 m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction );
7895 }
7896
7897 void AssertionHandler::handleThrowingCallSkipped() {
7898 m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
7899 }
7900
7901 // This is the overload that takes a string and infers the Equals matcher from it
7902 // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp
7903 void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ) {
7904 handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString );
7905 }
7906
7907 } // namespace Catch
7908 // end catch_assertionhandler.cpp
7909 // start catch_assertionresult.cpp
7910
7911 namespace Catch {
7912 AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
7913 lazyExpression(_lazyExpression),
7914 resultType(_resultType) {}
7915
7916 std::string AssertionResultData::reconstructExpression() const {
7917
7918 if( reconstructedExpression.empty() ) {
7919 if( lazyExpression ) {
7920 ReusableStringStream rss;
7921 rss << lazyExpression;
7922 reconstructedExpression = rss.str();
7923 }
7924 }
7925 return reconstructedExpression;
7926 }
7927
7928 AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )
7929 : m_info( info ),
7930 m_resultData( data )
7931 {}
7932
7933 // Result was a success
7934 bool AssertionResult::succeeded() const {
7935 return Catch::isOk( m_resultData.resultType );
7936 }
7937
7938 // Result was a success, or failure is suppressed
7939 bool AssertionResult::isOk() const {
7940 return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );
7941 }
7942
7943 ResultWas::OfType AssertionResult::getResultType() const {
7944 return m_resultData.resultType;
7945 }
7946
7947 bool AssertionResult::hasExpression() const {
7948 return m_info.capturedExpression[0] != 0;
7949 }
7950
7951 bool AssertionResult::hasMessage() const {
7952 return !m_resultData.message.empty();
7953 }
7954
7955 std::string AssertionResult::getExpression() const {
7956 if( isFalseTest( m_info.resultDisposition ) )
7957 return "!(" + m_info.capturedExpression + ")";
7958 else
7959 return m_info.capturedExpression;
7960 }
7961
7962 std::string AssertionResult::getExpressionInMacro() const {
7963 std::string expr;
7964 if( m_info.macroName[0] == 0 )
7965 expr = m_info.capturedExpression;
7966 else {
7967 expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );
7968 expr += m_info.macroName;
7969 expr += "( ";
7970 expr += m_info.capturedExpression;
7971 expr += " )";
7972 }
7973 return expr;
7974 }
7975
7976 bool AssertionResult::hasExpandedExpression() const {
7977 return hasExpression() && getExpandedExpression() != getExpression();
7978 }
7979
7980 std::string AssertionResult::getExpandedExpression() const {
7981 std::string expr = m_resultData.reconstructExpression();
7982 return expr.empty()
7983 ? getExpression()
7984 : expr;
7985 }
7986
7987 std::string AssertionResult::getMessage() const {
7988 return m_resultData.message;
7989 }
7990 SourceLineInfo AssertionResult::getSourceInfo() const {
7991 return m_info.lineInfo;
7992 }
7993
7994 StringRef AssertionResult::getTestMacroName() const {
7995 return m_info.macroName;
7996 }
7997
7998 } // end namespace Catch
7999 // end catch_assertionresult.cpp
8000 // start catch_capture_matchers.cpp
8001
8002 namespace Catch {
8003
8004 using StringMatcher = Matchers::Impl::MatcherBase<std::string>;
8005
8006 // This is the general overload that takes a any string matcher
8007 // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers
8008 // the Equals matcher (so the header does not mention matchers)
8009 void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) {
8010 std::string exceptionMessage = Catch::translateActiveException();
8011 MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
8012 handler.handleExpr( expr );
8013 }
8014
8015 } // namespace Catch
8016 // end catch_capture_matchers.cpp
8017 // start catch_commandline.cpp
8018
8019 // start catch_commandline.h
8020
8021 // start catch_clara.h
8022
8023 // Use Catch's value for console width (store Clara's off to the side, if present)
8024 #ifdef CLARA_CONFIG_CONSOLE_WIDTH
8025 #define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
8026 #undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
8027 #endif
8028 #define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1
8029
8030 #ifdef __clang__
8031 #pragma clang diagnostic push
8032 #pragma clang diagnostic ignored "-Wweak-vtables"
8033 #pragma clang diagnostic ignored "-Wexit-time-destructors"
8034 #pragma clang diagnostic ignored "-Wshadow"
8035 #endif
8036
8037 // start clara.hpp
8038 // Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
8039 //
8040 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8041 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8042 //
8043 // See https://github.com/philsquared/Clara for more details
8044
8045 // Clara v1.1.5
8046
8047
8048 #ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH
8049 #define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80
8050 #endif
8051
8052 #ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
8053 #define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH
8054 #endif
8055
8056 #ifndef CLARA_CONFIG_OPTIONAL_TYPE
8057 #ifdef __has_include
8058 #if __has_include(<optional>) && __cplusplus >= 201703L
8059 #include <optional>
8060 #define CLARA_CONFIG_OPTIONAL_TYPE std::optional
8061 #endif
8062 #endif
8063 #endif
8064
8065 // ----------- #included from clara_textflow.hpp -----------
8066
8067 // TextFlowCpp
8068 //
8069 // A single-header library for wrapping and laying out basic text, by Phil Nash
8070 //
8071 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8072 // file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8073 //
8074 // This project is hosted at https://github.com/philsquared/textflowcpp
8075
8076
8077 #include <cassert>
8078 #include <ostream>
8079 #include <sstream>
8080 #include <vector>
8081
8082 #ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
8083 #define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
8084 #endif
8085
8086 namespace Catch {
8087 namespace clara {
8088 namespace TextFlow {
8089
8090 inline auto isWhitespace(char c) -> bool {
8091 static std::string chars = " \t\n\r";
8092 return chars.find(c) != std::string::npos;
8093 }
8094 inline auto isBreakableBefore(char c) -> bool {
8095 static std::string chars = "[({<|";
8096 return chars.find(c) != std::string::npos;
8097 }
8098 inline auto isBreakableAfter(char c) -> bool {
8099 static std::string chars = "])}>.,:;*+-=&/\\";
8100 return chars.find(c) != std::string::npos;
8101 }
8102
8103 class Columns;
8104
8105 class Column {
8106 std::vector<std::string> m_strings;
8107 size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
8108 size_t m_indent = 0;
8109 size_t m_initialIndent = std::string::npos;
8110
8111 public:
8112 class iterator {
8113 friend Column;
8114
8115 Column const& m_column;
8116 size_t m_stringIndex = 0;
8117 size_t m_pos = 0;
8118
8119 size_t m_len = 0;
8120 size_t m_end = 0;
8121 bool m_suffix = false;
8122
8123 iterator(Column const& column, size_t stringIndex)
8124 : m_column(column),
8125 m_stringIndex(stringIndex) {}
8126
8127 auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }
8128
8129 auto isBoundary(size_t at) const -> bool {
8130 assert(at > 0);
8131 assert(at <= line().size());
8132
8133 return at == line().size() ||
8134 (isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) ||
8135 isBreakableBefore(line()[at]) ||
8136 isBreakableAfter(line()[at - 1]);
8137 }
8138
8139 void calcLength() {
8140 assert(m_stringIndex < m_column.m_strings.size());
8141
8142 m_suffix = false;
8143 auto width = m_column.m_width - indent();
8144 m_end = m_pos;
8145 if (line()[m_pos] == '\n') {
8146 ++m_end;
8147 }
8148 while (m_end < line().size() && line()[m_end] != '\n')
8149 ++m_end;
8150
8151 if (m_end < m_pos + width) {
8152 m_len = m_end - m_pos;
8153 } else {
8154 size_t len = width;
8155 while (len > 0 && !isBoundary(m_pos + len))
8156 --len;
8157 while (len > 0 && isWhitespace(line()[m_pos + len - 1]))
8158 --len;
8159
8160 if (len > 0) {
8161 m_len = len;
8162 } else {
8163 m_suffix = true;
8164 m_len = width - 1;
8165 }
8166 }
8167 }
8168
8169 auto indent() const -> size_t {
8170 auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;
8171 return initial == std::string::npos ? m_column.m_indent : initial;
8172 }
8173
8174 auto addIndentAndSuffix(std::string const &plain) const -> std::string {
8175 return std::string(indent(), ' ') + (m_suffix ? plain + "-" : plain);
8176 }
8177
8178 public:
8179 using difference_type = std::ptrdiff_t;
8180 using value_type = std::string;
8181 using pointer = value_type * ;
8182 using reference = value_type & ;
8183 using iterator_category = std::forward_iterator_tag;
8184
8185 explicit iterator(Column const& column) : m_column(column) {
8186 assert(m_column.m_width > m_column.m_indent);
8187 assert(m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent);
8188 calcLength();
8189 if (m_len == 0)
8190 m_stringIndex++; // Empty string
8191 }
8192
8193 auto operator *() const -> std::string {
8194 assert(m_stringIndex < m_column.m_strings.size());
8195 assert(m_pos <= m_end);
8196 return addIndentAndSuffix(line().substr(m_pos, m_len));
8197 }
8198
8199 auto operator ++() -> iterator& {
8200 m_pos += m_len;
8201 if (m_pos < line().size() && line()[m_pos] == '\n')
8202 m_pos += 1;
8203 else
8204 while (m_pos < line().size() && isWhitespace(line()[m_pos]))
8205 ++m_pos;
8206
8207 if (m_pos == line().size()) {
8208 m_pos = 0;
8209 ++m_stringIndex;
8210 }
8211 if (m_stringIndex < m_column.m_strings.size())
8212 calcLength();
8213 return *this;
8214 }
8215 auto operator ++(int) -> iterator {
8216 iterator prev(*this);
8217 operator++();
8218 return prev;
8219 }
8220
8221 auto operator ==(iterator const& other) const -> bool {
8222 return
8223 m_pos == other.m_pos &&
8224 m_stringIndex == other.m_stringIndex &&
8225 &m_column == &other.m_column;
8226 }
8227 auto operator !=(iterator const& other) const -> bool {
8228 return !operator==(other);
8229 }
8230 };
8231 using const_iterator = iterator;
8232
8233 explicit Column(std::string const& text) { m_strings.push_back(text); }
8234
8235 auto width(size_t newWidth) -> Column& {
8236 assert(newWidth > 0);
8237 m_width = newWidth;
8238 return *this;
8239 }
8240 auto indent(size_t newIndent) -> Column& {
8241 m_indent = newIndent;
8242 return *this;
8243 }
8244 auto initialIndent(size_t newIndent) -> Column& {
8245 m_initialIndent = newIndent;
8246 return *this;
8247 }
8248
8249 auto width() const -> size_t { return m_width; }
8250 auto begin() const -> iterator { return iterator(*this); }
8251 auto end() const -> iterator { return { *this, m_strings.size() }; }
8252
8253 inline friend std::ostream& operator << (std::ostream& os, Column const& col) {
8254 bool first = true;
8255 for (auto line : col) {
8256 if (first)
8257 first = false;
8258 else
8259 os << "\n";
8260 os << line;
8261 }
8262 return os;
8263 }
8264
8265 auto operator + (Column const& other)->Columns;
8266
8267 auto toString() const -> std::string {
8268 std::ostringstream oss;
8269 oss << *this;
8270 return oss.str();
8271 }
8272 };
8273
8274 class Spacer : public Column {
8275
8276 public:
8277 explicit Spacer(size_t spaceWidth) : Column("") {
8278 width(spaceWidth);
8279 }
8280 };
8281
8282 class Columns {
8283 std::vector<Column> m_columns;
8284
8285 public:
8286
8287 class iterator {
8288 friend Columns;
8289 struct EndTag {};
8290
8291 std::vector<Column> const& m_columns;
8292 std::vector<Column::iterator> m_iterators;
8293 size_t m_activeIterators;
8294
8295 iterator(Columns const& columns, EndTag)
8296 : m_columns(columns.m_columns),
8297 m_activeIterators(0) {
8298 m_iterators.reserve(m_columns.size());
8299
8300 for (auto const& col : m_columns)
8301 m_iterators.push_back(col.end());
8302 }
8303
8304 public:
8305 using difference_type = std::ptrdiff_t;
8306 using value_type = std::string;
8307 using pointer = value_type * ;
8308 using reference = value_type & ;
8309 using iterator_category = std::forward_iterator_tag;
8310
8311 explicit iterator(Columns const& columns)
8312 : m_columns(columns.m_columns),
8313 m_activeIterators(m_columns.size()) {
8314 m_iterators.reserve(m_columns.size());
8315
8316 for (auto const& col : m_columns)
8317 m_iterators.push_back(col.begin());
8318 }
8319
8320 auto operator ==(iterator const& other) const -> bool {
8321 return m_iterators == other.m_iterators;
8322 }
8323 auto operator !=(iterator const& other) const -> bool {
8324 return m_iterators != other.m_iterators;
8325 }
8326 auto operator *() const -> std::string {
8327 std::string row, padding;
8328
8329 for (size_t i = 0; i < m_columns.size(); ++i) {
8330 auto width = m_columns[i].width();
8331 if (m_iterators[i] != m_columns[i].end()) {
8332 std::string col = *m_iterators[i];
8333 row += padding + col;
8334 if (col.size() < width)
8335 padding = std::string(width - col.size(), ' ');
8336 else
8337 padding = "";
8338 } else {
8339 padding += std::string(width, ' ');
8340 }
8341 }
8342 return row;
8343 }
8344 auto operator ++() -> iterator& {
8345 for (size_t i = 0; i < m_columns.size(); ++i) {
8346 if (m_iterators[i] != m_columns[i].end())
8347 ++m_iterators[i];
8348 }
8349 return *this;
8350 }
8351 auto operator ++(int) -> iterator {
8352 iterator prev(*this);
8353 operator++();
8354 return prev;
8355 }
8356 };
8357 using const_iterator = iterator;
8358
8359 auto begin() const -> iterator { return iterator(*this); }
8360 auto end() const -> iterator { return { *this, iterator::EndTag() }; }
8361
8362 auto operator += (Column const& col) -> Columns& {
8363 m_columns.push_back(col);
8364 return *this;
8365 }
8366 auto operator + (Column const& col) -> Columns {
8367 Columns combined = *this;
8368 combined += col;
8369 return combined;
8370 }
8371
8372 inline friend std::ostream& operator << (std::ostream& os, Columns const& cols) {
8373
8374 bool first = true;
8375 for (auto line : cols) {
8376 if (first)
8377 first = false;
8378 else
8379 os << "\n";
8380 os << line;
8381 }
8382 return os;
8383 }
8384
8385 auto toString() const -> std::string {
8386 std::ostringstream oss;
8387 oss << *this;
8388 return oss.str();
8389 }
8390 };
8391
8392 inline auto Column::operator + (Column const& other) -> Columns {
8393 Columns cols;
8394 cols += *this;
8395 cols += other;
8396 return cols;
8397 }
8398 }
8399
8400 }
8401 }
8402
8403 // ----------- end of #include from clara_textflow.hpp -----------
8404 // ........... back in clara.hpp
8405
8406 #include <cctype>
8407 #include <string>
8408 #include <memory>
8409 #include <set>
8410 #include <algorithm>
8411
8412 #if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )
8413 #define CATCH_PLATFORM_WINDOWS
8414 #endif
8415
8416 namespace Catch { namespace clara {
8417 namespace detail {
8418
8419 // Traits for extracting arg and return type of lambdas (for single argument lambdas)
8420 template<typename L>
8421 struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {};
8422
8423 template<typename ClassT, typename ReturnT, typename... Args>
8424 struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> {
8425 static const bool isValid = false;
8426 };
8427
8428 template<typename ClassT, typename ReturnT, typename ArgT>
8429 struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> {
8430 static const bool isValid = true;
8431 using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;
8432 using ReturnType = ReturnT;
8433 };
8434
8435 class TokenStream;
8436
8437 // Transport for raw args (copied from main args, or supplied via init list for testing)
8438 class Args {
8439 friend TokenStream;
8440 std::string m_exeName;
8441 std::vector<std::string> m_args;
8442
8443 public:
8444 Args( int argc, char const* const* argv )
8445 : m_exeName(argv[0]),
8446 m_args(argv + 1, argv + argc) {}
8447
8448 Args( std::initializer_list<std::string> args )
8449 : m_exeName( *args.begin() ),
8450 m_args( args.begin()+1, args.end() )
8451 {}
8452
8453 auto exeName() const -> std::string {
8454 return m_exeName;
8455 }
8456 };
8457
8458 // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string
8459 // may encode an option + its argument if the : or = form is used
8460 enum class TokenType {
8461 Option, Argument
8462 };
8463 struct Token {
8464 TokenType type;
8465 std::string token;
8466 };
8467
8468 inline auto isOptPrefix( char c ) -> bool {
8469 return c == '-'
8470 #ifdef CATCH_PLATFORM_WINDOWS
8471 || c == '/'
8472 #endif
8473 ;
8474 }
8475
8476 // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled
8477 class TokenStream {
8478 using Iterator = std::vector<std::string>::const_iterator;
8479 Iterator it;
8480 Iterator itEnd;
8481 std::vector<Token> m_tokenBuffer;
8482
8483 void loadBuffer() {
8484 m_tokenBuffer.resize( 0 );
8485
8486 // Skip any empty strings
8487 while( it != itEnd && it->empty() )
8488 ++it;
8489
8490 if( it != itEnd ) {
8491 auto const &next = *it;
8492 if( isOptPrefix( next[0] ) ) {
8493 auto delimiterPos = next.find_first_of( " :=" );
8494 if( delimiterPos != std::string::npos ) {
8495 m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } );
8496 m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } );
8497 } else {
8498 if( next[1] != '-' && next.size() > 2 ) {
8499 std::string opt = "- ";
8500 for( size_t i = 1; i < next.size(); ++i ) {
8501 opt[1] = next[i];
8502 m_tokenBuffer.push_back( { TokenType::Option, opt } );
8503 }
8504 } else {
8505 m_tokenBuffer.push_back( { TokenType::Option, next } );
8506 }
8507 }
8508 } else {
8509 m_tokenBuffer.push_back( { TokenType::Argument, next } );
8510 }
8511 }
8512 }
8513
8514 public:
8515 explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {}
8516
8517 TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) {
8518 loadBuffer();
8519 }
8520
8521 explicit operator bool() const {
8522 return !m_tokenBuffer.empty() || it != itEnd;
8523 }
8524
8525 auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); }
8526
8527 auto operator*() const -> Token {
8528 assert( !m_tokenBuffer.empty() );
8529 return m_tokenBuffer.front();
8530 }
8531
8532 auto operator->() const -> Token const * {
8533 assert( !m_tokenBuffer.empty() );
8534 return &m_tokenBuffer.front();
8535 }
8536
8537 auto operator++() -> TokenStream & {
8538 if( m_tokenBuffer.size() >= 2 ) {
8539 m_tokenBuffer.erase( m_tokenBuffer.begin() );
8540 } else {
8541 if( it != itEnd )
8542 ++it;
8543 loadBuffer();
8544 }
8545 return *this;
8546 }
8547 };
8548
8549 class ResultBase {
8550 public:
8551 enum Type {
8552 Ok, LogicError, RuntimeError
8553 };
8554
8555 protected:
8556 ResultBase( Type type ) : m_type( type ) {}
8557 virtual ~ResultBase() = default;
8558
8559 virtual void enforceOk() const = 0;
8560
8561 Type m_type;
8562 };
8563
8564 template<typename T>
8565 class ResultValueBase : public ResultBase {
8566 public:
8567 auto value() const -> T const & {
8568 enforceOk();
8569 return m_value;
8570 }
8571
8572 protected:
8573 ResultValueBase( Type type ) : ResultBase( type ) {}
8574
8575 ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) {
8576 if( m_type == ResultBase::Ok )
8577 new( &m_value ) T( other.m_value );
8578 }
8579
8580 ResultValueBase( Type, T const &value ) : ResultBase( Ok ) {
8581 new( &m_value ) T( value );
8582 }
8583
8584 auto operator=( ResultValueBase const &other ) -> ResultValueBase & {
8585 if( m_type == ResultBase::Ok )
8586 m_value.~T();
8587 ResultBase::operator=(other);
8588 if( m_type == ResultBase::Ok )
8589 new( &m_value ) T( other.m_value );
8590 return *this;
8591 }
8592
8593 ~ResultValueBase() override {
8594 if( m_type == Ok )
8595 m_value.~T();
8596 }
8597
8598 union {
8599 T m_value;
8600 };
8601 };
8602
8603 template<>
8604 class ResultValueBase<void> : public ResultBase {
8605 protected:
8606 using ResultBase::ResultBase;
8607 };
8608
8609 template<typename T = void>
8610 class BasicResult : public ResultValueBase<T> {
8611 public:
8612 template<typename U>
8613 explicit BasicResult( BasicResult<U> const &other )
8614 : ResultValueBase<T>( other.type() ),
8615 m_errorMessage( other.errorMessage() )
8616 {
8617 assert( type() != ResultBase::Ok );
8618 }
8619
8620 template<typename U>
8621 static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }
8622 static auto ok() -> BasicResult { return { ResultBase::Ok }; }
8623 static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }
8624 static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; }
8625
8626 explicit operator bool() const { return m_type == ResultBase::Ok; }
8627 auto type() const -> ResultBase::Type { return m_type; }
8628 auto errorMessage() const -> std::string { return m_errorMessage; }
8629
8630 protected:
8631 void enforceOk() const override {
8632
8633 // Errors shouldn't reach this point, but if they do
8634 // the actual error message will be in m_errorMessage
8635 assert( m_type != ResultBase::LogicError );
8636 assert( m_type != ResultBase::RuntimeError );
8637 if( m_type != ResultBase::Ok )
8638 std::abort();
8639 }
8640
8641 std::string m_errorMessage; // Only populated if resultType is an error
8642
8643 BasicResult( ResultBase::Type type, std::string const &message )
8644 : ResultValueBase<T>(type),
8645 m_errorMessage(message)
8646 {
8647 assert( m_type != ResultBase::Ok );
8648 }
8649
8650 using ResultValueBase<T>::ResultValueBase;
8651 using ResultBase::m_type;
8652 };
8653
8654 enum class ParseResultType {
8655 Matched, NoMatch, ShortCircuitAll, ShortCircuitSame
8656 };
8657
8658 class ParseState {
8659 public:
8660
8661 ParseState( ParseResultType type, TokenStream const &remainingTokens )
8662 : m_type(type),
8663 m_remainingTokens( remainingTokens )
8664 {}
8665
8666 auto type() const -> ParseResultType { return m_type; }
8667 auto remainingTokens() const -> TokenStream { return m_remainingTokens; }
8668
8669 private:
8670 ParseResultType m_type;
8671 TokenStream m_remainingTokens;
8672 };
8673
8674 using Result = BasicResult<void>;
8675 using ParserResult = BasicResult<ParseResultType>;
8676 using InternalParseResult = BasicResult<ParseState>;
8677
8678 struct HelpColumns {
8679 std::string left;
8680 std::string right;
8681 };
8682
8683 template<typename T>
8684 inline auto convertInto( std::string const &source, T& target ) -> ParserResult {
8685 std::stringstream ss;
8686 ss << source;
8687 ss >> target;
8688 if( ss.fail() )
8689 return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" );
8690 else
8691 return ParserResult::ok( ParseResultType::Matched );
8692 }
8693 inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult {
8694 target = source;
8695 return ParserResult::ok( ParseResultType::Matched );
8696 }
8697 inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
8698 std::string srcLC = source;
8699 std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( std::tolower(c) ); } );
8700 if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
8701 target = true;
8702 else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
8703 target = false;
8704 else
8705 return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" );
8706 return ParserResult::ok( ParseResultType::Matched );
8707 }
8708 #ifdef CLARA_CONFIG_OPTIONAL_TYPE
8709 template<typename T>
8710 inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE<T>& target ) -> ParserResult {
8711 T temp;
8712 auto result = convertInto( source, temp );
8713 if( result )
8714 target = std::move(temp);
8715 return result;
8716 }
8717 #endif // CLARA_CONFIG_OPTIONAL_TYPE
8718
8719 struct NonCopyable {
8720 NonCopyable() = default;
8721 NonCopyable( NonCopyable const & ) = delete;
8722 NonCopyable( NonCopyable && ) = delete;
8723 NonCopyable &operator=( NonCopyable const & ) = delete;
8724 NonCopyable &operator=( NonCopyable && ) = delete;
8725 };
8726
8727 struct BoundRef : NonCopyable {
8728 virtual ~BoundRef() = default;
8729 virtual auto isContainer() const -> bool { return false; }
8730 virtual auto isFlag() const -> bool { return false; }
8731 };
8732 struct BoundValueRefBase : BoundRef {
8733 virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
8734 };
8735 struct BoundFlagRefBase : BoundRef {
8736 virtual auto setFlag( bool flag ) -> ParserResult = 0;
8737 virtual auto isFlag() const -> bool { return true; }
8738 };
8739
8740 template<typename T>
8741 struct BoundValueRef : BoundValueRefBase {
8742 T &m_ref;
8743
8744 explicit BoundValueRef( T &ref ) : m_ref( ref ) {}
8745
8746 auto setValue( std::string const &arg ) -> ParserResult override {
8747 return convertInto( arg, m_ref );
8748 }
8749 };
8750
8751 template<typename T>
8752 struct BoundValueRef<std::vector<T>> : BoundValueRefBase {
8753 std::vector<T> &m_ref;
8754
8755 explicit BoundValueRef( std::vector<T> &ref ) : m_ref( ref ) {}
8756
8757 auto isContainer() const -> bool override { return true; }
8758
8759 auto setValue( std::string const &arg ) -> ParserResult override {
8760 T temp;
8761 auto result = convertInto( arg, temp );
8762 if( result )
8763 m_ref.push_back( temp );
8764 return result;
8765 }
8766 };
8767
8768 struct BoundFlagRef : BoundFlagRefBase {
8769 bool &m_ref;
8770
8771 explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {}
8772
8773 auto setFlag( bool flag ) -> ParserResult override {
8774 m_ref = flag;
8775 return ParserResult::ok( ParseResultType::Matched );
8776 }
8777 };
8778
8779 template<typename ReturnType>
8780 struct LambdaInvoker {
8781 static_assert( std::is_same<ReturnType, ParserResult>::value, "Lambda must return void or clara::ParserResult" );
8782
8783 template<typename L, typename ArgType>
8784 static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {
8785 return lambda( arg );
8786 }
8787 };
8788
8789 template<>
8790 struct LambdaInvoker<void> {
8791 template<typename L, typename ArgType>
8792 static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {
8793 lambda( arg );
8794 return ParserResult::ok( ParseResultType::Matched );
8795 }
8796 };
8797
8798 template<typename ArgType, typename L>
8799 inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult {
8800 ArgType temp{};
8801 auto result = convertInto( arg, temp );
8802 return !result
8803 ? result
8804 : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );
8805 }
8806
8807 template<typename L>
8808 struct BoundLambda : BoundValueRefBase {
8809 L m_lambda;
8810
8811 static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" );
8812 explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {}
8813
8814 auto setValue( std::string const &arg ) -> ParserResult override {
8815 return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg );
8816 }
8817 };
8818
8819 template<typename L>
8820 struct BoundFlagLambda : BoundFlagRefBase {
8821 L m_lambda;
8822
8823 static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" );
8824 static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, "flags must be boolean" );
8825
8826 explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}
8827
8828 auto setFlag( bool flag ) -> ParserResult override {
8829 return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag );
8830 }
8831 };
8832
8833 enum class Optionality { Optional, Required };
8834
8835 struct Parser;
8836
8837 class ParserBase {
8838 public:
8839 virtual ~ParserBase() = default;
8840 virtual auto validate() const -> Result { return Result::ok(); }
8841 virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0;
8842 virtual auto cardinality() const -> size_t { return 1; }
8843
8844 auto parse( Args const &args ) const -> InternalParseResult {
8845 return parse( args.exeName(), TokenStream( args ) );
8846 }
8847 };
8848
8849 template<typename DerivedT>
8850 class ComposableParserImpl : public ParserBase {
8851 public:
8852 template<typename T>
8853 auto operator|( T const &other ) const -> Parser;
8854
8855 template<typename T>
8856 auto operator+( T const &other ) const -> Parser;
8857 };
8858
8859 // Common code and state for Args and Opts
8860 template<typename DerivedT>
8861 class ParserRefImpl : public ComposableParserImpl<DerivedT> {
8862 protected:
8863 Optionality m_optionality = Optionality::Optional;
8864 std::shared_ptr<BoundRef> m_ref;
8865 std::string m_hint;
8866 std::string m_description;
8867
8868 explicit ParserRefImpl( std::shared_ptr<BoundRef> const &ref ) : m_ref( ref ) {}
8869
8870 public:
8871 template<typename T>
8872 ParserRefImpl( T &ref, std::string const &hint )
8873 : m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),
8874 m_hint( hint )
8875 {}
8876
8877 template<typename LambdaT>
8878 ParserRefImpl( LambdaT const &ref, std::string const &hint )
8879 : m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),
8880 m_hint(hint)
8881 {}
8882
8883 auto operator()( std::string const &description ) -> DerivedT & {
8884 m_description = description;
8885 return static_cast<DerivedT &>( *this );
8886 }
8887
8888 auto optional() -> DerivedT & {
8889 m_optionality = Optionality::Optional;
8890 return static_cast<DerivedT &>( *this );
8891 };
8892
8893 auto required() -> DerivedT & {
8894 m_optionality = Optionality::Required;
8895 return static_cast<DerivedT &>( *this );
8896 };
8897
8898 auto isOptional() const -> bool {
8899 return m_optionality == Optionality::Optional;
8900 }
8901
8902 auto cardinality() const -> size_t override {
8903 if( m_ref->isContainer() )
8904 return 0;
8905 else
8906 return 1;
8907 }
8908
8909 auto hint() const -> std::string { return m_hint; }
8910 };
8911
8912 class ExeName : public ComposableParserImpl<ExeName> {
8913 std::shared_ptr<std::string> m_name;
8914 std::shared_ptr<BoundValueRefBase> m_ref;
8915
8916 template<typename LambdaT>
8917 static auto makeRef(LambdaT const &lambda) -> std::shared_ptr<BoundValueRefBase> {
8918 return std::make_shared<BoundLambda<LambdaT>>( lambda) ;
8919 }
8920
8921 public:
8922 ExeName() : m_name( std::make_shared<std::string>( "<executable>" ) ) {}
8923
8924 explicit ExeName( std::string &ref ) : ExeName() {
8925 m_ref = std::make_shared<BoundValueRef<std::string>>( ref );
8926 }
8927
8928 template<typename LambdaT>
8929 explicit ExeName( LambdaT const& lambda ) : ExeName() {
8930 m_ref = std::make_shared<BoundLambda<LambdaT>>( lambda );
8931 }
8932
8933 // The exe name is not parsed out of the normal tokens, but is handled specially
8934 auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {
8935 return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
8936 }
8937
8938 auto name() const -> std::string { return *m_name; }
8939 auto set( std::string const& newName ) -> ParserResult {
8940
8941 auto lastSlash = newName.find_last_of( "\\/" );
8942 auto filename = ( lastSlash == std::string::npos )
8943 ? newName
8944 : newName.substr( lastSlash+1 );
8945
8946 *m_name = filename;
8947 if( m_ref )
8948 return m_ref->setValue( filename );
8949 else
8950 return ParserResult::ok( ParseResultType::Matched );
8951 }
8952 };
8953
8954 class Arg : public ParserRefImpl<Arg> {
8955 public:
8956 using ParserRefImpl::ParserRefImpl;
8957
8958 auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override {
8959 auto validationResult = validate();
8960 if( !validationResult )
8961 return InternalParseResult( validationResult );
8962
8963 auto remainingTokens = tokens;
8964 auto const &token = *remainingTokens;
8965 if( token.type != TokenType::Argument )
8966 return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
8967
8968 assert( !m_ref->isFlag() );
8969 auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
8970
8971 auto result = valueRef->setValue( remainingTokens->token );
8972 if( !result )
8973 return InternalParseResult( result );
8974 else
8975 return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );
8976 }
8977 };
8978
8979 inline auto normaliseOpt( std::string const &optName ) -> std::string {
8980 #ifdef CATCH_PLATFORM_WINDOWS
8981 if( optName[0] == '/' )
8982 return "-" + optName.substr( 1 );
8983 else
8984 #endif
8985 return optName;
8986 }
8987
8988 class Opt : public ParserRefImpl<Opt> {
8989 protected:
8990 std::vector<std::string> m_optNames;
8991
8992 public:
8993 template<typename LambdaT>
8994 explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared<BoundFlagLambda<LambdaT>>( ref ) ) {}
8995
8996 explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared<BoundFlagRef>( ref ) ) {}
8997
8998 template<typename LambdaT>
8999 Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
9000
9001 template<typename T>
9002 Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
9003
9004 auto operator[]( std::string const &optName ) -> Opt & {
9005 m_optNames.push_back( optName );
9006 return *this;
9007 }
9008
9009 auto getHelpColumns() const -> std::vector<HelpColumns> {
9010 std::ostringstream oss;
9011 bool first = true;
9012 for( auto const &opt : m_optNames ) {
9013 if (first)
9014 first = false;
9015 else
9016 oss << ", ";
9017 oss << opt;
9018 }
9019 if( !m_hint.empty() )
9020 oss << " <" << m_hint << ">";
9021 return { { oss.str(), m_description } };
9022 }
9023
9024 auto isMatch( std::string const &optToken ) const -> bool {
9025 auto normalisedToken = normaliseOpt( optToken );
9026 for( auto const &name : m_optNames ) {
9027 if( normaliseOpt( name ) == normalisedToken )
9028 return true;
9029 }
9030 return false;
9031 }
9032
9033 using ParserBase::parse;
9034
9035 auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {
9036 auto validationResult = validate();
9037 if( !validationResult )
9038 return InternalParseResult( validationResult );
9039
9040 auto remainingTokens = tokens;
9041 if( remainingTokens && remainingTokens->type == TokenType::Option ) {
9042 auto const &token = *remainingTokens;
9043 if( isMatch(token.token ) ) {
9044 if( m_ref->isFlag() ) {
9045 auto flagRef = static_cast<detail::BoundFlagRefBase*>( m_ref.get() );
9046 auto result = flagRef->setFlag( true );
9047 if( !result )
9048 return InternalParseResult( result );
9049 if( result.value() == ParseResultType::ShortCircuitAll )
9050 return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
9051 } else {
9052 auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
9053 ++remainingTokens;
9054 if( !remainingTokens )
9055 return InternalParseResult::runtimeError( "Expected argument following " + token.token );
9056 auto const &argToken = *remainingTokens;
9057 if( argToken.type != TokenType::Argument )
9058 return InternalParseResult::runtimeError( "Expected argument following " + token.token );
9059 auto result = valueRef->setValue( argToken.token );
9060 if( !result )
9061 return InternalParseResult( result );
9062 if( result.value() == ParseResultType::ShortCircuitAll )
9063 return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
9064 }
9065 return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );
9066 }
9067 }
9068 return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
9069 }
9070
9071 auto validate() const -> Result override {
9072 if( m_optNames.empty() )
9073 return Result::logicError( "No options supplied to Opt" );
9074 for( auto const &name : m_optNames ) {
9075 if( name.empty() )
9076 return Result::logicError( "Option name cannot be empty" );
9077 #ifdef CATCH_PLATFORM_WINDOWS
9078 if( name[0] != '-' && name[0] != '/' )
9079 return Result::logicError( "Option name must begin with '-' or '/'" );
9080 #else
9081 if( name[0] != '-' )
9082 return Result::logicError( "Option name must begin with '-'" );
9083 #endif
9084 }
9085 return ParserRefImpl::validate();
9086 }
9087 };
9088
9089 struct Help : Opt {
9090 Help( bool &showHelpFlag )
9091 : Opt([&]( bool flag ) {
9092 showHelpFlag = flag;
9093 return ParserResult::ok( ParseResultType::ShortCircuitAll );
9094 })
9095 {
9096 static_cast<Opt &>( *this )
9097 ("display usage information")
9098 ["-?"]["-h"]["--help"]
9099 .optional();
9100 }
9101 };
9102
9103 struct Parser : ParserBase {
9104
9105 mutable ExeName m_exeName;
9106 std::vector<Opt> m_options;
9107 std::vector<Arg> m_args;
9108
9109 auto operator|=( ExeName const &exeName ) -> Parser & {
9110 m_exeName = exeName;
9111 return *this;
9112 }
9113
9114 auto operator|=( Arg const &arg ) -> Parser & {
9115 m_args.push_back(arg);
9116 return *this;
9117 }
9118
9119 auto operator|=( Opt const &opt ) -> Parser & {
9120 m_options.push_back(opt);
9121 return *this;
9122 }
9123
9124 auto operator|=( Parser const &other ) -> Parser & {
9125 m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());
9126 m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());
9127 return *this;
9128 }
9129
9130 template<typename T>
9131 auto operator|( T const &other ) const -> Parser {
9132 return Parser( *this ) |= other;
9133 }
9134
9135 // Forward deprecated interface with '+' instead of '|'
9136 template<typename T>
9137 auto operator+=( T const &other ) -> Parser & { return operator|=( other ); }
9138 template<typename T>
9139 auto operator+( T const &other ) const -> Parser { return operator|( other ); }
9140
9141 auto getHelpColumns() const -> std::vector<HelpColumns> {
9142 std::vector<HelpColumns> cols;
9143 for (auto const &o : m_options) {
9144 auto childCols = o.getHelpColumns();
9145 cols.insert( cols.end(), childCols.begin(), childCols.end() );
9146 }
9147 return cols;
9148 }
9149
9150 void writeToStream( std::ostream &os ) const {
9151 if (!m_exeName.name().empty()) {
9152 os << "usage:\n" << " " << m_exeName.name() << " ";
9153 bool required = true, first = true;
9154 for( auto const &arg : m_args ) {
9155 if (first)
9156 first = false;
9157 else
9158 os << " ";
9159 if( arg.isOptional() && required ) {
9160 os << "[";
9161 required = false;
9162 }
9163 os << "<" << arg.hint() << ">";
9164 if( arg.cardinality() == 0 )
9165 os << " ... ";
9166 }
9167 if( !required )
9168 os << "]";
9169 if( !m_options.empty() )
9170 os << " options";
9171 os << "\n\nwhere options are:" << std::endl;
9172 }
9173
9174 auto rows = getHelpColumns();
9175 size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH;
9176 size_t optWidth = 0;
9177 for( auto const &cols : rows )
9178 optWidth = (std::max)(optWidth, cols.left.size() + 2);
9179
9180 optWidth = (std::min)(optWidth, consoleWidth/2);
9181
9182 for( auto const &cols : rows ) {
9183 auto row =
9184 TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +
9185 TextFlow::Spacer(4) +
9186 TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );
9187 os << row << std::endl;
9188 }
9189 }
9190
9191 friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {
9192 parser.writeToStream( os );
9193 return os;
9194 }
9195
9196 auto validate() const -> Result override {
9197 for( auto const &opt : m_options ) {
9198 auto result = opt.validate();
9199 if( !result )
9200 return result;
9201 }
9202 for( auto const &arg : m_args ) {
9203 auto result = arg.validate();
9204 if( !result )
9205 return result;
9206 }
9207 return Result::ok();
9208 }
9209
9210 using ParserBase::parse;
9211
9212 auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {
9213
9214 struct ParserInfo {
9215 ParserBase const* parser = nullptr;
9216 size_t count = 0;
9217 };
9218 const size_t totalParsers = m_options.size() + m_args.size();
9219 assert( totalParsers < 512 );
9220 // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do
9221 ParserInfo parseInfos[512];
9222
9223 {
9224 size_t i = 0;
9225 for (auto const &opt : m_options) parseInfos[i++].parser = &opt;
9226 for (auto const &arg : m_args) parseInfos[i++].parser = &arg;
9227 }
9228
9229 m_exeName.set( exeName );
9230
9231 auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
9232 while( result.value().remainingTokens() ) {
9233 bool tokenParsed = false;
9234
9235 for( size_t i = 0; i < totalParsers; ++i ) {
9236 auto& parseInfo = parseInfos[i];
9237 if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) {
9238 result = parseInfo.parser->parse(exeName, result.value().remainingTokens());
9239 if (!result)
9240 return result;
9241 if (result.value().type() != ParseResultType::NoMatch) {
9242 tokenParsed = true;
9243 ++parseInfo.count;
9244 break;
9245 }
9246 }
9247 }
9248
9249 if( result.value().type() == ParseResultType::ShortCircuitAll )
9250 return result;
9251 if( !tokenParsed )
9252 return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token );
9253 }
9254 // !TBD Check missing required options
9255 return result;
9256 }
9257 };
9258
9259 template<typename DerivedT>
9260 template<typename T>
9261 auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {
9262 return Parser() | static_cast<DerivedT const &>( *this ) | other;
9263 }
9264 } // namespace detail
9265
9266 // A Combined parser
9267 using detail::Parser;
9268
9269 // A parser for options
9270 using detail::Opt;
9271
9272 // A parser for arguments
9273 using detail::Arg;
9274
9275 // Wrapper for argc, argv from main()
9276 using detail::Args;
9277
9278 // Specifies the name of the executable
9279 using detail::ExeName;
9280
9281 // Convenience wrapper for option parser that specifies the help option
9282 using detail::Help;
9283
9284 // enum of result types from a parse
9285 using detail::ParseResultType;
9286
9287 // Result type for parser operation
9288 using detail::ParserResult;
9289
9290 }} // namespace Catch::clara
9291
9292 // end clara.hpp
9293 #ifdef __clang__
9294 #pragma clang diagnostic pop
9295 #endif
9296
9297 // Restore Clara's value for console width, if present
9298 #ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
9299 #define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
9300 #undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
9301 #endif
9302
9303 // end catch_clara.h
9304 namespace Catch {
9305
9306 clara::Parser makeCommandLineParser( ConfigData& config );
9307
9308 } // end namespace Catch
9309
9310 // end catch_commandline.h
9311 #include <fstream>
9312 #include <ctime>
9313
9314 namespace Catch {
9315
9316 clara::Parser makeCommandLineParser( ConfigData& config ) {
9317
9318 using namespace clara;
9319
9320 auto const setWarning = [&]( std::string const& warning ) {
9321 auto warningSet = [&]() {
9322 if( warning == "NoAssertions" )
9323 return WarnAbout::NoAssertions;
9324
9325 if ( warning == "NoTests" )
9326 return WarnAbout::NoTests;
9327
9328 return WarnAbout::Nothing;
9329 }();
9330
9331 if (warningSet == WarnAbout::Nothing)
9332 return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" );
9333 config.warnings = static_cast<WarnAbout::What>( config.warnings | warningSet );
9334 return ParserResult::ok( ParseResultType::Matched );
9335 };
9336 auto const loadTestNamesFromFile = [&]( std::string const& filename ) {
9337 std::ifstream f( filename.c_str() );
9338 if( !f.is_open() )
9339 return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" );
9340
9341 std::string line;
9342 while( std::getline( f, line ) ) {
9343 line = trim(line);
9344 if( !line.empty() && !startsWith( line, '#' ) ) {
9345 if( !startsWith( line, '"' ) )
9346 line = '"' + line + '"';
9347 config.testsOrTags.push_back( line + ',' );
9348 }
9349 }
9350 return ParserResult::ok( ParseResultType::Matched );
9351 };
9352 auto const setTestOrder = [&]( std::string const& order ) {
9353 if( startsWith( "declared", order ) )
9354 config.runOrder = RunTests::InDeclarationOrder;
9355 else if( startsWith( "lexical", order ) )
9356 config.runOrder = RunTests::InLexicographicalOrder;
9357 else if( startsWith( "random", order ) )
9358 config.runOrder = RunTests::InRandomOrder;
9359 else
9360 return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" );
9361 return ParserResult::ok( ParseResultType::Matched );
9362 };
9363 auto const setRngSeed = [&]( std::string const& seed ) {
9364 if( seed != "time" )
9365 return clara::detail::convertInto( seed, config.rngSeed );
9366 config.rngSeed = static_cast<unsigned int>( std::time(nullptr) );
9367 return ParserResult::ok( ParseResultType::Matched );
9368 };
9369 auto const setColourUsage = [&]( std::string const& useColour ) {
9370 auto mode = toLower( useColour );
9371
9372 if( mode == "yes" )
9373 config.useColour = UseColour::Yes;
9374 else if( mode == "no" )
9375 config.useColour = UseColour::No;
9376 else if( mode == "auto" )
9377 config.useColour = UseColour::Auto;
9378 else
9379 return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" );
9380 return ParserResult::ok( ParseResultType::Matched );
9381 };
9382 auto const setWaitForKeypress = [&]( std::string const& keypress ) {
9383 auto keypressLc = toLower( keypress );
9384 if( keypressLc == "start" )
9385 config.waitForKeypress = WaitForKeypress::BeforeStart;
9386 else if( keypressLc == "exit" )
9387 config.waitForKeypress = WaitForKeypress::BeforeExit;
9388 else if( keypressLc == "both" )
9389 config.waitForKeypress = WaitForKeypress::BeforeStartAndExit;
9390 else
9391 return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" );
9392 return ParserResult::ok( ParseResultType::Matched );
9393 };
9394 auto const setVerbosity = [&]( std::string const& verbosity ) {
9395 auto lcVerbosity = toLower( verbosity );
9396 if( lcVerbosity == "quiet" )
9397 config.verbosity = Verbosity::Quiet;
9398 else if( lcVerbosity == "normal" )
9399 config.verbosity = Verbosity::Normal;
9400 else if( lcVerbosity == "high" )
9401 config.verbosity = Verbosity::High;
9402 else
9403 return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" );
9404 return ParserResult::ok( ParseResultType::Matched );
9405 };
9406 auto const setReporter = [&]( std::string const& reporter ) {
9407 IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
9408
9409 auto lcReporter = toLower( reporter );
9410 auto result = factories.find( lcReporter );
9411
9412 if( factories.end() != result )
9413 config.reporterName = lcReporter;
9414 else
9415 return ParserResult::runtimeError( "Unrecognized reporter, '" + reporter + "'. Check available with --list-reporters" );
9416 return ParserResult::ok( ParseResultType::Matched );
9417 };
9418
9419 auto cli
9420 = ExeName( config.processName )
9421 | Help( config.showHelp )
9422 | Opt( config.listTests )
9423 ["-l"]["--list-tests"]
9424 ( "list all/matching test cases" )
9425 | Opt( config.listTags )
9426 ["-t"]["--list-tags"]
9427 ( "list all/matching tags" )
9428 | Opt( config.showSuccessfulTests )
9429 ["-s"]["--success"]
9430 ( "include successful tests in output" )
9431 | Opt( config.shouldDebugBreak )
9432 ["-b"]["--break"]
9433 ( "break into debugger on failure" )
9434 | Opt( config.noThrow )
9435 ["-e"]["--nothrow"]
9436 ( "skip exception tests" )
9437 | Opt( config.showInvisibles )
9438 ["-i"]["--invisibles"]
9439 ( "show invisibles (tabs, newlines)" )
9440 | Opt( config.outputFilename, "filename" )
9441 ["-o"]["--out"]
9442 ( "output filename" )
9443 | Opt( setReporter, "name" )
9444 ["-r"]["--reporter"]
9445 ( "reporter to use (defaults to console)" )
9446 | Opt( config.name, "name" )
9447 ["-n"]["--name"]
9448 ( "suite name" )
9449 | Opt( [&]( bool ){ config.abortAfter = 1; } )
9450 ["-a"]["--abort"]
9451 ( "abort at first failure" )
9452 | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
9453 ["-x"]["--abortx"]
9454 ( "abort after x failures" )
9455 | Opt( setWarning, "warning name" )
9456 ["-w"]["--warn"]
9457 ( "enable warnings" )
9458 | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
9459 ["-d"]["--durations"]
9460 ( "show test durations" )
9461 | Opt( loadTestNamesFromFile, "filename" )
9462 ["-f"]["--input-file"]
9463 ( "load test names to run from a file" )
9464 | Opt( config.filenamesAsTags )
9465 ["-#"]["--filenames-as-tags"]
9466 ( "adds a tag for the filename" )
9467 | Opt( config.sectionsToRun, "section name" )
9468 ["-c"]["--section"]
9469 ( "specify section to run" )
9470 | Opt( setVerbosity, "quiet|normal|high" )
9471 ["-v"]["--verbosity"]
9472 ( "set output verbosity" )
9473 | Opt( config.listTestNamesOnly )
9474 ["--list-test-names-only"]
9475 ( "list all/matching test cases names only" )
9476 | Opt( config.listReporters )
9477 ["--list-reporters"]
9478 ( "list all reporters" )
9479 | Opt( setTestOrder, "decl|lex|rand" )
9480 ["--order"]
9481 ( "test case order (defaults to decl)" )
9482 | Opt( setRngSeed, "'time'|number" )
9483 ["--rng-seed"]
9484 ( "set a specific seed for random numbers" )
9485 | Opt( setColourUsage, "yes|no" )
9486 ["--use-colour"]
9487 ( "should output be colourised" )
9488 | Opt( config.libIdentify )
9489 ["--libidentify"]
9490 ( "report name and version according to libidentify standard" )
9491 | Opt( setWaitForKeypress, "start|exit|both" )
9492 ["--wait-for-keypress"]
9493 ( "waits for a keypress before exiting" )
9494 | Opt( config.benchmarkSamples, "samples" )
9495 ["--benchmark-samples"]
9496 ( "number of samples to collect (default: 100)" )
9497 | Opt( config.benchmarkResamples, "resamples" )
9498 ["--benchmark-resamples"]
9499 ( "number of resamples for the bootstrap (default: 100000)" )
9500 | Opt( config.benchmarkConfidenceInterval, "confidence interval" )
9501 ["--benchmark-confidence-interval"]
9502 ( "confidence interval for the bootstrap (between 0 and 1, default: 0.95)" )
9503 | Opt( config.benchmarkNoAnalysis )
9504 ["--benchmark-no-analysis"]
9505 ( "perform only measurements; do not perform any analysis" )
9506 | Arg( config.testsOrTags, "test name|pattern|tags" )
9507 ( "which test or tests to use" );
9508
9509 return cli;
9510 }
9511
9512 } // end namespace Catch
9513 // end catch_commandline.cpp
9514 // start catch_common.cpp
9515
9516 #include <cstring>
9517 #include <ostream>
9518
9519 namespace Catch {
9520
9521 bool SourceLineInfo::empty() const noexcept {
9522 return file[0] == '\0';
9523 }
9524 bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {
9525 return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);
9526 }
9527 bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept {
9528 // We can assume that the same file will usually have the same pointer.
9529 // Thus, if the pointers are the same, there is no point in calling the strcmp
9530 return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0));
9531 }
9532
9533 std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
9534 #ifndef __GNUG__
9535 os << info.file << '(' << info.line << ')';
9536 #else
9537 os << info.file << ':' << info.line;
9538 #endif
9539 return os;
9540 }
9541
9542 std::string StreamEndStop::operator+() const {
9543 return std::string();
9544 }
9545
9546 NonCopyable::NonCopyable() = default;
9547 NonCopyable::~NonCopyable() = default;
9548
9549 }
9550 // end catch_common.cpp
9551 // start catch_config.cpp
9552
9553 namespace Catch {
9554
9555 Config::Config( ConfigData const& data )
9556 : m_data( data ),
9557 m_stream( openStream() )
9558 {
9559 TestSpecParser parser(ITagAliasRegistry::get());
9560 if (!data.testsOrTags.empty()) {
9561 m_hasTestFilters = true;
9562 for( auto const& testOrTags : data.testsOrTags )
9563 parser.parse( testOrTags );
9564 }
9565 m_testSpec = parser.testSpec();
9566 }
9567
9568 std::string const& Config::getFilename() const {
9569 return m_data.outputFilename ;
9570 }
9571
9572 bool Config::listTests() const { return m_data.listTests; }
9573 bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; }
9574 bool Config::listTags() const { return m_data.listTags; }
9575 bool Config::listReporters() const { return m_data.listReporters; }
9576
9577 std::string Config::getProcessName() const { return m_data.processName; }
9578 std::string const& Config::getReporterName() const { return m_data.reporterName; }
9579
9580 std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; }
9581 std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }
9582
9583 TestSpec const& Config::testSpec() const { return m_testSpec; }
9584 bool Config::hasTestFilters() const { return m_hasTestFilters; }
9585
9586 bool Config::showHelp() const { return m_data.showHelp; }
9587
9588 // IConfig interface
9589 bool Config::allowThrows() const { return !m_data.noThrow; }
9590 std::ostream& Config::stream() const { return m_stream->stream(); }
9591 std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
9592 bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; }
9593 bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); }
9594 bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); }
9595 ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }
9596 RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; }
9597 unsigned int Config::rngSeed() const { return m_data.rngSeed; }
9598 UseColour::YesOrNo Config::useColour() const { return m_data.useColour; }
9599 bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; }
9600 int Config::abortAfter() const { return m_data.abortAfter; }
9601 bool Config::showInvisibles() const { return m_data.showInvisibles; }
9602 Verbosity Config::verbosity() const { return m_data.verbosity; }
9603
9604 bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; }
9605 int Config::benchmarkSamples() const { return m_data.benchmarkSamples; }
9606 double Config::benchmarkConfidenceInterval() const { return m_data.benchmarkConfidenceInterval; }
9607 unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; }
9608
9609 IStream const* Config::openStream() {
9610 return Catch::makeStream(m_data.outputFilename);
9611 }
9612
9613 } // end namespace Catch
9614 // end catch_config.cpp
9615 // start catch_console_colour.cpp
9616
9617 #if defined(__clang__)
9618 # pragma clang diagnostic push
9619 # pragma clang diagnostic ignored "-Wexit-time-destructors"
9620 #endif
9621
9622 // start catch_errno_guard.h
9623
9624 namespace Catch {
9625
9626 class ErrnoGuard {
9627 public:
9628 ErrnoGuard();
9629 ~ErrnoGuard();
9630 private:
9631 int m_oldErrno;
9632 };
9633
9634 }
9635
9636 // end catch_errno_guard.h
9637 #include <sstream>
9638
9639 namespace Catch {
9640 namespace {
9641
9642 struct IColourImpl {
9643 virtual ~IColourImpl() = default;
9644 virtual void use( Colour::Code _colourCode ) = 0;
9645 };
9646
9647 struct NoColourImpl : IColourImpl {
9648 void use( Colour::Code ) {}
9649
9650 static IColourImpl* instance() {
9651 static NoColourImpl s_instance;
9652 return &s_instance;
9653 }
9654 };
9655
9656 } // anon namespace
9657 } // namespace Catch
9658
9659 #if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI )
9660 # ifdef CATCH_PLATFORM_WINDOWS
9661 # define CATCH_CONFIG_COLOUR_WINDOWS
9662 # else
9663 # define CATCH_CONFIG_COLOUR_ANSI
9664 # endif
9665 #endif
9666
9667 #if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////
9668
9669 namespace Catch {
9670 namespace {
9671
9672 class Win32ColourImpl : public IColourImpl {
9673 public:
9674 Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) )
9675 {
9676 CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
9677 GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );
9678 originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY );
9679 originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
9680 }
9681
9682 void use( Colour::Code _colourCode ) override {
9683 switch( _colourCode ) {
9684 case Colour::None: return setTextAttribute( originalForegroundAttributes );
9685 case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
9686 case Colour::Red: return setTextAttribute( FOREGROUND_RED );
9687 case Colour::Green: return setTextAttribute( FOREGROUND_GREEN );
9688 case Colour::Blue: return setTextAttribute( FOREGROUND_BLUE );
9689 case Colour::Cyan: return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN );
9690 case Colour::Yellow: return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN );
9691 case Colour::Grey: return setTextAttribute( 0 );
9692
9693 case Colour::LightGrey: return setTextAttribute( FOREGROUND_INTENSITY );
9694 case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );
9695 case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );
9696 case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
9697 case Colour::BrightYellow: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN );
9698
9699 case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
9700
9701 default:
9702 CATCH_ERROR( "Unknown colour requested" );
9703 }
9704 }
9705
9706 private:
9707 void setTextAttribute( WORD _textAttribute ) {
9708 SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes );
9709 }
9710 HANDLE stdoutHandle;
9711 WORD originalForegroundAttributes;
9712 WORD originalBackgroundAttributes;
9713 };
9714
9715 IColourImpl* platformColourInstance() {
9716 static Win32ColourImpl s_instance;
9717
9718 IConfigPtr config = getCurrentContext().getConfig();
9719 UseColour::YesOrNo colourMode = config
9720 ? config->useColour()
9721 : UseColour::Auto;
9722 if( colourMode == UseColour::Auto )
9723 colourMode = UseColour::Yes;
9724 return colourMode == UseColour::Yes
9725 ? &s_instance
9726 : NoColourImpl::instance();
9727 }
9728
9729 } // end anon namespace
9730 } // end namespace Catch
9731
9732 #elif defined( CATCH_CONFIG_COLOUR_ANSI ) //////////////////////////////////////
9733
9734 #include <unistd.h>
9735
9736 namespace Catch {
9737 namespace {
9738
9739 // use POSIX/ ANSI console terminal codes
9740 // Thanks to Adam Strzelecki for original contribution
9741 // (http://github.com/nanoant)
9742 // https://github.com/philsquared/Catch/pull/131
9743 class PosixColourImpl : public IColourImpl {
9744 public:
9745 void use( Colour::Code _colourCode ) override {
9746 switch( _colourCode ) {
9747 case Colour::None:
9748 case Colour::White: return setColour( "[0m" );
9749 case Colour::Red: return setColour( "[0;31m" );
9750 case Colour::Green: return setColour( "[0;32m" );
9751 case Colour::Blue: return setColour( "[0;34m" );
9752 case Colour::Cyan: return setColour( "[0;36m" );
9753 case Colour::Yellow: return setColour( "[0;33m" );
9754 case Colour::Grey: return setColour( "[1;30m" );
9755
9756 case Colour::LightGrey: return setColour( "[0;37m" );
9757 case Colour::BrightRed: return setColour( "[1;31m" );
9758 case Colour::BrightGreen: return setColour( "[1;32m" );
9759 case Colour::BrightWhite: return setColour( "[1;37m" );
9760 case Colour::BrightYellow: return setColour( "[1;33m" );
9761
9762 case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
9763 default: CATCH_INTERNAL_ERROR( "Unknown colour requested" );
9764 }
9765 }
9766 static IColourImpl* instance() {
9767 static PosixColourImpl s_instance;
9768 return &s_instance;
9769 }
9770
9771 private:
9772 void setColour( const char* _escapeCode ) {
9773 getCurrentContext().getConfig()->stream()
9774 << '\033' << _escapeCode;
9775 }
9776 };
9777
9778 bool useColourOnPlatform() {
9779 return
9780 #ifdef CATCH_PLATFORM_MAC
9781 !isDebuggerActive() &&
9782 #endif
9783 #if !(defined(__DJGPP__) && defined(__STRICT_ANSI__))
9784 isatty(STDOUT_FILENO)
9785 #else
9786 false
9787 #endif
9788 ;
9789 }
9790 IColourImpl* platformColourInstance() {
9791 ErrnoGuard guard;
9792 IConfigPtr config = getCurrentContext().getConfig();
9793 UseColour::YesOrNo colourMode = config
9794 ? config->useColour()
9795 : UseColour::Auto;
9796 if( colourMode == UseColour::Auto )
9797 colourMode = useColourOnPlatform()
9798 ? UseColour::Yes
9799 : UseColour::No;
9800 return colourMode == UseColour::Yes
9801 ? PosixColourImpl::instance()
9802 : NoColourImpl::instance();
9803 }
9804
9805 } // end anon namespace
9806 } // end namespace Catch
9807
9808 #else // not Windows or ANSI ///////////////////////////////////////////////
9809
9810 namespace Catch {
9811
9812 static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); }
9813
9814 } // end namespace Catch
9815
9816 #endif // Windows/ ANSI/ None
9817
9818 namespace Catch {
9819
9820 Colour::Colour( Code _colourCode ) { use( _colourCode ); }
9821 Colour::Colour( Colour&& rhs ) noexcept {
9822 m_moved = rhs.m_moved;
9823 rhs.m_moved = true;
9824 }
9825 Colour& Colour::operator=( Colour&& rhs ) noexcept {
9826 m_moved = rhs.m_moved;
9827 rhs.m_moved = true;
9828 return *this;
9829 }
9830
9831 Colour::~Colour(){ if( !m_moved ) use( None ); }
9832
9833 void Colour::use( Code _colourCode ) {
9834 static IColourImpl* impl = platformColourInstance();
9835 // Strictly speaking, this cannot possibly happen.
9836 // However, under some conditions it does happen (see #1626),
9837 // and this change is small enough that we can let practicality
9838 // triumph over purity in this case.
9839 if (impl != NULL) {
9840 impl->use( _colourCode );
9841 }
9842 }
9843
9844 std::ostream& operator << ( std::ostream& os, Colour const& ) {
9845 return os;
9846 }
9847
9848 } // end namespace Catch
9849
9850 #if defined(__clang__)
9851 # pragma clang diagnostic pop
9852 #endif
9853
9854 // end catch_console_colour.cpp
9855 // start catch_context.cpp
9856
9857 namespace Catch {
9858
9859 class Context : public IMutableContext, NonCopyable {
9860
9861 public: // IContext
9862 IResultCapture* getResultCapture() override {
9863 return m_resultCapture;
9864 }
9865 IRunner* getRunner() override {
9866 return m_runner;
9867 }
9868
9869 IConfigPtr const& getConfig() const override {
9870 return m_config;
9871 }
9872
9873 ~Context() override;
9874
9875 public: // IMutableContext
9876 void setResultCapture( IResultCapture* resultCapture ) override {
9877 m_resultCapture = resultCapture;
9878 }
9879 void setRunner( IRunner* runner ) override {
9880 m_runner = runner;
9881 }
9882 void setConfig( IConfigPtr const& config ) override {
9883 m_config = config;
9884 }
9885
9886 friend IMutableContext& getCurrentMutableContext();
9887
9888 private:
9889 IConfigPtr m_config;
9890 IRunner* m_runner = nullptr;
9891 IResultCapture* m_resultCapture = nullptr;
9892 };
9893
9894 IMutableContext *IMutableContext::currentContext = nullptr;
9895
9896 void IMutableContext::createContext()
9897 {
9898 currentContext = new Context();
9899 }
9900
9901 void cleanUpContext() {
9902 delete IMutableContext::currentContext;
9903 IMutableContext::currentContext = nullptr;
9904 }
9905 IContext::~IContext() = default;
9906 IMutableContext::~IMutableContext() = default;
9907 Context::~Context() = default;
9908 }
9909 // end catch_context.cpp
9910 // start catch_debug_console.cpp
9911
9912 // start catch_debug_console.h
9913
9914 #include <string>
9915
9916 namespace Catch {
9917 void writeToDebugConsole( std::string const& text );
9918 }
9919
9920 // end catch_debug_console.h
9921 #ifdef CATCH_PLATFORM_WINDOWS
9922
9923 namespace Catch {
9924 void writeToDebugConsole( std::string const& text ) {
9925 ::OutputDebugStringA( text.c_str() );
9926 }
9927 }
9928
9929 #else
9930
9931 namespace Catch {
9932 void writeToDebugConsole( std::string const& text ) {
9933 // !TBD: Need a version for Mac/ XCode and other IDEs
9934 Catch::cout() << text;
9935 }
9936 }
9937
9938 #endif // Platform
9939 // end catch_debug_console.cpp
9940 // start catch_debugger.cpp
9941
9942 #ifdef CATCH_PLATFORM_MAC
9943
9944 # include <assert.h>
9945 # include <stdbool.h>
9946 # include <sys/types.h>
9947 # include <unistd.h>
9948 # include <cstddef>
9949 # include <ostream>
9950
9951 #ifdef __apple_build_version__
9952 // These headers will only compile with AppleClang (XCode)
9953 // For other compilers (Clang, GCC, ... ) we need to exclude them
9954 # include <sys/sysctl.h>
9955 #endif
9956
9957 namespace Catch {
9958 #ifdef __apple_build_version__
9959 // The following function is taken directly from the following technical note:
9960 // https://developer.apple.com/library/archive/qa/qa1361/_index.html
9961
9962 // Returns true if the current process is being debugged (either
9963 // running under the debugger or has a debugger attached post facto).
9964 bool isDebuggerActive(){
9965 int mib[4];
9966 struct kinfo_proc info;
9967 std::size_t size;
9968
9969 // Initialize the flags so that, if sysctl fails for some bizarre
9970 // reason, we get a predictable result.
9971
9972 info.kp_proc.p_flag = 0;
9973
9974 // Initialize mib, which tells sysctl the info we want, in this case
9975 // we're looking for information about a specific process ID.
9976
9977 mib[0] = CTL_KERN;
9978 mib[1] = KERN_PROC;
9979 mib[2] = KERN_PROC_PID;
9980 mib[3] = getpid();
9981
9982 // Call sysctl.
9983
9984 size = sizeof(info);
9985 if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {
9986 Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl;
9987 return false;
9988 }
9989
9990 // We're being debugged if the P_TRACED flag is set.
9991
9992 return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
9993 }
9994 #else
9995 bool isDebuggerActive() {
9996 // We need to find another way to determine this for non-appleclang compilers on macOS
9997 return false;
9998 }
9999 #endif
10000 } // namespace Catch
10001
10002 #elif defined(CATCH_PLATFORM_LINUX)
10003 #include <fstream>
10004 #include <string>
10005
10006 namespace Catch{
10007 // The standard POSIX way of detecting a debugger is to attempt to
10008 // ptrace() the process, but this needs to be done from a child and not
10009 // this process itself to still allow attaching to this process later
10010 // if wanted, so is rather heavy. Under Linux we have the PID of the
10011 // "debugger" (which doesn't need to be gdb, of course, it could also
10012 // be strace, for example) in /proc/$PID/status, so just get it from
10013 // there instead.
10014 bool isDebuggerActive(){
10015 // Libstdc++ has a bug, where std::ifstream sets errno to 0
10016 // This way our users can properly assert over errno values
10017 ErrnoGuard guard;
10018 std::ifstream in("/proc/self/status");
10019 for( std::string line; std::getline(in, line); ) {
10020 static const int PREFIX_LEN = 11;
10021 if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) {
10022 // We're traced if the PID is not 0 and no other PID starts
10023 // with 0 digit, so it's enough to check for just a single
10024 // character.
10025 return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0';
10026 }
10027 }
10028
10029 return false;
10030 }
10031 } // namespace Catch
10032 #elif defined(_MSC_VER)
10033 extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
10034 namespace Catch {
10035 bool isDebuggerActive() {
10036 return IsDebuggerPresent() != 0;
10037 }
10038 }
10039 #elif defined(__MINGW32__)
10040 extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
10041 namespace Catch {
10042 bool isDebuggerActive() {
10043 return IsDebuggerPresent() != 0;
10044 }
10045 }
10046 #else
10047 namespace Catch {
10048 bool isDebuggerActive() { return false; }
10049 }
10050 #endif // Platform
10051 // end catch_debugger.cpp
10052 // start catch_decomposer.cpp
10053
10054 namespace Catch {
10055
10056 ITransientExpression::~ITransientExpression() = default;
10057
10058 void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
10059 if( lhs.size() + rhs.size() < 40 &&
10060 lhs.find('\n') == std::string::npos &&
10061 rhs.find('\n') == std::string::npos )
10062 os << lhs << " " << op << " " << rhs;
10063 else
10064 os << lhs << "\n" << op << "\n" << rhs;
10065 }
10066 }
10067 // end catch_decomposer.cpp
10068 // start catch_enforce.cpp
10069
10070 #include <stdexcept>
10071
10072 namespace Catch {
10073 #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER)
10074 [[noreturn]]
10075 void throw_exception(std::exception const& e) {
10076 Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n"
10077 << "The message was: " << e.what() << '\n';
10078 std::terminate();
10079 }
10080 #endif
10081
10082 [[noreturn]]
10083 void throw_logic_error(std::string const& msg) {
10084 throw_exception(std::logic_error(msg));
10085 }
10086
10087 [[noreturn]]
10088 void throw_domain_error(std::string const& msg) {
10089 throw_exception(std::domain_error(msg));
10090 }
10091
10092 [[noreturn]]
10093 void throw_runtime_error(std::string const& msg) {
10094 throw_exception(std::runtime_error(msg));
10095 }
10096
10097 } // namespace Catch;
10098 // end catch_enforce.cpp
10099 // start catch_enum_values_registry.cpp
10100 // start catch_enum_values_registry.h
10101
10102 #include <vector>
10103 #include <memory>
10104
10105 namespace Catch {
10106
10107 namespace Detail {
10108
10109 std::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values );
10110
10111 class EnumValuesRegistry : public IMutableEnumValuesRegistry {
10112
10113 std::vector<std::unique_ptr<EnumInfo>> m_enumInfos;
10114
10115 EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values) override;
10116 };
10117
10118 std::vector<std::string> parseEnums( StringRef enums );
10119
10120 } // Detail
10121
10122 } // Catch
10123
10124 // end catch_enum_values_registry.h
10125
10126 #include <map>
10127 #include <cassert>
10128
10129 namespace Catch {
10130
10131 IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() {}
10132
10133 namespace Detail {
10134
10135 std::vector<std::string> parseEnums( StringRef enums ) {
10136 auto enumValues = splitStringRef( enums, ',' );
10137 std::vector<std::string> parsed;
10138 parsed.reserve( enumValues.size() );
10139 for( auto const& enumValue : enumValues ) {
10140 auto identifiers = splitStringRef( enumValue, ':' );
10141 parsed.push_back( Catch::trim( identifiers.back() ) );
10142 }
10143 return parsed;
10144 }
10145
10146 EnumInfo::~EnumInfo() {}
10147
10148 StringRef EnumInfo::lookup( int value ) const {
10149 for( auto const& valueToName : m_values ) {
10150 if( valueToName.first == value )
10151 return valueToName.second;
10152 }
10153 return "{** unexpected enum value **}";
10154 }
10155
10156 std::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {
10157 std::unique_ptr<EnumInfo> enumInfo( new EnumInfo );
10158 enumInfo->m_name = enumName;
10159 enumInfo->m_values.reserve( values.size() );
10160
10161 const auto valueNames = Catch::Detail::parseEnums( allValueNames );
10162 assert( valueNames.size() == values.size() );
10163 std::size_t i = 0;
10164 for( auto value : values )
10165 enumInfo->m_values.push_back({ value, valueNames[i++] });
10166
10167 return enumInfo;
10168 }
10169
10170 EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {
10171 auto enumInfo = makeEnumInfo( enumName, allValueNames, values );
10172 EnumInfo* raw = enumInfo.get();
10173 m_enumInfos.push_back( std::move( enumInfo ) );
10174 return *raw;
10175 }
10176
10177 } // Detail
10178 } // Catch
10179
10180 // end catch_enum_values_registry.cpp
10181 // start catch_errno_guard.cpp
10182
10183 #include <cerrno>
10184
10185 namespace Catch {
10186 ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
10187 ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
10188 }
10189 // end catch_errno_guard.cpp
10190 // start catch_exception_translator_registry.cpp
10191
10192 // start catch_exception_translator_registry.h
10193
10194 #include <vector>
10195 #include <string>
10196 #include <memory>
10197
10198 namespace Catch {
10199
10200 class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {
10201 public:
10202 ~ExceptionTranslatorRegistry();
10203 virtual void registerTranslator( const IExceptionTranslator* translator );
10204 std::string translateActiveException() const override;
10205 std::string tryTranslators() const;
10206
10207 private:
10208 std::vector<std::unique_ptr<IExceptionTranslator const>> m_translators;
10209 };
10210 }
10211
10212 // end catch_exception_translator_registry.h
10213 #ifdef __OBJC__
10214 #import "Foundation/Foundation.h"
10215 #endif
10216
10217 namespace Catch {
10218
10219 ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {
10220 }
10221
10222 void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) {
10223 m_translators.push_back( std::unique_ptr<const IExceptionTranslator>( translator ) );
10224 }
10225
10226 #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
10227 std::string ExceptionTranslatorRegistry::translateActiveException() const {
10228 try {
10229 #ifdef __OBJC__
10230 // In Objective-C try objective-c exceptions first
10231 @try {
10232 return tryTranslators();
10233 }
10234 @catch (NSException *exception) {
10235 return Catch::Detail::stringify( [exception description] );
10236 }
10237 #else
10238 // Compiling a mixed mode project with MSVC means that CLR
10239 // exceptions will be caught in (...) as well. However, these
10240 // do not fill-in std::current_exception and thus lead to crash
10241 // when attempting rethrow.
10242 // /EHa switch also causes structured exceptions to be caught
10243 // here, but they fill-in current_exception properly, so
10244 // at worst the output should be a little weird, instead of
10245 // causing a crash.
10246 if (std::current_exception() == nullptr) {
10247 return "Non C++ exception. Possibly a CLR exception.";
10248 }
10249 return tryTranslators();
10250 #endif
10251 }
10252 catch( TestFailureException& ) {
10253 std::rethrow_exception(std::current_exception());
10254 }
10255 catch( std::exception& ex ) {
10256 return ex.what();
10257 }
10258 catch( std::string& msg ) {
10259 return msg;
10260 }
10261 catch( const char* msg ) {
10262 return msg;
10263 }
10264 catch(...) {
10265 return "Unknown exception";
10266 }
10267 }
10268
10269 std::string ExceptionTranslatorRegistry::tryTranslators() const {
10270 if (m_translators.empty()) {
10271 std::rethrow_exception(std::current_exception());
10272 } else {
10273 return m_translators[0]->translate(m_translators.begin() + 1, m_translators.end());
10274 }
10275 }
10276
10277 #else // ^^ Exceptions are enabled // Exceptions are disabled vv
10278 std::string ExceptionTranslatorRegistry::translateActiveException() const {
10279 CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
10280 }
10281
10282 std::string ExceptionTranslatorRegistry::tryTranslators() const {
10283 CATCH_INTERNAL_ERROR("Attempted to use exception translators under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
10284 }
10285 #endif
10286
10287 }
10288 // end catch_exception_translator_registry.cpp
10289 // start catch_fatal_condition.cpp
10290
10291 #if defined(__GNUC__)
10292 # pragma GCC diagnostic push
10293 # pragma GCC diagnostic ignored "-Wmissing-field-initializers"
10294 #endif
10295
10296 #if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS )
10297
10298 namespace {
10299 // Report the error condition
10300 void reportFatal( char const * const message ) {
10301 Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );
10302 }
10303 }
10304
10305 #endif // signals/SEH handling
10306
10307 #if defined( CATCH_CONFIG_WINDOWS_SEH )
10308
10309 namespace Catch {
10310 struct SignalDefs { DWORD id; const char* name; };
10311
10312 // There is no 1-1 mapping between signals and windows exceptions.
10313 // Windows can easily distinguish between SO and SigSegV,
10314 // but SigInt, SigTerm, etc are handled differently.
10315 static SignalDefs signalDefs[] = {
10316 { static_cast<DWORD>(EXCEPTION_ILLEGAL_INSTRUCTION), "SIGILL - Illegal instruction signal" },
10317 { static_cast<DWORD>(EXCEPTION_STACK_OVERFLOW), "SIGSEGV - Stack overflow" },
10318 { static_cast<DWORD>(EXCEPTION_ACCESS_VIOLATION), "SIGSEGV - Segmentation violation signal" },
10319 { static_cast<DWORD>(EXCEPTION_INT_DIVIDE_BY_ZERO), "Divide by zero error" },
10320 };
10321
10322 LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
10323 for (auto const& def : signalDefs) {
10324 if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {
10325 reportFatal(def.name);
10326 }
10327 }
10328 // If its not an exception we care about, pass it along.
10329 // This stops us from eating debugger breaks etc.
10330 return EXCEPTION_CONTINUE_SEARCH;
10331 }
10332
10333 FatalConditionHandler::FatalConditionHandler() {
10334 isSet = true;
10335 // 32k seems enough for Catch to handle stack overflow,
10336 // but the value was found experimentally, so there is no strong guarantee
10337 guaranteeSize = 32 * 1024;
10338 exceptionHandlerHandle = nullptr;
10339 // Register as first handler in current chain
10340 exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
10341 // Pass in guarantee size to be filled
10342 SetThreadStackGuarantee(&guaranteeSize);
10343 }
10344
10345 void FatalConditionHandler::reset() {
10346 if (isSet) {
10347 RemoveVectoredExceptionHandler(exceptionHandlerHandle);
10348 SetThreadStackGuarantee(&guaranteeSize);
10349 exceptionHandlerHandle = nullptr;
10350 isSet = false;
10351 }
10352 }
10353
10354 FatalConditionHandler::~FatalConditionHandler() {
10355 reset();
10356 }
10357
10358 bool FatalConditionHandler::isSet = false;
10359 ULONG FatalConditionHandler::guaranteeSize = 0;
10360 PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr;
10361
10362 } // namespace Catch
10363
10364 #elif defined( CATCH_CONFIG_POSIX_SIGNALS )
10365
10366 namespace Catch {
10367
10368 struct SignalDefs {
10369 int id;
10370 const char* name;
10371 };
10372
10373 // 32kb for the alternate stack seems to be sufficient. However, this value
10374 // is experimentally determined, so that's not guaranteed.
10375 constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
10376
10377 static SignalDefs signalDefs[] = {
10378 { SIGINT, "SIGINT - Terminal interrupt signal" },
10379 { SIGILL, "SIGILL - Illegal instruction signal" },
10380 { SIGFPE, "SIGFPE - Floating point error signal" },
10381 { SIGSEGV, "SIGSEGV - Segmentation violation signal" },
10382 { SIGTERM, "SIGTERM - Termination request signal" },
10383 { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" }
10384 };
10385
10386 void FatalConditionHandler::handleSignal( int sig ) {
10387 char const * name = "<unknown signal>";
10388 for (auto const& def : signalDefs) {
10389 if (sig == def.id) {
10390 name = def.name;
10391 break;
10392 }
10393 }
10394 reset();
10395 reportFatal(name);
10396 raise( sig );
10397 }
10398
10399 FatalConditionHandler::FatalConditionHandler() {
10400 isSet = true;
10401 stack_t sigStack;
10402 sigStack.ss_sp = altStackMem;
10403 sigStack.ss_size = sigStackSize;
10404 sigStack.ss_flags = 0;
10405 sigaltstack(&sigStack, &oldSigStack);
10406 struct sigaction sa = { };
10407
10408 sa.sa_handler = handleSignal;
10409 sa.sa_flags = SA_ONSTACK;
10410 for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) {
10411 sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);
10412 }
10413 }
10414
10415 FatalConditionHandler::~FatalConditionHandler() {
10416 reset();
10417 }
10418
10419 void FatalConditionHandler::reset() {
10420 if( isSet ) {
10421 // Set signals back to previous values -- hopefully nobody overwrote them in the meantime
10422 for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) {
10423 sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
10424 }
10425 // Return the old stack
10426 sigaltstack(&oldSigStack, nullptr);
10427 isSet = false;
10428 }
10429 }
10430
10431 bool FatalConditionHandler::isSet = false;
10432 struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
10433 stack_t FatalConditionHandler::oldSigStack = {};
10434 char FatalConditionHandler::altStackMem[sigStackSize] = {};
10435
10436 } // namespace Catch
10437
10438 #else
10439
10440 namespace Catch {
10441 void FatalConditionHandler::reset() {}
10442 }
10443
10444 #endif // signals/SEH handling
10445
10446 #if defined(__GNUC__)
10447 # pragma GCC diagnostic pop
10448 #endif
10449 // end catch_fatal_condition.cpp
10450 // start catch_generators.cpp
10451
10452 // start catch_random_number_generator.h
10453
10454 #include <algorithm>
10455 #include <random>
10456
10457 namespace Catch {
10458
10459 struct IConfig;
10460
10461 std::mt19937& rng();
10462 void seedRng( IConfig const& config );
10463 unsigned int rngSeed();
10464
10465 }
10466
10467 // end catch_random_number_generator.h
10468 #include <limits>
10469 #include <set>
10470
10471 namespace Catch {
10472
10473 IGeneratorTracker::~IGeneratorTracker() {}
10474
10475 const char* GeneratorException::what() const noexcept {
10476 return m_msg;
10477 }
10478
10479 namespace Generators {
10480
10481 GeneratorUntypedBase::~GeneratorUntypedBase() {}
10482
10483 auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
10484 return getResultCapture().acquireGeneratorTracker( lineInfo );
10485 }
10486
10487 } // namespace Generators
10488 } // namespace Catch
10489 // end catch_generators.cpp
10490 // start catch_interfaces_capture.cpp
10491
10492 namespace Catch {
10493 IResultCapture::~IResultCapture() = default;
10494 }
10495 // end catch_interfaces_capture.cpp
10496 // start catch_interfaces_config.cpp
10497
10498 namespace Catch {
10499 IConfig::~IConfig() = default;
10500 }
10501 // end catch_interfaces_config.cpp
10502 // start catch_interfaces_exception.cpp
10503
10504 namespace Catch {
10505 IExceptionTranslator::~IExceptionTranslator() = default;
10506 IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
10507 }
10508 // end catch_interfaces_exception.cpp
10509 // start catch_interfaces_registry_hub.cpp
10510
10511 namespace Catch {
10512 IRegistryHub::~IRegistryHub() = default;
10513 IMutableRegistryHub::~IMutableRegistryHub() = default;
10514 }
10515 // end catch_interfaces_registry_hub.cpp
10516 // start catch_interfaces_reporter.cpp
10517
10518 // start catch_reporter_listening.h
10519
10520 namespace Catch {
10521
10522 class ListeningReporter : public IStreamingReporter {
10523 using Reporters = std::vector<IStreamingReporterPtr>;
10524 Reporters m_listeners;
10525 IStreamingReporterPtr m_reporter = nullptr;
10526 ReporterPreferences m_preferences;
10527
10528 public:
10529 ListeningReporter();
10530
10531 void addListener( IStreamingReporterPtr&& listener );
10532 void addReporter( IStreamingReporterPtr&& reporter );
10533
10534 public: // IStreamingReporter
10535
10536 ReporterPreferences getPreferences() const override;
10537
10538 void noMatchingTestCases( std::string const& spec ) override;
10539
10540 static std::set<Verbosity> getSupportedVerbosities();
10541
10542 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
10543 void benchmarkPreparing(std::string const& name) override;
10544 void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
10545 void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
10546 void benchmarkFailed(std::string const&) override;
10547 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
10548
10549 void testRunStarting( TestRunInfo const& testRunInfo ) override;
10550 void testGroupStarting( GroupInfo const& groupInfo ) override;
10551 void testCaseStarting( TestCaseInfo const& testInfo ) override;
10552 void sectionStarting( SectionInfo const& sectionInfo ) override;
10553 void assertionStarting( AssertionInfo const& assertionInfo ) override;
10554
10555 // The return value indicates if the messages buffer should be cleared:
10556 bool assertionEnded( AssertionStats const& assertionStats ) override;
10557 void sectionEnded( SectionStats const& sectionStats ) override;
10558 void testCaseEnded( TestCaseStats const& testCaseStats ) override;
10559 void testGroupEnded( TestGroupStats const& testGroupStats ) override;
10560 void testRunEnded( TestRunStats const& testRunStats ) override;
10561
10562 void skipTest( TestCaseInfo const& testInfo ) override;
10563 bool isMulti() const override;
10564
10565 };
10566
10567 } // end namespace Catch
10568
10569 // end catch_reporter_listening.h
10570 namespace Catch {
10571
10572 ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig )
10573 : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}
10574
10575 ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream )
10576 : m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
10577
10578 std::ostream& ReporterConfig::stream() const { return *m_stream; }
10579 IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; }
10580
10581 TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}
10582
10583 GroupInfo::GroupInfo( std::string const& _name,
10584 std::size_t _groupIndex,
10585 std::size_t _groupsCount )
10586 : name( _name ),
10587 groupIndex( _groupIndex ),
10588 groupsCounts( _groupsCount )
10589 {}
10590
10591 AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
10592 std::vector<MessageInfo> const& _infoMessages,
10593 Totals const& _totals )
10594 : assertionResult( _assertionResult ),
10595 infoMessages( _infoMessages ),
10596 totals( _totals )
10597 {
10598 assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression;
10599
10600 if( assertionResult.hasMessage() ) {
10601 // Copy message into messages list.
10602 // !TBD This should have been done earlier, somewhere
10603 MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
10604 builder << assertionResult.getMessage();
10605 builder.m_info.message = builder.m_stream.str();
10606
10607 infoMessages.push_back( builder.m_info );
10608 }
10609 }
10610
10611 AssertionStats::~AssertionStats() = default;
10612
10613 SectionStats::SectionStats( SectionInfo const& _sectionInfo,
10614 Counts const& _assertions,
10615 double _durationInSeconds,
10616 bool _missingAssertions )
10617 : sectionInfo( _sectionInfo ),
10618 assertions( _assertions ),
10619 durationInSeconds( _durationInSeconds ),
10620 missingAssertions( _missingAssertions )
10621 {}
10622
10623 SectionStats::~SectionStats() = default;
10624
10625 TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
10626 Totals const& _totals,
10627 std::string const& _stdOut,
10628 std::string const& _stdErr,
10629 bool _aborting )
10630 : testInfo( _testInfo ),
10631 totals( _totals ),
10632 stdOut( _stdOut ),
10633 stdErr( _stdErr ),
10634 aborting( _aborting )
10635 {}
10636
10637 TestCaseStats::~TestCaseStats() = default;
10638
10639 TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo,
10640 Totals const& _totals,
10641 bool _aborting )
10642 : groupInfo( _groupInfo ),
10643 totals( _totals ),
10644 aborting( _aborting )
10645 {}
10646
10647 TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo )
10648 : groupInfo( _groupInfo ),
10649 aborting( false )
10650 {}
10651
10652 TestGroupStats::~TestGroupStats() = default;
10653
10654 TestRunStats::TestRunStats( TestRunInfo const& _runInfo,
10655 Totals const& _totals,
10656 bool _aborting )
10657 : runInfo( _runInfo ),
10658 totals( _totals ),
10659 aborting( _aborting )
10660 {}
10661
10662 TestRunStats::~TestRunStats() = default;
10663
10664 void IStreamingReporter::fatalErrorEncountered( StringRef ) {}
10665 bool IStreamingReporter::isMulti() const { return false; }
10666
10667 IReporterFactory::~IReporterFactory() = default;
10668 IReporterRegistry::~IReporterRegistry() = default;
10669
10670 } // end namespace Catch
10671 // end catch_interfaces_reporter.cpp
10672 // start catch_interfaces_runner.cpp
10673
10674 namespace Catch {
10675 IRunner::~IRunner() = default;
10676 }
10677 // end catch_interfaces_runner.cpp
10678 // start catch_interfaces_testcase.cpp
10679
10680 namespace Catch {
10681 ITestInvoker::~ITestInvoker() = default;
10682 ITestCaseRegistry::~ITestCaseRegistry() = default;
10683 }
10684 // end catch_interfaces_testcase.cpp
10685 // start catch_leak_detector.cpp
10686
10687 #ifdef CATCH_CONFIG_WINDOWS_CRTDBG
10688 #include <crtdbg.h>
10689
10690 namespace Catch {
10691
10692 LeakDetector::LeakDetector() {
10693 int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
10694 flag |= _CRTDBG_LEAK_CHECK_DF;
10695 flag |= _CRTDBG_ALLOC_MEM_DF;
10696 _CrtSetDbgFlag(flag);
10697 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
10698 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
10699 // Change this to leaking allocation's number to break there
10700 _CrtSetBreakAlloc(-1);
10701 }
10702 }
10703
10704 #else
10705
10706 Catch::LeakDetector::LeakDetector() {}
10707
10708 #endif
10709
10710 Catch::LeakDetector::~LeakDetector() {
10711 Catch::cleanUp();
10712 }
10713 // end catch_leak_detector.cpp
10714 // start catch_list.cpp
10715
10716 // start catch_list.h
10717
10718 #include <set>
10719
10720 namespace Catch {
10721
10722 std::size_t listTests( Config const& config );
10723
10724 std::size_t listTestsNamesOnly( Config const& config );
10725
10726 struct TagInfo {
10727 void add( std::string const& spelling );
10728 std::string all() const;
10729
10730 std::set<std::string> spellings;
10731 std::size_t count = 0;
10732 };
10733
10734 std::size_t listTags( Config const& config );
10735
10736 std::size_t listReporters();
10737
10738 Option<std::size_t> list( std::shared_ptr<Config> const& config );
10739
10740 } // end namespace Catch
10741
10742 // end catch_list.h
10743 // start catch_text.h
10744
10745 namespace Catch {
10746 using namespace clara::TextFlow;
10747 }
10748
10749 // end catch_text.h
10750 #include <limits>
10751 #include <algorithm>
10752 #include <iomanip>
10753
10754 namespace Catch {
10755
10756 std::size_t listTests( Config const& config ) {
10757 TestSpec testSpec = config.testSpec();
10758 if( config.hasTestFilters() )
10759 Catch::cout() << "Matching test cases:\n";
10760 else {
10761 Catch::cout() << "All available test cases:\n";
10762 }
10763
10764 auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
10765 for( auto const& testCaseInfo : matchedTestCases ) {
10766 Colour::Code colour = testCaseInfo.isHidden()
10767 ? Colour::SecondaryText
10768 : Colour::None;
10769 Colour colourGuard( colour );
10770
10771 Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n";
10772 if( config.verbosity() >= Verbosity::High ) {
10773 Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl;
10774 std::string description = testCaseInfo.description;
10775 if( description.empty() )
10776 description = "(NO DESCRIPTION)";
10777 Catch::cout() << Column( description ).indent(4) << std::endl;
10778 }
10779 if( !testCaseInfo.tags.empty() )
10780 Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n";
10781 }
10782
10783 if( !config.hasTestFilters() )
10784 Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl;
10785 else
10786 Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl;
10787 return matchedTestCases.size();
10788 }
10789
10790 std::size_t listTestsNamesOnly( Config const& config ) {
10791 TestSpec testSpec = config.testSpec();
10792 std::size_t matchedTests = 0;
10793 std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
10794 for( auto const& testCaseInfo : matchedTestCases ) {
10795 matchedTests++;
10796 if( startsWith( testCaseInfo.name, '#' ) )
10797 Catch::cout() << '"' << testCaseInfo.name << '"';
10798 else
10799 Catch::cout() << testCaseInfo.name;
10800 if ( config.verbosity() >= Verbosity::High )
10801 Catch::cout() << "\t@" << testCaseInfo.lineInfo;
10802 Catch::cout() << std::endl;
10803 }
10804 return matchedTests;
10805 }
10806
10807 void TagInfo::add( std::string const& spelling ) {
10808 ++count;
10809 spellings.insert( spelling );
10810 }
10811
10812 std::string TagInfo::all() const {
10813 std::string out;
10814 for( auto const& spelling : spellings )
10815 out += "[" + spelling + "]";
10816 return out;
10817 }
10818
10819 std::size_t listTags( Config const& config ) {
10820 TestSpec testSpec = config.testSpec();
10821 if( config.hasTestFilters() )
10822 Catch::cout() << "Tags for matching test cases:\n";
10823 else {
10824 Catch::cout() << "All available tags:\n";
10825 }
10826
10827 std::map<std::string, TagInfo> tagCounts;
10828
10829 std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
10830 for( auto const& testCase : matchedTestCases ) {
10831 for( auto const& tagName : testCase.getTestCaseInfo().tags ) {
10832 std::string lcaseTagName = toLower( tagName );
10833 auto countIt = tagCounts.find( lcaseTagName );
10834 if( countIt == tagCounts.end() )
10835 countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first;
10836 countIt->second.add( tagName );
10837 }
10838 }
10839
10840 for( auto const& tagCount : tagCounts ) {
10841 ReusableStringStream rss;
10842 rss << " " << std::setw(2) << tagCount.second.count << " ";
10843 auto str = rss.str();
10844 auto wrapper = Column( tagCount.second.all() )
10845 .initialIndent( 0 )
10846 .indent( str.size() )
10847 .width( CATCH_CONFIG_CONSOLE_WIDTH-10 );
10848 Catch::cout() << str << wrapper << '\n';
10849 }
10850 Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl;
10851 return tagCounts.size();
10852 }
10853
10854 std::size_t listReporters() {
10855 Catch::cout() << "Available reporters:\n";
10856 IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
10857 std::size_t maxNameLen = 0;
10858 for( auto const& factoryKvp : factories )
10859 maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
10860
10861 for( auto const& factoryKvp : factories ) {
10862 Catch::cout()
10863 << Column( factoryKvp.first + ":" )
10864 .indent(2)
10865 .width( 5+maxNameLen )
10866 + Column( factoryKvp.second->getDescription() )
10867 .initialIndent(0)
10868 .indent(2)
10869 .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 )
10870 << "\n";
10871 }
10872 Catch::cout() << std::endl;
10873 return factories.size();
10874 }
10875
10876 Option<std::size_t> list( std::shared_ptr<Config> const& config ) {
10877 Option<std::size_t> listedCount;
10878 getCurrentMutableContext().setConfig( config );
10879 if( config->listTests() )
10880 listedCount = listedCount.valueOr(0) + listTests( *config );
10881 if( config->listTestNamesOnly() )
10882 listedCount = listedCount.valueOr(0) + listTestsNamesOnly( *config );
10883 if( config->listTags() )
10884 listedCount = listedCount.valueOr(0) + listTags( *config );
10885 if( config->listReporters() )
10886 listedCount = listedCount.valueOr(0) + listReporters();
10887 return listedCount;
10888 }
10889
10890 } // end namespace Catch
10891 // end catch_list.cpp
10892 // start catch_matchers.cpp
10893
10894 namespace Catch {
10895 namespace Matchers {
10896 namespace Impl {
10897
10898 std::string MatcherUntypedBase::toString() const {
10899 if( m_cachedToString.empty() )
10900 m_cachedToString = describe();
10901 return m_cachedToString;
10902 }
10903
10904 MatcherUntypedBase::~MatcherUntypedBase() = default;
10905
10906 } // namespace Impl
10907 } // namespace Matchers
10908
10909 using namespace Matchers;
10910 using Matchers::Impl::MatcherBase;
10911
10912 } // namespace Catch
10913 // end catch_matchers.cpp
10914 // start catch_matchers_floating.cpp
10915
10916 // start catch_polyfills.hpp
10917
10918 namespace Catch {
10919 bool isnan(float f);
10920 bool isnan(double d);
10921 }
10922
10923 // end catch_polyfills.hpp
10924 // start catch_to_string.hpp
10925
10926 #include <string>
10927
10928 namespace Catch {
10929 template <typename T>
10930 std::string to_string(T const& t) {
10931 #if defined(CATCH_CONFIG_CPP11_TO_STRING)
10932 return std::to_string(t);
10933 #else
10934 ReusableStringStream rss;
10935 rss << t;
10936 return rss.str();
10937 #endif
10938 }
10939 } // end namespace Catch
10940
10941 // end catch_to_string.hpp
10942 #include <cstdlib>
10943 #include <cstdint>
10944 #include <cstring>
10945 #include <sstream>
10946 #include <iomanip>
10947 #include <limits>
10948
10949 namespace Catch {
10950 namespace Matchers {
10951 namespace Floating {
10952 enum class FloatingPointKind : uint8_t {
10953 Float,
10954 Double
10955 };
10956 }
10957 }
10958 }
10959
10960 namespace {
10961
10962 template <typename T>
10963 struct Converter;
10964
10965 template <>
10966 struct Converter<float> {
10967 static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated");
10968 Converter(float f) {
10969 std::memcpy(&i, &f, sizeof(f));
10970 }
10971 int32_t i;
10972 };
10973
10974 template <>
10975 struct Converter<double> {
10976 static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated");
10977 Converter(double d) {
10978 std::memcpy(&i, &d, sizeof(d));
10979 }
10980 int64_t i;
10981 };
10982
10983 template <typename T>
10984 auto convert(T t) -> Converter<T> {
10985 return Converter<T>(t);
10986 }
10987
10988 template <typename FP>
10989 bool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) {
10990 // Comparison with NaN should always be false.
10991 // This way we can rule it out before getting into the ugly details
10992 if (Catch::isnan(lhs) || Catch::isnan(rhs)) {
10993 return false;
10994 }
10995
10996 auto lc = convert(lhs);
10997 auto rc = convert(rhs);
10998
10999 if ((lc.i < 0) != (rc.i < 0)) {
11000 // Potentially we can have +0 and -0
11001 return lhs == rhs;
11002 }
11003
11004 auto ulpDiff = std::abs(lc.i - rc.i);
11005 return ulpDiff <= maxUlpDiff;
11006 }
11007
11008 template <typename FP>
11009 FP step(FP start, FP direction, int steps) {
11010 for (int i = 0; i < steps; ++i) {
11011 start = std::nextafter(start, direction);
11012 }
11013 return start;
11014 }
11015
11016 } // end anonymous namespace
11017
11018 namespace Catch {
11019 namespace Matchers {
11020 namespace Floating {
11021 WithinAbsMatcher::WithinAbsMatcher(double target, double margin)
11022 :m_target{ target }, m_margin{ margin } {
11023 CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.'
11024 << " Margin has to be non-negative.");
11025 }
11026
11027 // Performs equivalent check of std::fabs(lhs - rhs) <= margin
11028 // But without the subtraction to allow for INFINITY in comparison
11029 bool WithinAbsMatcher::match(double const& matchee) const {
11030 return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee);
11031 }
11032
11033 std::string WithinAbsMatcher::describe() const {
11034 return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target);
11035 }
11036
11037 WithinUlpsMatcher::WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType)
11038 :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {
11039 CATCH_ENFORCE(ulps >= 0, "Invalid ULP setting: " << ulps << '.'
11040 << " ULPs have to be non-negative.");
11041 }
11042
11043 #if defined(__clang__)
11044 #pragma clang diagnostic push
11045 // Clang <3.5 reports on the default branch in the switch below
11046 #pragma clang diagnostic ignored "-Wunreachable-code"
11047 #endif
11048
11049 bool WithinUlpsMatcher::match(double const& matchee) const {
11050 switch (m_type) {
11051 case FloatingPointKind::Float:
11052 return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps);
11053 case FloatingPointKind::Double:
11054 return almostEqualUlps<double>(matchee, m_target, m_ulps);
11055 default:
11056 CATCH_INTERNAL_ERROR( "Unknown FloatingPointKind value" );
11057 }
11058 }
11059
11060 #if defined(__clang__)
11061 #pragma clang diagnostic pop
11062 #endif
11063
11064 std::string WithinUlpsMatcher::describe() const {
11065 std::stringstream ret;
11066
11067 ret << "is within " << m_ulps << " ULPs of " << ::Catch::Detail::stringify(m_target);
11068
11069 if (m_type == FloatingPointKind::Float) {
11070 ret << 'f';
11071 }
11072
11073 ret << " ([";
11074 ret << std::fixed << std::setprecision(std::numeric_limits<double>::max_digits10);
11075 if (m_type == FloatingPointKind::Double) {
11076 ret << step(m_target, static_cast<double>(-INFINITY), m_ulps)
11077 << ", "
11078 << step(m_target, static_cast<double>(INFINITY), m_ulps);
11079 } else {
11080 ret << step<float>(static_cast<float>(m_target), -INFINITY, m_ulps)
11081 << ", "
11082 << step<float>(static_cast<float>(m_target), INFINITY, m_ulps);
11083 }
11084 ret << "])";
11085
11086 return ret.str();
11087 //return "is within " + Catch::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : "");
11088 }
11089
11090 }// namespace Floating
11091
11092 Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff) {
11093 return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Double);
11094 }
11095
11096 Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff) {
11097 return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Float);
11098 }
11099
11100 Floating::WithinAbsMatcher WithinAbs(double target, double margin) {
11101 return Floating::WithinAbsMatcher(target, margin);
11102 }
11103
11104 } // namespace Matchers
11105 } // namespace Catch
11106
11107 // end catch_matchers_floating.cpp
11108 // start catch_matchers_generic.cpp
11109
11110 std::string Catch::Matchers::Generic::Detail::finalizeDescription(const std::string& desc) {
11111 if (desc.empty()) {
11112 return "matches undescribed predicate";
11113 } else {
11114 return "matches predicate: \"" + desc + '"';
11115 }
11116 }
11117 // end catch_matchers_generic.cpp
11118 // start catch_matchers_string.cpp
11119
11120 #include <regex>
11121
11122 namespace Catch {
11123 namespace Matchers {
11124
11125 namespace StdString {
11126
11127 CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity )
11128 : m_caseSensitivity( caseSensitivity ),
11129 m_str( adjustString( str ) )
11130 {}
11131 std::string CasedString::adjustString( std::string const& str ) const {
11132 return m_caseSensitivity == CaseSensitive::No
11133 ? toLower( str )
11134 : str;
11135 }
11136 std::string CasedString::caseSensitivitySuffix() const {
11137 return m_caseSensitivity == CaseSensitive::No
11138 ? " (case insensitive)"
11139 : std::string();
11140 }
11141
11142 StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator )
11143 : m_comparator( comparator ),
11144 m_operation( operation ) {
11145 }
11146
11147 std::string StringMatcherBase::describe() const {
11148 std::string description;
11149 description.reserve(5 + m_operation.size() + m_comparator.m_str.size() +
11150 m_comparator.caseSensitivitySuffix().size());
11151 description += m_operation;
11152 description += ": \"";
11153 description += m_comparator.m_str;
11154 description += "\"";
11155 description += m_comparator.caseSensitivitySuffix();
11156 return description;
11157 }
11158
11159 EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {}
11160
11161 bool EqualsMatcher::match( std::string const& source ) const {
11162 return m_comparator.adjustString( source ) == m_comparator.m_str;
11163 }
11164
11165 ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {}
11166
11167 bool ContainsMatcher::match( std::string const& source ) const {
11168 return contains( m_comparator.adjustString( source ), m_comparator.m_str );
11169 }
11170
11171 StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {}
11172
11173 bool StartsWithMatcher::match( std::string const& source ) const {
11174 return startsWith( m_comparator.adjustString( source ), m_comparator.m_str );
11175 }
11176
11177 EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {}
11178
11179 bool EndsWithMatcher::match( std::string const& source ) const {
11180 return endsWith( m_comparator.adjustString( source ), m_comparator.m_str );
11181 }
11182
11183 RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {}
11184
11185 bool RegexMatcher::match(std::string const& matchee) const {
11186 auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway
11187 if (m_caseSensitivity == CaseSensitive::Choice::No) {
11188 flags |= std::regex::icase;
11189 }
11190 auto reg = std::regex(m_regex, flags);
11191 return std::regex_match(matchee, reg);
11192 }
11193
11194 std::string RegexMatcher::describe() const {
11195 return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? " case sensitively" : " case insensitively");
11196 }
11197
11198 } // namespace StdString
11199
11200 StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
11201 return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) );
11202 }
11203 StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
11204 return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) );
11205 }
11206 StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
11207 return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) );
11208 }
11209 StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
11210 return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) );
11211 }
11212
11213 StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) {
11214 return StdString::RegexMatcher(regex, caseSensitivity);
11215 }
11216
11217 } // namespace Matchers
11218 } // namespace Catch
11219 // end catch_matchers_string.cpp
11220 // start catch_message.cpp
11221
11222 // start catch_uncaught_exceptions.h
11223
11224 namespace Catch {
11225 bool uncaught_exceptions();
11226 } // end namespace Catch
11227
11228 // end catch_uncaught_exceptions.h
11229 #include <cassert>
11230 #include <stack>
11231
11232 namespace Catch {
11233
11234 MessageInfo::MessageInfo( StringRef const& _macroName,
11235 SourceLineInfo const& _lineInfo,
11236 ResultWas::OfType _type )
11237 : macroName( _macroName ),
11238 lineInfo( _lineInfo ),
11239 type( _type ),
11240 sequence( ++globalCount )
11241 {}
11242
11243 bool MessageInfo::operator==( MessageInfo const& other ) const {
11244 return sequence == other.sequence;
11245 }
11246
11247 bool MessageInfo::operator<( MessageInfo const& other ) const {
11248 return sequence < other.sequence;
11249 }
11250
11251 // This may need protecting if threading support is added
11252 unsigned int MessageInfo::globalCount = 0;
11253
11254 ////////////////////////////////////////////////////////////////////////////
11255
11256 Catch::MessageBuilder::MessageBuilder( StringRef const& macroName,
11257 SourceLineInfo const& lineInfo,
11258 ResultWas::OfType type )
11259 :m_info(macroName, lineInfo, type) {}
11260
11261 ////////////////////////////////////////////////////////////////////////////
11262
11263 ScopedMessage::ScopedMessage( MessageBuilder const& builder )
11264 : m_info( builder.m_info ), m_moved()
11265 {
11266 m_info.message = builder.m_stream.str();
11267 getResultCapture().pushScopedMessage( m_info );
11268 }
11269
11270 ScopedMessage::ScopedMessage( ScopedMessage&& old )
11271 : m_info( old.m_info ), m_moved()
11272 {
11273 old.m_moved = true;
11274 }
11275
11276 ScopedMessage::~ScopedMessage() {
11277 if ( !uncaught_exceptions() && !m_moved ){
11278 getResultCapture().popScopedMessage(m_info);
11279 }
11280 }
11281
11282 Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) {
11283 auto trimmed = [&] (size_t start, size_t end) {
11284 while (names[start] == ',' || isspace(names[start])) {
11285 ++start;
11286 }
11287 while (names[end] == ',' || isspace(names[end])) {
11288 --end;
11289 }
11290 return names.substr(start, end - start + 1);
11291 };
11292 auto skipq = [&] (size_t start, char quote) {
11293 for (auto i = start + 1; i < names.size() ; ++i) {
11294 if (names[i] == quote)
11295 return i;
11296 if (names[i] == '\\')
11297 ++i;
11298 }
11299 CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched quote");
11300 };
11301
11302 size_t start = 0;
11303 std::stack<char> openings;
11304 for (size_t pos = 0; pos < names.size(); ++pos) {
11305 char c = names[pos];
11306 switch (c) {
11307 case '[':
11308 case '{':
11309 case '(':
11310 // It is basically impossible to disambiguate between
11311 // comparison and start of template args in this context
11312 // case '<':
11313 openings.push(c);
11314 break;
11315 case ']':
11316 case '}':
11317 case ')':
11318 // case '>':
11319 openings.pop();
11320 break;
11321 case '"':
11322 case '\'':
11323 pos = skipq(pos, c);
11324 break;
11325 case ',':
11326 if (start != pos && openings.size() == 0) {
11327 m_messages.emplace_back(macroName, lineInfo, resultType);
11328 m_messages.back().message = trimmed(start, pos);
11329 m_messages.back().message += " := ";
11330 start = pos;
11331 }
11332 }
11333 }
11334 assert(openings.size() == 0 && "Mismatched openings");
11335 m_messages.emplace_back(macroName, lineInfo, resultType);
11336 m_messages.back().message = trimmed(start, names.size() - 1);
11337 m_messages.back().message += " := ";
11338 }
11339 Capturer::~Capturer() {
11340 if ( !uncaught_exceptions() ){
11341 assert( m_captured == m_messages.size() );
11342 for( size_t i = 0; i < m_captured; ++i )
11343 m_resultCapture.popScopedMessage( m_messages[i] );
11344 }
11345 }
11346
11347 void Capturer::captureValue( size_t index, std::string const& value ) {
11348 assert( index < m_messages.size() );
11349 m_messages[index].message += value;
11350 m_resultCapture.pushScopedMessage( m_messages[index] );
11351 m_captured++;
11352 }
11353
11354 } // end namespace Catch
11355 // end catch_message.cpp
11356 // start catch_output_redirect.cpp
11357
11358 // start catch_output_redirect.h
11359 #ifndef TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H
11360 #define TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H
11361
11362 #include <cstdio>
11363 #include <iosfwd>
11364 #include <string>
11365
11366 namespace Catch {
11367
11368 class RedirectedStream {
11369 std::ostream& m_originalStream;
11370 std::ostream& m_redirectionStream;
11371 std::streambuf* m_prevBuf;
11372
11373 public:
11374 RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream );
11375 ~RedirectedStream();
11376 };
11377
11378 class RedirectedStdOut {
11379 ReusableStringStream m_rss;
11380 RedirectedStream m_cout;
11381 public:
11382 RedirectedStdOut();
11383 auto str() const -> std::string;
11384 };
11385
11386 // StdErr has two constituent streams in C++, std::cerr and std::clog
11387 // This means that we need to redirect 2 streams into 1 to keep proper
11388 // order of writes
11389 class RedirectedStdErr {
11390 ReusableStringStream m_rss;
11391 RedirectedStream m_cerr;
11392 RedirectedStream m_clog;
11393 public:
11394 RedirectedStdErr();
11395 auto str() const -> std::string;
11396 };
11397
11398 class RedirectedStreams {
11399 public:
11400 RedirectedStreams(RedirectedStreams const&) = delete;
11401 RedirectedStreams& operator=(RedirectedStreams const&) = delete;
11402 RedirectedStreams(RedirectedStreams&&) = delete;
11403 RedirectedStreams& operator=(RedirectedStreams&&) = delete;
11404
11405 RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr);
11406 ~RedirectedStreams();
11407 private:
11408 std::string& m_redirectedCout;
11409 std::string& m_redirectedCerr;
11410 RedirectedStdOut m_redirectedStdOut;
11411 RedirectedStdErr m_redirectedStdErr;
11412 };
11413
11414 #if defined(CATCH_CONFIG_NEW_CAPTURE)
11415
11416 // Windows's implementation of std::tmpfile is terrible (it tries
11417 // to create a file inside system folder, thus requiring elevated
11418 // privileges for the binary), so we have to use tmpnam(_s) and
11419 // create the file ourselves there.
11420 class TempFile {
11421 public:
11422 TempFile(TempFile const&) = delete;
11423 TempFile& operator=(TempFile const&) = delete;
11424 TempFile(TempFile&&) = delete;
11425 TempFile& operator=(TempFile&&) = delete;
11426
11427 TempFile();
11428 ~TempFile();
11429
11430 std::FILE* getFile();
11431 std::string getContents();
11432
11433 private:
11434 std::FILE* m_file = nullptr;
11435 #if defined(_MSC_VER)
11436 char m_buffer[L_tmpnam] = { 0 };
11437 #endif
11438 };
11439
11440 class OutputRedirect {
11441 public:
11442 OutputRedirect(OutputRedirect const&) = delete;
11443 OutputRedirect& operator=(OutputRedirect const&) = delete;
11444 OutputRedirect(OutputRedirect&&) = delete;
11445 OutputRedirect& operator=(OutputRedirect&&) = delete;
11446
11447 OutputRedirect(std::string& stdout_dest, std::string& stderr_dest);
11448 ~OutputRedirect();
11449
11450 private:
11451 int m_originalStdout = -1;
11452 int m_originalStderr = -1;
11453 TempFile m_stdoutFile;
11454 TempFile m_stderrFile;
11455 std::string& m_stdoutDest;
11456 std::string& m_stderrDest;
11457 };
11458
11459 #endif
11460
11461 } // end namespace Catch
11462
11463 #endif // TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H
11464 // end catch_output_redirect.h
11465 #include <cstdio>
11466 #include <cstring>
11467 #include <fstream>
11468 #include <sstream>
11469 #include <stdexcept>
11470
11471 #if defined(CATCH_CONFIG_NEW_CAPTURE)
11472 #if defined(_MSC_VER)
11473 #include <io.h> //_dup and _dup2
11474 #define dup _dup
11475 #define dup2 _dup2
11476 #define fileno _fileno
11477 #else
11478 #include <unistd.h> // dup and dup2
11479 #endif
11480 #endif
11481
11482 namespace Catch {
11483
11484 RedirectedStream::RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream )
11485 : m_originalStream( originalStream ),
11486 m_redirectionStream( redirectionStream ),
11487 m_prevBuf( m_originalStream.rdbuf() )
11488 {
11489 m_originalStream.rdbuf( m_redirectionStream.rdbuf() );
11490 }
11491
11492 RedirectedStream::~RedirectedStream() {
11493 m_originalStream.rdbuf( m_prevBuf );
11494 }
11495
11496 RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {}
11497 auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); }
11498
11499 RedirectedStdErr::RedirectedStdErr()
11500 : m_cerr( Catch::cerr(), m_rss.get() ),
11501 m_clog( Catch::clog(), m_rss.get() )
11502 {}
11503 auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); }
11504
11505 RedirectedStreams::RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr)
11506 : m_redirectedCout(redirectedCout),
11507 m_redirectedCerr(redirectedCerr)
11508 {}
11509
11510 RedirectedStreams::~RedirectedStreams() {
11511 m_redirectedCout += m_redirectedStdOut.str();
11512 m_redirectedCerr += m_redirectedStdErr.str();
11513 }
11514
11515 #if defined(CATCH_CONFIG_NEW_CAPTURE)
11516
11517 #if defined(_MSC_VER)
11518 TempFile::TempFile() {
11519 if (tmpnam_s(m_buffer)) {
11520 CATCH_RUNTIME_ERROR("Could not get a temp filename");
11521 }
11522 if (fopen_s(&m_file, m_buffer, "w")) {
11523 char buffer[100];
11524 if (strerror_s(buffer, errno)) {
11525 CATCH_RUNTIME_ERROR("Could not translate errno to a string");
11526 }
11527 CATCH_RUNTIME_ERROR("Could not open the temp file: '" << m_buffer << "' because: " << buffer);
11528 }
11529 }
11530 #else
11531 TempFile::TempFile() {
11532 m_file = std::tmpfile();
11533 if (!m_file) {
11534 CATCH_RUNTIME_ERROR("Could not create a temp file.");
11535 }
11536 }
11537
11538 #endif
11539
11540 TempFile::~TempFile() {
11541 // TBD: What to do about errors here?
11542 std::fclose(m_file);
11543 // We manually create the file on Windows only, on Linux
11544 // it will be autodeleted
11545 #if defined(_MSC_VER)
11546 std::remove(m_buffer);
11547 #endif
11548 }
11549
11550 FILE* TempFile::getFile() {
11551 return m_file;
11552 }
11553
11554 std::string TempFile::getContents() {
11555 std::stringstream sstr;
11556 char buffer[100] = {};
11557 std::rewind(m_file);
11558 while (std::fgets(buffer, sizeof(buffer), m_file)) {
11559 sstr << buffer;
11560 }
11561 return sstr.str();
11562 }
11563
11564 OutputRedirect::OutputRedirect(std::string& stdout_dest, std::string& stderr_dest) :
11565 m_originalStdout(dup(1)),
11566 m_originalStderr(dup(2)),
11567 m_stdoutDest(stdout_dest),
11568 m_stderrDest(stderr_dest) {
11569 dup2(fileno(m_stdoutFile.getFile()), 1);
11570 dup2(fileno(m_stderrFile.getFile()), 2);
11571 }
11572
11573 OutputRedirect::~OutputRedirect() {
11574 Catch::cout() << std::flush;
11575 fflush(stdout);
11576 // Since we support overriding these streams, we flush cerr
11577 // even though std::cerr is unbuffered
11578 Catch::cerr() << std::flush;
11579 Catch::clog() << std::flush;
11580 fflush(stderr);
11581
11582 dup2(m_originalStdout, 1);
11583 dup2(m_originalStderr, 2);
11584
11585 m_stdoutDest += m_stdoutFile.getContents();
11586 m_stderrDest += m_stderrFile.getContents();
11587 }
11588
11589 #endif // CATCH_CONFIG_NEW_CAPTURE
11590
11591 } // namespace Catch
11592
11593 #if defined(CATCH_CONFIG_NEW_CAPTURE)
11594 #if defined(_MSC_VER)
11595 #undef dup
11596 #undef dup2
11597 #undef fileno
11598 #endif
11599 #endif
11600 // end catch_output_redirect.cpp
11601 // start catch_polyfills.cpp
11602
11603 #include <cmath>
11604
11605 namespace Catch {
11606
11607 #if !defined(CATCH_CONFIG_POLYFILL_ISNAN)
11608 bool isnan(float f) {
11609 return std::isnan(f);
11610 }
11611 bool isnan(double d) {
11612 return std::isnan(d);
11613 }
11614 #else
11615 // For now we only use this for embarcadero
11616 bool isnan(float f) {
11617 return std::_isnan(f);
11618 }
11619 bool isnan(double d) {
11620 return std::_isnan(d);
11621 }
11622 #endif
11623
11624 } // end namespace Catch
11625 // end catch_polyfills.cpp
11626 // start catch_random_number_generator.cpp
11627
11628 namespace Catch {
11629
11630 std::mt19937& rng() {
11631 static std::mt19937 s_rng;
11632 return s_rng;
11633 }
11634
11635 void seedRng( IConfig const& config ) {
11636 if( config.rngSeed() != 0 ) {
11637 std::srand( config.rngSeed() );
11638 rng().seed( config.rngSeed() );
11639 }
11640 }
11641
11642 unsigned int rngSeed() {
11643 return getCurrentContext().getConfig()->rngSeed();
11644 }
11645 }
11646 // end catch_random_number_generator.cpp
11647 // start catch_registry_hub.cpp
11648
11649 // start catch_test_case_registry_impl.h
11650
11651 #include <vector>
11652 #include <set>
11653 #include <algorithm>
11654 #include <ios>
11655
11656 namespace Catch {
11657
11658 class TestCase;
11659 struct IConfig;
11660
11661 std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases );
11662 bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
11663
11664 void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions );
11665
11666 std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
11667 std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
11668
11669 class TestRegistry : public ITestCaseRegistry {
11670 public:
11671 virtual ~TestRegistry() = default;
11672
11673 virtual void registerTest( TestCase const& testCase );
11674
11675 std::vector<TestCase> const& getAllTests() const override;
11676 std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const override;
11677
11678 private:
11679 std::vector<TestCase> m_functions;
11680 mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;
11681 mutable std::vector<TestCase> m_sortedFunctions;
11682 std::size_t m_unnamedCount = 0;
11683 std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised
11684 };
11685
11686 ///////////////////////////////////////////////////////////////////////////
11687
11688 class TestInvokerAsFunction : public ITestInvoker {
11689 void(*m_testAsFunction)();
11690 public:
11691 TestInvokerAsFunction( void(*testAsFunction)() ) noexcept;
11692
11693 void invoke() const override;
11694 };
11695
11696 std::string extractClassName( StringRef const& classOrQualifiedMethodName );
11697
11698 ///////////////////////////////////////////////////////////////////////////
11699
11700 } // end namespace Catch
11701
11702 // end catch_test_case_registry_impl.h
11703 // start catch_reporter_registry.h
11704
11705 #include <map>
11706
11707 namespace Catch {
11708
11709 class ReporterRegistry : public IReporterRegistry {
11710
11711 public:
11712
11713 ~ReporterRegistry() override;
11714
11715 IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override;
11716
11717 void registerReporter( std::string const& name, IReporterFactoryPtr const& factory );
11718 void registerListener( IReporterFactoryPtr const& factory );
11719
11720 FactoryMap const& getFactories() const override;
11721 Listeners const& getListeners() const override;
11722
11723 private:
11724 FactoryMap m_factories;
11725 Listeners m_listeners;
11726 };
11727 }
11728
11729 // end catch_reporter_registry.h
11730 // start catch_tag_alias_registry.h
11731
11732 // start catch_tag_alias.h
11733
11734 #include <string>
11735
11736 namespace Catch {
11737
11738 struct TagAlias {
11739 TagAlias(std::string const& _tag, SourceLineInfo _lineInfo);
11740
11741 std::string tag;
11742 SourceLineInfo lineInfo;
11743 };
11744
11745 } // end namespace Catch
11746
11747 // end catch_tag_alias.h
11748 #include <map>
11749
11750 namespace Catch {
11751
11752 class TagAliasRegistry : public ITagAliasRegistry {
11753 public:
11754 ~TagAliasRegistry() override;
11755 TagAlias const* find( std::string const& alias ) const override;
11756 std::string expandAliases( std::string const& unexpandedTestSpec ) const override;
11757 void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo );
11758
11759 private:
11760 std::map<std::string, TagAlias> m_registry;
11761 };
11762
11763 } // end namespace Catch
11764
11765 // end catch_tag_alias_registry.h
11766 // start catch_startup_exception_registry.h
11767
11768 #include <vector>
11769 #include <exception>
11770
11771 namespace Catch {
11772
11773 class StartupExceptionRegistry {
11774 public:
11775 void add(std::exception_ptr const& exception) noexcept;
11776 std::vector<std::exception_ptr> const& getExceptions() const noexcept;
11777 private:
11778 std::vector<std::exception_ptr> m_exceptions;
11779 };
11780
11781 } // end namespace Catch
11782
11783 // end catch_startup_exception_registry.h
11784 // start catch_singletons.hpp
11785
11786 namespace Catch {
11787
11788 struct ISingleton {
11789 virtual ~ISingleton();
11790 };
11791
11792 void addSingleton( ISingleton* singleton );
11793 void cleanupSingletons();
11794
11795 template<typename SingletonImplT, typename InterfaceT = SingletonImplT, typename MutableInterfaceT = InterfaceT>
11796 class Singleton : SingletonImplT, public ISingleton {
11797
11798 static auto getInternal() -> Singleton* {
11799 static Singleton* s_instance = nullptr;
11800 if( !s_instance ) {
11801 s_instance = new Singleton;
11802 addSingleton( s_instance );
11803 }
11804 return s_instance;
11805 }
11806
11807 public:
11808 static auto get() -> InterfaceT const& {
11809 return *getInternal();
11810 }
11811 static auto getMutable() -> MutableInterfaceT& {
11812 return *getInternal();
11813 }
11814 };
11815
11816 } // namespace Catch
11817
11818 // end catch_singletons.hpp
11819 namespace Catch {
11820
11821 namespace {
11822
11823 class RegistryHub : public IRegistryHub, public IMutableRegistryHub,
11824 private NonCopyable {
11825
11826 public: // IRegistryHub
11827 RegistryHub() = default;
11828 IReporterRegistry const& getReporterRegistry() const override {
11829 return m_reporterRegistry;
11830 }
11831 ITestCaseRegistry const& getTestCaseRegistry() const override {
11832 return m_testCaseRegistry;
11833 }
11834 IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override {
11835 return m_exceptionTranslatorRegistry;
11836 }
11837 ITagAliasRegistry const& getTagAliasRegistry() const override {
11838 return m_tagAliasRegistry;
11839 }
11840 StartupExceptionRegistry const& getStartupExceptionRegistry() const override {
11841 return m_exceptionRegistry;
11842 }
11843
11844 public: // IMutableRegistryHub
11845 void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {
11846 m_reporterRegistry.registerReporter( name, factory );
11847 }
11848 void registerListener( IReporterFactoryPtr const& factory ) override {
11849 m_reporterRegistry.registerListener( factory );
11850 }
11851 void registerTest( TestCase const& testInfo ) override {
11852 m_testCaseRegistry.registerTest( testInfo );
11853 }
11854 void registerTranslator( const IExceptionTranslator* translator ) override {
11855 m_exceptionTranslatorRegistry.registerTranslator( translator );
11856 }
11857 void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
11858 m_tagAliasRegistry.add( alias, tag, lineInfo );
11859 }
11860 void registerStartupException() noexcept override {
11861 m_exceptionRegistry.add(std::current_exception());
11862 }
11863 IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {
11864 return m_enumValuesRegistry;
11865 }
11866
11867 private:
11868 TestRegistry m_testCaseRegistry;
11869 ReporterRegistry m_reporterRegistry;
11870 ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;
11871 TagAliasRegistry m_tagAliasRegistry;
11872 StartupExceptionRegistry m_exceptionRegistry;
11873 Detail::EnumValuesRegistry m_enumValuesRegistry;
11874 };
11875 }
11876
11877 using RegistryHubSingleton = Singleton<RegistryHub, IRegistryHub, IMutableRegistryHub>;
11878
11879 IRegistryHub const& getRegistryHub() {
11880 return RegistryHubSingleton::get();
11881 }
11882 IMutableRegistryHub& getMutableRegistryHub() {
11883 return RegistryHubSingleton::getMutable();
11884 }
11885 void cleanUp() {
11886 cleanupSingletons();
11887 cleanUpContext();
11888 }
11889 std::string translateActiveException() {
11890 return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException();
11891 }
11892
11893 } // end namespace Catch
11894 // end catch_registry_hub.cpp
11895 // start catch_reporter_registry.cpp
11896
11897 namespace Catch {
11898
11899 ReporterRegistry::~ReporterRegistry() = default;
11900
11901 IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const {
11902 auto it = m_factories.find( name );
11903 if( it == m_factories.end() )
11904 return nullptr;
11905 return it->second->create( ReporterConfig( config ) );
11906 }
11907
11908 void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
11909 m_factories.emplace(name, factory);
11910 }
11911 void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) {
11912 m_listeners.push_back( factory );
11913 }
11914
11915 IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const {
11916 return m_factories;
11917 }
11918 IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const {
11919 return m_listeners;
11920 }
11921
11922 }
11923 // end catch_reporter_registry.cpp
11924 // start catch_result_type.cpp
11925
11926 namespace Catch {
11927
11928 bool isOk( ResultWas::OfType resultType ) {
11929 return ( resultType & ResultWas::FailureBit ) == 0;
11930 }
11931 bool isJustInfo( int flags ) {
11932 return flags == ResultWas::Info;
11933 }
11934
11935 ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) {
11936 return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) );
11937 }
11938
11939 bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }
11940 bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; }
11941
11942 } // end namespace Catch
11943 // end catch_result_type.cpp
11944 // start catch_run_context.cpp
11945
11946 #include <cassert>
11947 #include <algorithm>
11948 #include <sstream>
11949
11950 namespace Catch {
11951
11952 namespace Generators {
11953 struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker {
11954 GeneratorBasePtr m_generator;
11955
11956 GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
11957 : TrackerBase( nameAndLocation, ctx, parent )
11958 {}
11959 ~GeneratorTracker();
11960
11961 static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) {
11962 std::shared_ptr<GeneratorTracker> tracker;
11963
11964 ITracker& currentTracker = ctx.currentTracker();
11965 if( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
11966 assert( childTracker );
11967 assert( childTracker->isGeneratorTracker() );
11968 tracker = std::static_pointer_cast<GeneratorTracker>( childTracker );
11969 }
11970 else {
11971 tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, &currentTracker );
11972 currentTracker.addChild( tracker );
11973 }
11974
11975 if( !ctx.completedCycle() && !tracker->isComplete() ) {
11976 tracker->open();
11977 }
11978
11979 return *tracker;
11980 }
11981
11982 // TrackerBase interface
11983 bool isGeneratorTracker() const override { return true; }
11984 auto hasGenerator() const -> bool override {
11985 return !!m_generator;
11986 }
11987 void close() override {
11988 TrackerBase::close();
11989 // Generator interface only finds out if it has another item on atual move
11990 if (m_runState == CompletedSuccessfully && m_generator->next()) {
11991 m_children.clear();
11992 m_runState = Executing;
11993 }
11994 }
11995
11996 // IGeneratorTracker interface
11997 auto getGenerator() const -> GeneratorBasePtr const& override {
11998 return m_generator;
11999 }
12000 void setGenerator( GeneratorBasePtr&& generator ) override {
12001 m_generator = std::move( generator );
12002 }
12003 };
12004 GeneratorTracker::~GeneratorTracker() {}
12005 }
12006
12007 RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter)
12008 : m_runInfo(_config->name()),
12009 m_context(getCurrentMutableContext()),
12010 m_config(_config),
12011 m_reporter(std::move(reporter)),
12012 m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal },
12013 m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions )
12014 {
12015 m_context.setRunner(this);
12016 m_context.setConfig(m_config);
12017 m_context.setResultCapture(this);
12018 m_reporter->testRunStarting(m_runInfo);
12019 }
12020
12021 RunContext::~RunContext() {
12022 m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting()));
12023 }
12024
12025 void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) {
12026 m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount));
12027 }
12028
12029 void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) {
12030 m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting()));
12031 }
12032
12033 Totals RunContext::runTest(TestCase const& testCase) {
12034 Totals prevTotals = m_totals;
12035
12036 std::string redirectedCout;
12037 std::string redirectedCerr;
12038
12039 auto const& testInfo = testCase.getTestCaseInfo();
12040
12041 m_reporter->testCaseStarting(testInfo);
12042
12043 m_activeTestCase = &testCase;
12044
12045 ITracker& rootTracker = m_trackerContext.startRun();
12046 assert(rootTracker.isSectionTracker());
12047 static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun());
12048 do {
12049 m_trackerContext.startCycle();
12050 m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo));
12051 runCurrentTest(redirectedCout, redirectedCerr);
12052 } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting());
12053
12054 Totals deltaTotals = m_totals.delta(prevTotals);
12055 if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {
12056 deltaTotals.assertions.failed++;
12057 deltaTotals.testCases.passed--;
12058 deltaTotals.testCases.failed++;
12059 }
12060 m_totals.testCases += deltaTotals.testCases;
12061 m_reporter->testCaseEnded(TestCaseStats(testInfo,
12062 deltaTotals,
12063 redirectedCout,
12064 redirectedCerr,
12065 aborting()));
12066
12067 m_activeTestCase = nullptr;
12068 m_testCaseTracker = nullptr;
12069
12070 return deltaTotals;
12071 }
12072
12073 IConfigPtr RunContext::config() const {
12074 return m_config;
12075 }
12076
12077 IStreamingReporter& RunContext::reporter() const {
12078 return *m_reporter;
12079 }
12080
12081 void RunContext::assertionEnded(AssertionResult const & result) {
12082 if (result.getResultType() == ResultWas::Ok) {
12083 m_totals.assertions.passed++;
12084 m_lastAssertionPassed = true;
12085 } else if (!result.isOk()) {
12086 m_lastAssertionPassed = false;
12087 if( m_activeTestCase->getTestCaseInfo().okToFail() )
12088 m_totals.assertions.failedButOk++;
12089 else
12090 m_totals.assertions.failed++;
12091 }
12092 else {
12093 m_lastAssertionPassed = true;
12094 }
12095
12096 // We have no use for the return value (whether messages should be cleared), because messages were made scoped
12097 // and should be let to clear themselves out.
12098 static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));
12099
12100 if (result.getResultType() != ResultWas::Warning)
12101 m_messageScopes.clear();
12102
12103 // Reset working state
12104 resetAssertionInfo();
12105 m_lastResult = result;
12106 }
12107 void RunContext::resetAssertionInfo() {
12108 m_lastAssertionInfo.macroName = StringRef();
12109 m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr;
12110 }
12111
12112 bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) {
12113 ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo));
12114 if (!sectionTracker.isOpen())
12115 return false;
12116 m_activeSections.push_back(&sectionTracker);
12117
12118 m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo;
12119
12120 m_reporter->sectionStarting(sectionInfo);
12121
12122 assertions = m_totals.assertions;
12123
12124 return true;
12125 }
12126 auto RunContext::acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
12127 using namespace Generators;
12128 GeneratorTracker& tracker = GeneratorTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( "generator", lineInfo ) );
12129 assert( tracker.isOpen() );
12130 m_lastAssertionInfo.lineInfo = lineInfo;
12131 return tracker;
12132 }
12133
12134 bool RunContext::testForMissingAssertions(Counts& assertions) {
12135 if (assertions.total() != 0)
12136 return false;
12137 if (!m_config->warnAboutMissingAssertions())
12138 return false;
12139 if (m_trackerContext.currentTracker().hasChildren())
12140 return false;
12141 m_totals.assertions.failed++;
12142 assertions.failed++;
12143 return true;
12144 }
12145
12146 void RunContext::sectionEnded(SectionEndInfo const & endInfo) {
12147 Counts assertions = m_totals.assertions - endInfo.prevAssertions;
12148 bool missingAssertions = testForMissingAssertions(assertions);
12149
12150 if (!m_activeSections.empty()) {
12151 m_activeSections.back()->close();
12152 m_activeSections.pop_back();
12153 }
12154
12155 m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions));
12156 m_messages.clear();
12157 m_messageScopes.clear();
12158 }
12159
12160 void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) {
12161 if (m_unfinishedSections.empty())
12162 m_activeSections.back()->fail();
12163 else
12164 m_activeSections.back()->close();
12165 m_activeSections.pop_back();
12166
12167 m_unfinishedSections.push_back(endInfo);
12168 }
12169
12170 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
12171 void RunContext::benchmarkPreparing(std::string const& name) {
12172 m_reporter->benchmarkPreparing(name);
12173 }
12174 void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {
12175 m_reporter->benchmarkStarting( info );
12176 }
12177 void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) {
12178 m_reporter->benchmarkEnded( stats );
12179 }
12180 void RunContext::benchmarkFailed(std::string const & error) {
12181 m_reporter->benchmarkFailed(error);
12182 }
12183 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
12184
12185 void RunContext::pushScopedMessage(MessageInfo const & message) {
12186 m_messages.push_back(message);
12187 }
12188
12189 void RunContext::popScopedMessage(MessageInfo const & message) {
12190 m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end());
12191 }
12192
12193 void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) {
12194 m_messageScopes.emplace_back( builder );
12195 }
12196
12197 std::string RunContext::getCurrentTestName() const {
12198 return m_activeTestCase
12199 ? m_activeTestCase->getTestCaseInfo().name
12200 : std::string();
12201 }
12202
12203 const AssertionResult * RunContext::getLastResult() const {
12204 return &(*m_lastResult);
12205 }
12206
12207 void RunContext::exceptionEarlyReported() {
12208 m_shouldReportUnexpected = false;
12209 }
12210
12211 void RunContext::handleFatalErrorCondition( StringRef message ) {
12212 // First notify reporter that bad things happened
12213 m_reporter->fatalErrorEncountered(message);
12214
12215 // Don't rebuild the result -- the stringification itself can cause more fatal errors
12216 // Instead, fake a result data.
12217 AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );
12218 tempResult.message = message;
12219 AssertionResult result(m_lastAssertionInfo, tempResult);
12220
12221 assertionEnded(result);
12222
12223 handleUnfinishedSections();
12224
12225 // Recreate section for test case (as we will lose the one that was in scope)
12226 auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
12227 SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);
12228
12229 Counts assertions;
12230 assertions.failed = 1;
12231 SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false);
12232 m_reporter->sectionEnded(testCaseSectionStats);
12233
12234 auto const& testInfo = m_activeTestCase->getTestCaseInfo();
12235
12236 Totals deltaTotals;
12237 deltaTotals.testCases.failed = 1;
12238 deltaTotals.assertions.failed = 1;
12239 m_reporter->testCaseEnded(TestCaseStats(testInfo,
12240 deltaTotals,
12241 std::string(),
12242 std::string(),
12243 false));
12244 m_totals.testCases.failed++;
12245 testGroupEnded(std::string(), m_totals, 1, 1);
12246 m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));
12247 }
12248
12249 bool RunContext::lastAssertionPassed() {
12250 return m_lastAssertionPassed;
12251 }
12252
12253 void RunContext::assertionPassed() {
12254 m_lastAssertionPassed = true;
12255 ++m_totals.assertions.passed;
12256 resetAssertionInfo();
12257 m_messageScopes.clear();
12258 }
12259
12260 bool RunContext::aborting() const {
12261 return m_totals.assertions.failed >= static_cast<std::size_t>(m_config->abortAfter());
12262 }
12263
12264 void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) {
12265 auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
12266 SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);
12267 m_reporter->sectionStarting(testCaseSection);
12268 Counts prevAssertions = m_totals.assertions;
12269 double duration = 0;
12270 m_shouldReportUnexpected = true;
12271 m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal };
12272
12273 seedRng(*m_config);
12274
12275 Timer timer;
12276 CATCH_TRY {
12277 if (m_reporter->getPreferences().shouldRedirectStdOut) {
12278 #if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)
12279 RedirectedStreams redirectedStreams(redirectedCout, redirectedCerr);
12280
12281 timer.start();
12282 invokeActiveTestCase();
12283 #else
12284 OutputRedirect r(redirectedCout, redirectedCerr);
12285 timer.start();
12286 invokeActiveTestCase();
12287 #endif
12288 } else {
12289 timer.start();
12290 invokeActiveTestCase();
12291 }
12292 duration = timer.getElapsedSeconds();
12293 } CATCH_CATCH_ANON (TestFailureException&) {
12294 // This just means the test was aborted due to failure
12295 } CATCH_CATCH_ALL {
12296 // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions
12297 // are reported without translation at the point of origin.
12298 if( m_shouldReportUnexpected ) {
12299 AssertionReaction dummyReaction;
12300 handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction );
12301 }
12302 }
12303 Counts assertions = m_totals.assertions - prevAssertions;
12304 bool missingAssertions = testForMissingAssertions(assertions);
12305
12306 m_testCaseTracker->close();
12307 handleUnfinishedSections();
12308 m_messages.clear();
12309 m_messageScopes.clear();
12310
12311 SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions);
12312 m_reporter->sectionEnded(testCaseSectionStats);
12313 }
12314
12315 void RunContext::invokeActiveTestCase() {
12316 FatalConditionHandler fatalConditionHandler; // Handle signals
12317 m_activeTestCase->invoke();
12318 fatalConditionHandler.reset();
12319 }
12320
12321 void RunContext::handleUnfinishedSections() {
12322 // If sections ended prematurely due to an exception we stored their
12323 // infos here so we can tear them down outside the unwind process.
12324 for (auto it = m_unfinishedSections.rbegin(),
12325 itEnd = m_unfinishedSections.rend();
12326 it != itEnd;
12327 ++it)
12328 sectionEnded(*it);
12329 m_unfinishedSections.clear();
12330 }
12331
12332 void RunContext::handleExpr(
12333 AssertionInfo const& info,
12334 ITransientExpression const& expr,
12335 AssertionReaction& reaction
12336 ) {
12337 m_reporter->assertionStarting( info );
12338
12339 bool negated = isFalseTest( info.resultDisposition );
12340 bool result = expr.getResult() != negated;
12341
12342 if( result ) {
12343 if (!m_includeSuccessfulResults) {
12344 assertionPassed();
12345 }
12346 else {
12347 reportExpr(info, ResultWas::Ok, &expr, negated);
12348 }
12349 }
12350 else {
12351 reportExpr(info, ResultWas::ExpressionFailed, &expr, negated );
12352 populateReaction( reaction );
12353 }
12354 }
12355 void RunContext::reportExpr(
12356 AssertionInfo const &info,
12357 ResultWas::OfType resultType,
12358 ITransientExpression const *expr,
12359 bool negated ) {
12360
12361 m_lastAssertionInfo = info;
12362 AssertionResultData data( resultType, LazyExpression( negated ) );
12363
12364 AssertionResult assertionResult{ info, data };
12365 assertionResult.m_resultData.lazyExpression.m_transientExpression = expr;
12366
12367 assertionEnded( assertionResult );
12368 }
12369
12370 void RunContext::handleMessage(
12371 AssertionInfo const& info,
12372 ResultWas::OfType resultType,
12373 StringRef const& message,
12374 AssertionReaction& reaction
12375 ) {
12376 m_reporter->assertionStarting( info );
12377
12378 m_lastAssertionInfo = info;
12379
12380 AssertionResultData data( resultType, LazyExpression( false ) );
12381 data.message = message;
12382 AssertionResult assertionResult{ m_lastAssertionInfo, data };
12383 assertionEnded( assertionResult );
12384 if( !assertionResult.isOk() )
12385 populateReaction( reaction );
12386 }
12387 void RunContext::handleUnexpectedExceptionNotThrown(
12388 AssertionInfo const& info,
12389 AssertionReaction& reaction
12390 ) {
12391 handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction);
12392 }
12393
12394 void RunContext::handleUnexpectedInflightException(
12395 AssertionInfo const& info,
12396 std::string const& message,
12397 AssertionReaction& reaction
12398 ) {
12399 m_lastAssertionInfo = info;
12400
12401 AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
12402 data.message = message;
12403 AssertionResult assertionResult{ info, data };
12404 assertionEnded( assertionResult );
12405 populateReaction( reaction );
12406 }
12407
12408 void RunContext::populateReaction( AssertionReaction& reaction ) {
12409 reaction.shouldDebugBreak = m_config->shouldDebugBreak();
12410 reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal);
12411 }
12412
12413 void RunContext::handleIncomplete(
12414 AssertionInfo const& info
12415 ) {
12416 m_lastAssertionInfo = info;
12417
12418 AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
12419 data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE";
12420 AssertionResult assertionResult{ info, data };
12421 assertionEnded( assertionResult );
12422 }
12423 void RunContext::handleNonExpr(
12424 AssertionInfo const &info,
12425 ResultWas::OfType resultType,
12426 AssertionReaction &reaction
12427 ) {
12428 m_lastAssertionInfo = info;
12429
12430 AssertionResultData data( resultType, LazyExpression( false ) );
12431 AssertionResult assertionResult{ info, data };
12432 assertionEnded( assertionResult );
12433
12434 if( !assertionResult.isOk() )
12435 populateReaction( reaction );
12436 }
12437
12438 IResultCapture& getResultCapture() {
12439 if (auto* capture = getCurrentContext().getResultCapture())
12440 return *capture;
12441 else
12442 CATCH_INTERNAL_ERROR("No result capture instance");
12443 }
12444 }
12445 // end catch_run_context.cpp
12446 // start catch_section.cpp
12447
12448 namespace Catch {
12449
12450 Section::Section( SectionInfo const& info )
12451 : m_info( info ),
12452 m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )
12453 {
12454 m_timer.start();
12455 }
12456
12457 Section::~Section() {
12458 if( m_sectionIncluded ) {
12459 SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() };
12460 if( uncaught_exceptions() )
12461 getResultCapture().sectionEndedEarly( endInfo );
12462 else
12463 getResultCapture().sectionEnded( endInfo );
12464 }
12465 }
12466
12467 // This indicates whether the section should be executed or not
12468 Section::operator bool() const {
12469 return m_sectionIncluded;
12470 }
12471
12472 } // end namespace Catch
12473 // end catch_section.cpp
12474 // start catch_section_info.cpp
12475
12476 namespace Catch {
12477
12478 SectionInfo::SectionInfo
12479 ( SourceLineInfo const& _lineInfo,
12480 std::string const& _name )
12481 : name( _name ),
12482 lineInfo( _lineInfo )
12483 {}
12484
12485 } // end namespace Catch
12486 // end catch_section_info.cpp
12487 // start catch_session.cpp
12488
12489 // start catch_session.h
12490
12491 #include <memory>
12492
12493 namespace Catch {
12494
12495 class Session : NonCopyable {
12496 public:
12497
12498 Session();
12499 ~Session() override;
12500
12501 void showHelp() const;
12502 void libIdentify();
12503
12504 int applyCommandLine( int argc, char const * const * argv );
12505 #if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE)
12506 int applyCommandLine( int argc, wchar_t const * const * argv );
12507 #endif
12508
12509 void useConfigData( ConfigData const& configData );
12510
12511 template<typename CharT>
12512 int run(int argc, CharT const * const argv[]) {
12513 if (m_startupExceptions)
12514 return 1;
12515 int returnCode = applyCommandLine(argc, argv);
12516 if (returnCode == 0)
12517 returnCode = run();
12518 return returnCode;
12519 }
12520
12521 int run();
12522
12523 clara::Parser const& cli() const;
12524 void cli( clara::Parser const& newParser );
12525 ConfigData& configData();
12526 Config& config();
12527 private:
12528 int runInternal();
12529
12530 clara::Parser m_cli;
12531 ConfigData m_configData;
12532 std::shared_ptr<Config> m_config;
12533 bool m_startupExceptions = false;
12534 };
12535
12536 } // end namespace Catch
12537
12538 // end catch_session.h
12539 // start catch_version.h
12540
12541 #include <iosfwd>
12542
12543 namespace Catch {
12544
12545 // Versioning information
12546 struct Version {
12547 Version( Version const& ) = delete;
12548 Version& operator=( Version const& ) = delete;
12549 Version( unsigned int _majorVersion,
12550 unsigned int _minorVersion,
12551 unsigned int _patchNumber,
12552 char const * const _branchName,
12553 unsigned int _buildNumber );
12554
12555 unsigned int const majorVersion;
12556 unsigned int const minorVersion;
12557 unsigned int const patchNumber;
12558
12559 // buildNumber is only used if branchName is not null
12560 char const * const branchName;
12561 unsigned int const buildNumber;
12562
12563 friend std::ostream& operator << ( std::ostream& os, Version const& version );
12564 };
12565
12566 Version const& libraryVersion();
12567 }
12568
12569 // end catch_version.h
12570 #include <cstdlib>
12571 #include <iomanip>
12572
12573 namespace Catch {
12574
12575 namespace {
12576 const int MaxExitCode = 255;
12577
12578 IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) {
12579 auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);
12580 CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'");
12581
12582 return reporter;
12583 }
12584
12585 IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) {
12586 if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) {
12587 return createReporter(config->getReporterName(), config);
12588 }
12589
12590 // On older platforms, returning std::unique_ptr<ListeningReporter>
12591 // when the return type is std::unique_ptr<IStreamingReporter>
12592 // doesn't compile without a std::move call. However, this causes
12593 // a warning on newer platforms. Thus, we have to work around
12594 // it a bit and downcast the pointer manually.
12595 auto ret = std::unique_ptr<IStreamingReporter>(new ListeningReporter);
12596 auto& multi = static_cast<ListeningReporter&>(*ret);
12597 auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
12598 for (auto const& listener : listeners) {
12599 multi.addListener(listener->create(Catch::ReporterConfig(config)));
12600 }
12601 multi.addReporter(createReporter(config->getReporterName(), config));
12602 return ret;
12603 }
12604
12605 Catch::Totals runTests(std::shared_ptr<Config> const& config) {
12606 auto reporter = makeReporter(config);
12607
12608 RunContext context(config, std::move(reporter));
12609
12610 Totals totals;
12611
12612 context.testGroupStarting(config->name(), 1, 1);
12613
12614 TestSpec testSpec = config->testSpec();
12615
12616 auto const& allTestCases = getAllTestCasesSorted(*config);
12617 for (auto const& testCase : allTestCases) {
12618 bool matching = (!testSpec.hasFilters() && !testCase.isHidden()) ||
12619 (testSpec.hasFilters() && matchTest(testCase, testSpec, *config));
12620
12621 if (!context.aborting() && matching)
12622 totals += context.runTest(testCase);
12623 else
12624 context.reporter().skipTest(testCase);
12625 }
12626
12627 if (config->warnAboutNoTests() && totals.testCases.total() == 0) {
12628 ReusableStringStream testConfig;
12629
12630 bool first = true;
12631 for (const auto& input : config->getTestsOrTags()) {
12632 if (!first) { testConfig << ' '; }
12633 first = false;
12634 testConfig << input;
12635 }
12636
12637 context.reporter().noMatchingTestCases(testConfig.str());
12638 totals.error = -1;
12639 }
12640
12641 context.testGroupEnded(config->name(), totals, 1, 1);
12642 return totals;
12643 }
12644
12645 void applyFilenamesAsTags(Catch::IConfig const& config) {
12646 auto& tests = const_cast<std::vector<TestCase>&>(getAllTestCasesSorted(config));
12647 for (auto& testCase : tests) {
12648 auto tags = testCase.tags;
12649
12650 std::string filename = testCase.lineInfo.file;
12651 auto lastSlash = filename.find_last_of("\\/");
12652 if (lastSlash != std::string::npos) {
12653 filename.erase(0, lastSlash);
12654 filename[0] = '#';
12655 }
12656
12657 auto lastDot = filename.find_last_of('.');
12658 if (lastDot != std::string::npos) {
12659 filename.erase(lastDot);
12660 }
12661
12662 tags.push_back(std::move(filename));
12663 setTags(testCase, tags);
12664 }
12665 }
12666
12667 } // anon namespace
12668
12669 Session::Session() {
12670 static bool alreadyInstantiated = false;
12671 if( alreadyInstantiated ) {
12672 CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); }
12673 CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); }
12674 }
12675
12676 // There cannot be exceptions at startup in no-exception mode.
12677 #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
12678 const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();
12679 if ( !exceptions.empty() ) {
12680 config();
12681 getCurrentMutableContext().setConfig(m_config);
12682
12683 m_startupExceptions = true;
12684 Colour colourGuard( Colour::Red );
12685 Catch::cerr() << "Errors occurred during startup!" << '\n';
12686 // iterate over all exceptions and notify user
12687 for ( const auto& ex_ptr : exceptions ) {
12688 try {
12689 std::rethrow_exception(ex_ptr);
12690 } catch ( std::exception const& ex ) {
12691 Catch::cerr() << Column( ex.what() ).indent(2) << '\n';
12692 }
12693 }
12694 }
12695 #endif
12696
12697 alreadyInstantiated = true;
12698 m_cli = makeCommandLineParser( m_configData );
12699 }
12700 Session::~Session() {
12701 Catch::cleanUp();
12702 }
12703
12704 void Session::showHelp() const {
12705 Catch::cout()
12706 << "\nCatch v" << libraryVersion() << "\n"
12707 << m_cli << std::endl
12708 << "For more detailed usage please see the project docs\n" << std::endl;
12709 }
12710 void Session::libIdentify() {
12711 Catch::cout()
12712 << std::left << std::setw(16) << "description: " << "A Catch test executable\n"
12713 << std::left << std::setw(16) << "category: " << "testframework\n"
12714 << std::left << std::setw(16) << "framework: " << "Catch Test\n"
12715 << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl;
12716 }
12717
12718 int Session::applyCommandLine( int argc, char const * const * argv ) {
12719 if( m_startupExceptions )
12720 return 1;
12721
12722 auto result = m_cli.parse( clara::Args( argc, argv ) );
12723 if( !result ) {
12724 config();
12725 getCurrentMutableContext().setConfig(m_config);
12726 Catch::cerr()
12727 << Colour( Colour::Red )
12728 << "\nError(s) in input:\n"
12729 << Column( result.errorMessage() ).indent( 2 )
12730 << "\n\n";
12731 Catch::cerr() << "Run with -? for usage\n" << std::endl;
12732 return MaxExitCode;
12733 }
12734
12735 if( m_configData.showHelp )
12736 showHelp();
12737 if( m_configData.libIdentify )
12738 libIdentify();
12739 m_config.reset();
12740 return 0;
12741 }
12742
12743 #if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE)
12744 int Session::applyCommandLine( int argc, wchar_t const * const * argv ) {
12745
12746 char **utf8Argv = new char *[ argc ];
12747
12748 for ( int i = 0; i < argc; ++i ) {
12749 int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL );
12750
12751 utf8Argv[ i ] = new char[ bufSize ];
12752
12753 WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL );
12754 }
12755
12756 int returnCode = applyCommandLine( argc, utf8Argv );
12757
12758 for ( int i = 0; i < argc; ++i )
12759 delete [] utf8Argv[ i ];
12760
12761 delete [] utf8Argv;
12762
12763 return returnCode;
12764 }
12765 #endif
12766
12767 void Session::useConfigData( ConfigData const& configData ) {
12768 m_configData = configData;
12769 m_config.reset();
12770 }
12771
12772 int Session::run() {
12773 if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {
12774 Catch::cout() << "...waiting for enter/ return before starting" << std::endl;
12775 static_cast<void>(std::getchar());
12776 }
12777 int exitCode = runInternal();
12778 if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {
12779 Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl;
12780 static_cast<void>(std::getchar());
12781 }
12782 return exitCode;
12783 }
12784
12785 clara::Parser const& Session::cli() const {
12786 return m_cli;
12787 }
12788 void Session::cli( clara::Parser const& newParser ) {
12789 m_cli = newParser;
12790 }
12791 ConfigData& Session::configData() {
12792 return m_configData;
12793 }
12794 Config& Session::config() {
12795 if( !m_config )
12796 m_config = std::make_shared<Config>( m_configData );
12797 return *m_config;
12798 }
12799
12800 int Session::runInternal() {
12801 if( m_startupExceptions )
12802 return 1;
12803
12804 if (m_configData.showHelp || m_configData.libIdentify) {
12805 return 0;
12806 }
12807
12808 CATCH_TRY {
12809 config(); // Force config to be constructed
12810
12811 seedRng( *m_config );
12812
12813 if( m_configData.filenamesAsTags )
12814 applyFilenamesAsTags( *m_config );
12815
12816 // Handle list request
12817 if( Option<std::size_t> listed = list( m_config ) )
12818 return static_cast<int>( *listed );
12819
12820 auto totals = runTests( m_config );
12821 // Note that on unices only the lower 8 bits are usually used, clamping
12822 // the return value to 255 prevents false negative when some multiple
12823 // of 256 tests has failed
12824 return (std::min) (MaxExitCode, (std::max) (totals.error, static_cast<int>(totals.assertions.failed)));
12825 }
12826 #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
12827 catch( std::exception& ex ) {
12828 Catch::cerr() << ex.what() << std::endl;
12829 return MaxExitCode;
12830 }
12831 #endif
12832 }
12833
12834 } // end namespace Catch
12835 // end catch_session.cpp
12836 // start catch_singletons.cpp
12837
12838 #include <vector>
12839
12840 namespace Catch {
12841
12842 namespace {
12843 static auto getSingletons() -> std::vector<ISingleton*>*& {
12844 static std::vector<ISingleton*>* g_singletons = nullptr;
12845 if( !g_singletons )
12846 g_singletons = new std::vector<ISingleton*>();
12847 return g_singletons;
12848 }
12849 }
12850
12851 ISingleton::~ISingleton() {}
12852
12853 void addSingleton(ISingleton* singleton ) {
12854 getSingletons()->push_back( singleton );
12855 }
12856 void cleanupSingletons() {
12857 auto& singletons = getSingletons();
12858 for( auto singleton : *singletons )
12859 delete singleton;
12860 delete singletons;
12861 singletons = nullptr;
12862 }
12863
12864 } // namespace Catch
12865 // end catch_singletons.cpp
12866 // start catch_startup_exception_registry.cpp
12867
12868 namespace Catch {
12869 void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
12870 CATCH_TRY {
12871 m_exceptions.push_back(exception);
12872 } CATCH_CATCH_ALL {
12873 // If we run out of memory during start-up there's really not a lot more we can do about it
12874 std::terminate();
12875 }
12876 }
12877
12878 std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {
12879 return m_exceptions;
12880 }
12881
12882 } // end namespace Catch
12883 // end catch_startup_exception_registry.cpp
12884 // start catch_stream.cpp
12885
12886 #include <cstdio>
12887 #include <iostream>
12888 #include <fstream>
12889 #include <sstream>
12890 #include <vector>
12891 #include <memory>
12892
12893 namespace Catch {
12894
12895 Catch::IStream::~IStream() = default;
12896
12897 namespace Detail { namespace {
12898 template<typename WriterF, std::size_t bufferSize=256>
12899 class StreamBufImpl : public std::streambuf {
12900 char data[bufferSize];
12901 WriterF m_writer;
12902
12903 public:
12904 StreamBufImpl() {
12905 setp( data, data + sizeof(data) );
12906 }
12907
12908 ~StreamBufImpl() noexcept {
12909 StreamBufImpl::sync();
12910 }
12911
12912 private:
12913 int overflow( int c ) override {
12914 sync();
12915
12916 if( c != EOF ) {
12917 if( pbase() == epptr() )
12918 m_writer( std::string( 1, static_cast<char>( c ) ) );
12919 else
12920 sputc( static_cast<char>( c ) );
12921 }
12922 return 0;
12923 }
12924
12925 int sync() override {
12926 if( pbase() != pptr() ) {
12927 m_writer( std::string( pbase(), static_cast<std::string::size_type>( pptr() - pbase() ) ) );
12928 setp( pbase(), epptr() );
12929 }
12930 return 0;
12931 }
12932 };
12933
12934 ///////////////////////////////////////////////////////////////////////////
12935
12936 struct OutputDebugWriter {
12937
12938 void operator()( std::string const&str ) {
12939 writeToDebugConsole( str );
12940 }
12941 };
12942
12943 ///////////////////////////////////////////////////////////////////////////
12944
12945 class FileStream : public IStream {
12946 mutable std::ofstream m_ofs;
12947 public:
12948 FileStream( StringRef filename ) {
12949 m_ofs.open( filename.c_str() );
12950 CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" );
12951 }
12952 ~FileStream() override = default;
12953 public: // IStream
12954 std::ostream& stream() const override {
12955 return m_ofs;
12956 }
12957 };
12958
12959 ///////////////////////////////////////////////////////////////////////////
12960
12961 class CoutStream : public IStream {
12962 mutable std::ostream m_os;
12963 public:
12964 // Store the streambuf from cout up-front because
12965 // cout may get redirected when running tests
12966 CoutStream() : m_os( Catch::cout().rdbuf() ) {}
12967 ~CoutStream() override = default;
12968
12969 public: // IStream
12970 std::ostream& stream() const override { return m_os; }
12971 };
12972
12973 ///////////////////////////////////////////////////////////////////////////
12974
12975 class DebugOutStream : public IStream {
12976 std::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf;
12977 mutable std::ostream m_os;
12978 public:
12979 DebugOutStream()
12980 : m_streamBuf( new StreamBufImpl<OutputDebugWriter>() ),
12981 m_os( m_streamBuf.get() )
12982 {}
12983
12984 ~DebugOutStream() override = default;
12985
12986 public: // IStream
12987 std::ostream& stream() const override { return m_os; }
12988 };
12989
12990 }} // namespace anon::detail
12991
12992 ///////////////////////////////////////////////////////////////////////////
12993
12994 auto makeStream( StringRef const &filename ) -> IStream const* {
12995 if( filename.empty() )
12996 return new Detail::CoutStream();
12997 else if( filename[0] == '%' ) {
12998 if( filename == "%debug" )
12999 return new Detail::DebugOutStream();
13000 else
13001 CATCH_ERROR( "Unrecognised stream: '" << filename << "'" );
13002 }
13003 else
13004 return new Detail::FileStream( filename );
13005 }
13006
13007 // This class encapsulates the idea of a pool of ostringstreams that can be reused.
13008 struct StringStreams {
13009 std::vector<std::unique_ptr<std::ostringstream>> m_streams;
13010 std::vector<std::size_t> m_unused;
13011 std::ostringstream m_referenceStream; // Used for copy state/ flags from
13012
13013 auto add() -> std::size_t {
13014 if( m_unused.empty() ) {
13015 m_streams.push_back( std::unique_ptr<std::ostringstream>( new std::ostringstream ) );
13016 return m_streams.size()-1;
13017 }
13018 else {
13019 auto index = m_unused.back();
13020 m_unused.pop_back();
13021 return index;
13022 }
13023 }
13024
13025 void release( std::size_t index ) {
13026 m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state
13027 m_unused.push_back(index);
13028 }
13029 };
13030
13031 ReusableStringStream::ReusableStringStream()
13032 : m_index( Singleton<StringStreams>::getMutable().add() ),
13033 m_oss( Singleton<StringStreams>::getMutable().m_streams[m_index].get() )
13034 {}
13035
13036 ReusableStringStream::~ReusableStringStream() {
13037 static_cast<std::ostringstream*>( m_oss )->str("");
13038 m_oss->clear();
13039 Singleton<StringStreams>::getMutable().release( m_index );
13040 }
13041
13042 auto ReusableStringStream::str() const -> std::string {
13043 return static_cast<std::ostringstream*>( m_oss )->str();
13044 }
13045
13046 ///////////////////////////////////////////////////////////////////////////
13047
13048 #ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions
13049 std::ostream& cout() { return std::cout; }
13050 std::ostream& cerr() { return std::cerr; }
13051 std::ostream& clog() { return std::clog; }
13052 #endif
13053 }
13054 // end catch_stream.cpp
13055 // start catch_string_manip.cpp
13056
13057 #include <algorithm>
13058 #include <ostream>
13059 #include <cstring>
13060 #include <cctype>
13061 #include <vector>
13062
13063 namespace Catch {
13064
13065 namespace {
13066 char toLowerCh(char c) {
13067 return static_cast<char>( std::tolower( c ) );
13068 }
13069 }
13070
13071 bool startsWith( std::string const& s, std::string const& prefix ) {
13072 return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
13073 }
13074 bool startsWith( std::string const& s, char prefix ) {
13075 return !s.empty() && s[0] == prefix;
13076 }
13077 bool endsWith( std::string const& s, std::string const& suffix ) {
13078 return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());
13079 }
13080 bool endsWith( std::string const& s, char suffix ) {
13081 return !s.empty() && s[s.size()-1] == suffix;
13082 }
13083 bool contains( std::string const& s, std::string const& infix ) {
13084 return s.find( infix ) != std::string::npos;
13085 }
13086 void toLowerInPlace( std::string& s ) {
13087 std::transform( s.begin(), s.end(), s.begin(), toLowerCh );
13088 }
13089 std::string toLower( std::string const& s ) {
13090 std::string lc = s;
13091 toLowerInPlace( lc );
13092 return lc;
13093 }
13094 std::string trim( std::string const& str ) {
13095 static char const* whitespaceChars = "\n\r\t ";
13096 std::string::size_type start = str.find_first_not_of( whitespaceChars );
13097 std::string::size_type end = str.find_last_not_of( whitespaceChars );
13098
13099 return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();
13100 }
13101
13102 bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
13103 bool replaced = false;
13104 std::size_t i = str.find( replaceThis );
13105 while( i != std::string::npos ) {
13106 replaced = true;
13107 str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );
13108 if( i < str.size()-withThis.size() )
13109 i = str.find( replaceThis, i+withThis.size() );
13110 else
13111 i = std::string::npos;
13112 }
13113 return replaced;
13114 }
13115
13116 std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {
13117 std::vector<StringRef> subStrings;
13118 std::size_t start = 0;
13119 for(std::size_t pos = 0; pos < str.size(); ++pos ) {
13120 if( str[pos] == delimiter ) {
13121 if( pos - start > 1 )
13122 subStrings.push_back( str.substr( start, pos-start ) );
13123 start = pos+1;
13124 }
13125 }
13126 if( start < str.size() )
13127 subStrings.push_back( str.substr( start, str.size()-start ) );
13128 return subStrings;
13129 }
13130
13131 pluralise::pluralise( std::size_t count, std::string const& label )
13132 : m_count( count ),
13133 m_label( label )
13134 {}
13135
13136 std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {
13137 os << pluraliser.m_count << ' ' << pluraliser.m_label;
13138 if( pluraliser.m_count != 1 )
13139 os << 's';
13140 return os;
13141 }
13142
13143 }
13144 // end catch_string_manip.cpp
13145 // start catch_stringref.cpp
13146
13147 #if defined(__clang__)
13148 # pragma clang diagnostic push
13149 # pragma clang diagnostic ignored "-Wexit-time-destructors"
13150 #endif
13151
13152 #include <ostream>
13153 #include <cstring>
13154 #include <cstdint>
13155
13156 namespace {
13157 const uint32_t byte_2_lead = 0xC0;
13158 const uint32_t byte_3_lead = 0xE0;
13159 const uint32_t byte_4_lead = 0xF0;
13160 }
13161
13162 namespace Catch {
13163 StringRef::StringRef( char const* rawChars ) noexcept
13164 : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) )
13165 {}
13166
13167 StringRef::operator std::string() const {
13168 return std::string( m_start, m_size );
13169 }
13170
13171 void StringRef::swap( StringRef& other ) noexcept {
13172 std::swap( m_start, other.m_start );
13173 std::swap( m_size, other.m_size );
13174 std::swap( m_data, other.m_data );
13175 }
13176
13177 auto StringRef::c_str() const -> char const* {
13178 if( !isSubstring() )
13179 return m_start;
13180
13181 const_cast<StringRef *>( this )->takeOwnership();
13182 return m_data;
13183 }
13184 auto StringRef::currentData() const noexcept -> char const* {
13185 return m_start;
13186 }
13187
13188 auto StringRef::isOwned() const noexcept -> bool {
13189 return m_data != nullptr;
13190 }
13191 auto StringRef::isSubstring() const noexcept -> bool {
13192 return m_start[m_size] != '\0';
13193 }
13194
13195 void StringRef::takeOwnership() {
13196 if( !isOwned() ) {
13197 m_data = new char[m_size+1];
13198 memcpy( m_data, m_start, m_size );
13199 m_data[m_size] = '\0';
13200 }
13201 }
13202 auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef {
13203 if( start < m_size )
13204 return StringRef( m_start+start, size );
13205 else
13206 return StringRef();
13207 }
13208 auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool {
13209 return
13210 size() == other.size() &&
13211 (std::strncmp( m_start, other.m_start, size() ) == 0);
13212 }
13213 auto StringRef::operator != ( StringRef const& other ) const noexcept -> bool {
13214 return !operator==( other );
13215 }
13216
13217 auto StringRef::operator[](size_type index) const noexcept -> char {
13218 return m_start[index];
13219 }
13220
13221 auto StringRef::numberOfCharacters() const noexcept -> size_type {
13222 size_type noChars = m_size;
13223 // Make adjustments for uft encodings
13224 for( size_type i=0; i < m_size; ++i ) {
13225 char c = m_start[i];
13226 if( ( c & byte_2_lead ) == byte_2_lead ) {
13227 noChars--;
13228 if (( c & byte_3_lead ) == byte_3_lead )
13229 noChars--;
13230 if( ( c & byte_4_lead ) == byte_4_lead )
13231 noChars--;
13232 }
13233 }
13234 return noChars;
13235 }
13236
13237 auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string {
13238 std::string str;
13239 str.reserve( lhs.size() + rhs.size() );
13240 str += lhs;
13241 str += rhs;
13242 return str;
13243 }
13244 auto operator + ( StringRef const& lhs, const char* rhs ) -> std::string {
13245 return std::string( lhs ) + std::string( rhs );
13246 }
13247 auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string {
13248 return std::string( lhs ) + std::string( rhs );
13249 }
13250
13251 auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& {
13252 return os.write(str.currentData(), str.size());
13253 }
13254
13255 auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& {
13256 lhs.append(rhs.currentData(), rhs.size());
13257 return lhs;
13258 }
13259
13260 } // namespace Catch
13261
13262 #if defined(__clang__)
13263 # pragma clang diagnostic pop
13264 #endif
13265 // end catch_stringref.cpp
13266 // start catch_tag_alias.cpp
13267
13268 namespace Catch {
13269 TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {}
13270 }
13271 // end catch_tag_alias.cpp
13272 // start catch_tag_alias_autoregistrar.cpp
13273
13274 namespace Catch {
13275
13276 RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {
13277 CATCH_TRY {
13278 getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);
13279 } CATCH_CATCH_ALL {
13280 // Do not throw when constructing global objects, instead register the exception to be processed later
13281 getMutableRegistryHub().registerStartupException();
13282 }
13283 }
13284
13285 }
13286 // end catch_tag_alias_autoregistrar.cpp
13287 // start catch_tag_alias_registry.cpp
13288
13289 #include <sstream>
13290
13291 namespace Catch {
13292
13293 TagAliasRegistry::~TagAliasRegistry() {}
13294
13295 TagAlias const* TagAliasRegistry::find( std::string const& alias ) const {
13296 auto it = m_registry.find( alias );
13297 if( it != m_registry.end() )
13298 return &(it->second);
13299 else
13300 return nullptr;
13301 }
13302
13303 std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const {
13304 std::string expandedTestSpec = unexpandedTestSpec;
13305 for( auto const& registryKvp : m_registry ) {
13306 std::size_t pos = expandedTestSpec.find( registryKvp.first );
13307 if( pos != std::string::npos ) {
13308 expandedTestSpec = expandedTestSpec.substr( 0, pos ) +
13309 registryKvp.second.tag +
13310 expandedTestSpec.substr( pos + registryKvp.first.size() );
13311 }
13312 }
13313 return expandedTestSpec;
13314 }
13315
13316 void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) {
13317 CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'),
13318 "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo );
13319
13320 CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second,
13321 "error: tag alias, '" << alias << "' already registered.\n"
13322 << "\tFirst seen at: " << find(alias)->lineInfo << "\n"
13323 << "\tRedefined at: " << lineInfo );
13324 }
13325
13326 ITagAliasRegistry::~ITagAliasRegistry() {}
13327
13328 ITagAliasRegistry const& ITagAliasRegistry::get() {
13329 return getRegistryHub().getTagAliasRegistry();
13330 }
13331
13332 } // end namespace Catch
13333 // end catch_tag_alias_registry.cpp
13334 // start catch_test_case_info.cpp
13335
13336 #include <cctype>
13337 #include <exception>
13338 #include <algorithm>
13339 #include <sstream>
13340
13341 namespace Catch {
13342
13343 namespace {
13344 TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) {
13345 if( startsWith( tag, '.' ) ||
13346 tag == "!hide" )
13347 return TestCaseInfo::IsHidden;
13348 else if( tag == "!throws" )
13349 return TestCaseInfo::Throws;
13350 else if( tag == "!shouldfail" )
13351 return TestCaseInfo::ShouldFail;
13352 else if( tag == "!mayfail" )
13353 return TestCaseInfo::MayFail;
13354 else if( tag == "!nonportable" )
13355 return TestCaseInfo::NonPortable;
13356 else if( tag == "!benchmark" )
13357 return static_cast<TestCaseInfo::SpecialProperties>( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden );
13358 else
13359 return TestCaseInfo::None;
13360 }
13361 bool isReservedTag( std::string const& tag ) {
13362 return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast<unsigned char>(tag[0]) );
13363 }
13364 void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
13365 CATCH_ENFORCE( !isReservedTag(tag),
13366 "Tag name: [" << tag << "] is not allowed.\n"
13367 << "Tag names starting with non alphanumeric characters are reserved\n"
13368 << _lineInfo );
13369 }
13370 }
13371
13372 TestCase makeTestCase( ITestInvoker* _testCase,
13373 std::string const& _className,
13374 NameAndTags const& nameAndTags,
13375 SourceLineInfo const& _lineInfo )
13376 {
13377 bool isHidden = false;
13378
13379 // Parse out tags
13380 std::vector<std::string> tags;
13381 std::string desc, tag;
13382 bool inTag = false;
13383 std::string _descOrTags = nameAndTags.tags;
13384 for (char c : _descOrTags) {
13385 if( !inTag ) {
13386 if( c == '[' )
13387 inTag = true;
13388 else
13389 desc += c;
13390 }
13391 else {
13392 if( c == ']' ) {
13393 TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );
13394 if( ( prop & TestCaseInfo::IsHidden ) != 0 )
13395 isHidden = true;
13396 else if( prop == TestCaseInfo::None )
13397 enforceNotReservedTag( tag, _lineInfo );
13398
13399 // Merged hide tags like `[.approvals]` should be added as
13400 // `[.][approvals]`. The `[.]` is added at later point, so
13401 // we only strip the prefix
13402 if (startsWith(tag, '.') && tag.size() > 1) {
13403 tag.erase(0, 1);
13404 }
13405 tags.push_back( tag );
13406 tag.clear();
13407 inTag = false;
13408 }
13409 else
13410 tag += c;
13411 }
13412 }
13413 if( isHidden ) {
13414 tags.push_back( "." );
13415 }
13416
13417 TestCaseInfo info( nameAndTags.name, _className, desc, tags, _lineInfo );
13418 return TestCase( _testCase, std::move(info) );
13419 }
13420
13421 void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {
13422 std::sort(begin(tags), end(tags));
13423 tags.erase(std::unique(begin(tags), end(tags)), end(tags));
13424 testCaseInfo.lcaseTags.clear();
13425
13426 for( auto const& tag : tags ) {
13427 std::string lcaseTag = toLower( tag );
13428 testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) );
13429 testCaseInfo.lcaseTags.push_back( lcaseTag );
13430 }
13431 testCaseInfo.tags = std::move(tags);
13432 }
13433
13434 TestCaseInfo::TestCaseInfo( std::string const& _name,
13435 std::string const& _className,
13436 std::string const& _description,
13437 std::vector<std::string> const& _tags,
13438 SourceLineInfo const& _lineInfo )
13439 : name( _name ),
13440 className( _className ),
13441 description( _description ),
13442 lineInfo( _lineInfo ),
13443 properties( None )
13444 {
13445 setTags( *this, _tags );
13446 }
13447
13448 bool TestCaseInfo::isHidden() const {
13449 return ( properties & IsHidden ) != 0;
13450 }
13451 bool TestCaseInfo::throws() const {
13452 return ( properties & Throws ) != 0;
13453 }
13454 bool TestCaseInfo::okToFail() const {
13455 return ( properties & (ShouldFail | MayFail ) ) != 0;
13456 }
13457 bool TestCaseInfo::expectedToFail() const {
13458 return ( properties & (ShouldFail ) ) != 0;
13459 }
13460
13461 std::string TestCaseInfo::tagsAsString() const {
13462 std::string ret;
13463 // '[' and ']' per tag
13464 std::size_t full_size = 2 * tags.size();
13465 for (const auto& tag : tags) {
13466 full_size += tag.size();
13467 }
13468 ret.reserve(full_size);
13469 for (const auto& tag : tags) {
13470 ret.push_back('[');
13471 ret.append(tag);
13472 ret.push_back(']');
13473 }
13474
13475 return ret;
13476 }
13477
13478 TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {}
13479
13480 TestCase TestCase::withName( std::string const& _newName ) const {
13481 TestCase other( *this );
13482 other.name = _newName;
13483 return other;
13484 }
13485
13486 void TestCase::invoke() const {
13487 test->invoke();
13488 }
13489
13490 bool TestCase::operator == ( TestCase const& other ) const {
13491 return test.get() == other.test.get() &&
13492 name == other.name &&
13493 className == other.className;
13494 }
13495
13496 bool TestCase::operator < ( TestCase const& other ) const {
13497 return name < other.name;
13498 }
13499
13500 TestCaseInfo const& TestCase::getTestCaseInfo() const
13501 {
13502 return *this;
13503 }
13504
13505 } // end namespace Catch
13506 // end catch_test_case_info.cpp
13507 // start catch_test_case_registry_impl.cpp
13508
13509 #include <sstream>
13510
13511 namespace Catch {
13512
13513 std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
13514
13515 std::vector<TestCase> sorted = unsortedTestCases;
13516
13517 switch( config.runOrder() ) {
13518 case RunTests::InLexicographicalOrder:
13519 std::sort( sorted.begin(), sorted.end() );
13520 break;
13521 case RunTests::InRandomOrder:
13522 seedRng( config );
13523 std::shuffle( sorted.begin(), sorted.end(), rng() );
13524 break;
13525 case RunTests::InDeclarationOrder:
13526 // already in declaration order
13527 break;
13528 }
13529 return sorted;
13530 }
13531 bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) {
13532 return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() );
13533 }
13534
13535 void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ) {
13536 std::set<TestCase> seenFunctions;
13537 for( auto const& function : functions ) {
13538 auto prev = seenFunctions.insert( function );
13539 CATCH_ENFORCE( prev.second,
13540 "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n"
13541 << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
13542 << "\tRedefined at " << function.getTestCaseInfo().lineInfo );
13543 }
13544 }
13545
13546 std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
13547 std::vector<TestCase> filtered;
13548 filtered.reserve( testCases.size() );
13549 for (auto const& testCase : testCases) {
13550 if ((!testSpec.hasFilters() && !testCase.isHidden()) ||
13551 (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {
13552 filtered.push_back(testCase);
13553 }
13554 }
13555 return filtered;
13556 }
13557 std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
13558 return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );
13559 }
13560
13561 void TestRegistry::registerTest( TestCase const& testCase ) {
13562 std::string name = testCase.getTestCaseInfo().name;
13563 if( name.empty() ) {
13564 ReusableStringStream rss;
13565 rss << "Anonymous test case " << ++m_unnamedCount;
13566 return registerTest( testCase.withName( rss.str() ) );
13567 }
13568 m_functions.push_back( testCase );
13569 }
13570
13571 std::vector<TestCase> const& TestRegistry::getAllTests() const {
13572 return m_functions;
13573 }
13574 std::vector<TestCase> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {
13575 if( m_sortedFunctions.empty() )
13576 enforceNoDuplicateTestCases( m_functions );
13577
13578 if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {
13579 m_sortedFunctions = sortTests( config, m_functions );
13580 m_currentSortOrder = config.runOrder();
13581 }
13582 return m_sortedFunctions;
13583 }
13584
13585 ///////////////////////////////////////////////////////////////////////////
13586 TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {}
13587
13588 void TestInvokerAsFunction::invoke() const {
13589 m_testAsFunction();
13590 }
13591
13592 std::string extractClassName( StringRef const& classOrQualifiedMethodName ) {
13593 std::string className = classOrQualifiedMethodName;
13594 if( startsWith( className, '&' ) )
13595 {
13596 std::size_t lastColons = className.rfind( "::" );
13597 std::size_t penultimateColons = className.rfind( "::", lastColons-1 );
13598 if( penultimateColons == std::string::npos )
13599 penultimateColons = 1;
13600 className = className.substr( penultimateColons, lastColons-penultimateColons );
13601 }
13602 return className;
13603 }
13604
13605 } // end namespace Catch
13606 // end catch_test_case_registry_impl.cpp
13607 // start catch_test_case_tracker.cpp
13608
13609 #include <algorithm>
13610 #include <cassert>
13611 #include <stdexcept>
13612 #include <memory>
13613 #include <sstream>
13614
13615 #if defined(__clang__)
13616 # pragma clang diagnostic push
13617 # pragma clang diagnostic ignored "-Wexit-time-destructors"
13618 #endif
13619
13620 namespace Catch {
13621 namespace TestCaseTracking {
13622
13623 NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location )
13624 : name( _name ),
13625 location( _location )
13626 {}
13627
13628 ITracker::~ITracker() = default;
13629
13630 ITracker& TrackerContext::startRun() {
13631 m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr );
13632 m_currentTracker = nullptr;
13633 m_runState = Executing;
13634 return *m_rootTracker;
13635 }
13636
13637 void TrackerContext::endRun() {
13638 m_rootTracker.reset();
13639 m_currentTracker = nullptr;
13640 m_runState = NotStarted;
13641 }
13642
13643 void TrackerContext::startCycle() {
13644 m_currentTracker = m_rootTracker.get();
13645 m_runState = Executing;
13646 }
13647 void TrackerContext::completeCycle() {
13648 m_runState = CompletedCycle;
13649 }
13650
13651 bool TrackerContext::completedCycle() const {
13652 return m_runState == CompletedCycle;
13653 }
13654 ITracker& TrackerContext::currentTracker() {
13655 return *m_currentTracker;
13656 }
13657 void TrackerContext::setCurrentTracker( ITracker* tracker ) {
13658 m_currentTracker = tracker;
13659 }
13660
13661 TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
13662 : m_nameAndLocation( nameAndLocation ),
13663 m_ctx( ctx ),
13664 m_parent( parent )
13665 {}
13666
13667 NameAndLocation const& TrackerBase::nameAndLocation() const {
13668 return m_nameAndLocation;
13669 }
13670 bool TrackerBase::isComplete() const {
13671 return m_runState == CompletedSuccessfully || m_runState == Failed;
13672 }
13673 bool TrackerBase::isSuccessfullyCompleted() const {
13674 return m_runState == CompletedSuccessfully;
13675 }
13676 bool TrackerBase::isOpen() const {
13677 return m_runState != NotStarted && !isComplete();
13678 }
13679 bool TrackerBase::hasChildren() const {
13680 return !m_children.empty();
13681 }
13682
13683 void TrackerBase::addChild( ITrackerPtr const& child ) {
13684 m_children.push_back( child );
13685 }
13686
13687 ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) {
13688 auto it = std::find_if( m_children.begin(), m_children.end(),
13689 [&nameAndLocation]( ITrackerPtr const& tracker ){
13690 return
13691 tracker->nameAndLocation().location == nameAndLocation.location &&
13692 tracker->nameAndLocation().name == nameAndLocation.name;
13693 } );
13694 return( it != m_children.end() )
13695 ? *it
13696 : nullptr;
13697 }
13698 ITracker& TrackerBase::parent() {
13699 assert( m_parent ); // Should always be non-null except for root
13700 return *m_parent;
13701 }
13702
13703 void TrackerBase::openChild() {
13704 if( m_runState != ExecutingChildren ) {
13705 m_runState = ExecutingChildren;
13706 if( m_parent )
13707 m_parent->openChild();
13708 }
13709 }
13710
13711 bool TrackerBase::isSectionTracker() const { return false; }
13712 bool TrackerBase::isGeneratorTracker() const { return false; }
13713
13714 void TrackerBase::open() {
13715 m_runState = Executing;
13716 moveToThis();
13717 if( m_parent )
13718 m_parent->openChild();
13719 }
13720
13721 void TrackerBase::close() {
13722
13723 // Close any still open children (e.g. generators)
13724 while( &m_ctx.currentTracker() != this )
13725 m_ctx.currentTracker().close();
13726
13727 switch( m_runState ) {
13728 case NeedsAnotherRun:
13729 break;
13730
13731 case Executing:
13732 m_runState = CompletedSuccessfully;
13733 break;
13734 case ExecutingChildren:
13735 if( m_children.empty() || m_children.back()->isComplete() )
13736 m_runState = CompletedSuccessfully;
13737 break;
13738
13739 case NotStarted:
13740 case CompletedSuccessfully:
13741 case Failed:
13742 CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState );
13743
13744 default:
13745 CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState );
13746 }
13747 moveToParent();
13748 m_ctx.completeCycle();
13749 }
13750 void TrackerBase::fail() {
13751 m_runState = Failed;
13752 if( m_parent )
13753 m_parent->markAsNeedingAnotherRun();
13754 moveToParent();
13755 m_ctx.completeCycle();
13756 }
13757 void TrackerBase::markAsNeedingAnotherRun() {
13758 m_runState = NeedsAnotherRun;
13759 }
13760
13761 void TrackerBase::moveToParent() {
13762 assert( m_parent );
13763 m_ctx.setCurrentTracker( m_parent );
13764 }
13765 void TrackerBase::moveToThis() {
13766 m_ctx.setCurrentTracker( this );
13767 }
13768
13769 SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
13770 : TrackerBase( nameAndLocation, ctx, parent )
13771 {
13772 if( parent ) {
13773 while( !parent->isSectionTracker() )
13774 parent = &parent->parent();
13775
13776 SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );
13777 addNextFilters( parentSection.m_filters );
13778 }
13779 }
13780
13781 bool SectionTracker::isComplete() const {
13782 bool complete = true;
13783
13784 if ((m_filters.empty() || m_filters[0] == "") ||
13785 std::find(m_filters.begin(), m_filters.end(),
13786 m_nameAndLocation.name) != m_filters.end())
13787 complete = TrackerBase::isComplete();
13788 return complete;
13789
13790 }
13791
13792 bool SectionTracker::isSectionTracker() const { return true; }
13793
13794 SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) {
13795 std::shared_ptr<SectionTracker> section;
13796
13797 ITracker& currentTracker = ctx.currentTracker();
13798 if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
13799 assert( childTracker );
13800 assert( childTracker->isSectionTracker() );
13801 section = std::static_pointer_cast<SectionTracker>( childTracker );
13802 }
13803 else {
13804 section = std::make_shared<SectionTracker>( nameAndLocation, ctx, &currentTracker );
13805 currentTracker.addChild( section );
13806 }
13807 if( !ctx.completedCycle() )
13808 section->tryOpen();
13809 return *section;
13810 }
13811
13812 void SectionTracker::tryOpen() {
13813 if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) )
13814 open();
13815 }
13816
13817 void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) {
13818 if( !filters.empty() ) {
13819 m_filters.push_back(""); // Root - should never be consulted
13820 m_filters.push_back(""); // Test Case - not a section filter
13821 m_filters.insert( m_filters.end(), filters.begin(), filters.end() );
13822 }
13823 }
13824 void SectionTracker::addNextFilters( std::vector<std::string> const& filters ) {
13825 if( filters.size() > 1 )
13826 m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() );
13827 }
13828
13829 } // namespace TestCaseTracking
13830
13831 using TestCaseTracking::ITracker;
13832 using TestCaseTracking::TrackerContext;
13833 using TestCaseTracking::SectionTracker;
13834
13835 } // namespace Catch
13836
13837 #if defined(__clang__)
13838 # pragma clang diagnostic pop
13839 #endif
13840 // end catch_test_case_tracker.cpp
13841 // start catch_test_registry.cpp
13842
13843 namespace Catch {
13844
13845 auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* {
13846 return new(std::nothrow) TestInvokerAsFunction( testAsFunction );
13847 }
13848
13849 NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {}
13850
13851 AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept {
13852 CATCH_TRY {
13853 getMutableRegistryHub()
13854 .registerTest(
13855 makeTestCase(
13856 invoker,
13857 extractClassName( classOrMethod ),
13858 nameAndTags,
13859 lineInfo));
13860 } CATCH_CATCH_ALL {
13861 // Do not throw when constructing global objects, instead register the exception to be processed later
13862 getMutableRegistryHub().registerStartupException();
13863 }
13864 }
13865
13866 AutoReg::~AutoReg() = default;
13867 }
13868 // end catch_test_registry.cpp
13869 // start catch_test_spec.cpp
13870
13871 #include <algorithm>
13872 #include <string>
13873 #include <vector>
13874 #include <memory>
13875
13876 namespace Catch {
13877
13878 TestSpec::Pattern::~Pattern() = default;
13879 TestSpec::NamePattern::~NamePattern() = default;
13880 TestSpec::TagPattern::~TagPattern() = default;
13881 TestSpec::ExcludedPattern::~ExcludedPattern() = default;
13882
13883 TestSpec::NamePattern::NamePattern( std::string const& name )
13884 : m_wildcardPattern( toLower( name ), CaseSensitive::No )
13885 {}
13886 bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const {
13887 return m_wildcardPattern.matches( toLower( testCase.name ) );
13888 }
13889
13890 TestSpec::TagPattern::TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {}
13891 bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const {
13892 return std::find(begin(testCase.lcaseTags),
13893 end(testCase.lcaseTags),
13894 m_tag) != end(testCase.lcaseTags);
13895 }
13896
13897 TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {}
13898 bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { return !m_underlyingPattern->matches( testCase ); }
13899
13900 bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const {
13901 // All patterns in a filter must match for the filter to be a match
13902 for( auto const& pattern : m_patterns ) {
13903 if( !pattern->matches( testCase ) )
13904 return false;
13905 }
13906 return true;
13907 }
13908
13909 bool TestSpec::hasFilters() const {
13910 return !m_filters.empty();
13911 }
13912 bool TestSpec::matches( TestCaseInfo const& testCase ) const {
13913 // A TestSpec matches if any filter matches
13914 for( auto const& filter : m_filters )
13915 if( filter.matches( testCase ) )
13916 return true;
13917 return false;
13918 }
13919 }
13920 // end catch_test_spec.cpp
13921 // start catch_test_spec_parser.cpp
13922
13923 namespace Catch {
13924
13925 TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {}
13926
13927 TestSpecParser& TestSpecParser::parse( std::string const& arg ) {
13928 m_mode = None;
13929 m_exclusion = false;
13930 m_start = std::string::npos;
13931 m_arg = m_tagAliases->expandAliases( arg );
13932 m_escapeChars.clear();
13933 for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )
13934 visitChar( m_arg[m_pos] );
13935 if( m_mode == Name )
13936 addPattern<TestSpec::NamePattern>();
13937 return *this;
13938 }
13939 TestSpec TestSpecParser::testSpec() {
13940 addFilter();
13941 return m_testSpec;
13942 }
13943
13944 void TestSpecParser::visitChar( char c ) {
13945 if( m_mode == None ) {
13946 switch( c ) {
13947 case ' ': return;
13948 case '~': m_exclusion = true; return;
13949 case '[': return startNewMode( Tag, ++m_pos );
13950 case '"': return startNewMode( QuotedName, ++m_pos );
13951 case '\\': return escape();
13952 default: startNewMode( Name, m_pos ); break;
13953 }
13954 }
13955 if( m_mode == Name ) {
13956 if( c == ',' ) {
13957 addPattern<TestSpec::NamePattern>();
13958 addFilter();
13959 }
13960 else if( c == '[' ) {
13961 if( subString() == "exclude:" )
13962 m_exclusion = true;
13963 else
13964 addPattern<TestSpec::NamePattern>();
13965 startNewMode( Tag, ++m_pos );
13966 }
13967 else if( c == '\\' )
13968 escape();
13969 }
13970 else if( m_mode == EscapedName )
13971 m_mode = Name;
13972 else if( m_mode == QuotedName && c == '"' )
13973 addPattern<TestSpec::NamePattern>();
13974 else if( m_mode == Tag && c == ']' )
13975 addPattern<TestSpec::TagPattern>();
13976 }
13977 void TestSpecParser::startNewMode( Mode mode, std::size_t start ) {
13978 m_mode = mode;
13979 m_start = start;
13980 }
13981 void TestSpecParser::escape() {
13982 if( m_mode == None )
13983 m_start = m_pos;
13984 m_mode = EscapedName;
13985 m_escapeChars.push_back( m_pos );
13986 }
13987 std::string TestSpecParser::subString() const { return m_arg.substr( m_start, m_pos - m_start ); }
13988
13989 void TestSpecParser::addFilter() {
13990 if( !m_currentFilter.m_patterns.empty() ) {
13991 m_testSpec.m_filters.push_back( m_currentFilter );
13992 m_currentFilter = TestSpec::Filter();
13993 }
13994 }
13995
13996 TestSpec parseTestSpec( std::string const& arg ) {
13997 return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec();
13998 }
13999
14000 } // namespace Catch
14001 // end catch_test_spec_parser.cpp
14002 // start catch_timer.cpp
14003
14004 #include <chrono>
14005
14006 static const uint64_t nanosecondsInSecond = 1000000000;
14007
14008 namespace Catch {
14009
14010 auto getCurrentNanosecondsSinceEpoch() -> uint64_t {
14011 return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
14012 }
14013
14014 namespace {
14015 auto estimateClockResolution() -> uint64_t {
14016 uint64_t sum = 0;
14017 static const uint64_t iterations = 1000000;
14018
14019 auto startTime = getCurrentNanosecondsSinceEpoch();
14020
14021 for( std::size_t i = 0; i < iterations; ++i ) {
14022
14023 uint64_t ticks;
14024 uint64_t baseTicks = getCurrentNanosecondsSinceEpoch();
14025 do {
14026 ticks = getCurrentNanosecondsSinceEpoch();
14027 } while( ticks == baseTicks );
14028
14029 auto delta = ticks - baseTicks;
14030 sum += delta;
14031
14032 // If we have been calibrating for over 3 seconds -- the clock
14033 // is terrible and we should move on.
14034 // TBD: How to signal that the measured resolution is probably wrong?
14035 if (ticks > startTime + 3 * nanosecondsInSecond) {
14036 return sum / ( i + 1u );
14037 }
14038 }
14039
14040 // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers
14041 // - and potentially do more iterations if there's a high variance.
14042 return sum/iterations;
14043 }
14044 }
14045 auto getEstimatedClockResolution() -> uint64_t {
14046 static auto s_resolution = estimateClockResolution();
14047 return s_resolution;
14048 }
14049
14050 void Timer::start() {
14051 m_nanoseconds = getCurrentNanosecondsSinceEpoch();
14052 }
14053 auto Timer::getElapsedNanoseconds() const -> uint64_t {
14054 return getCurrentNanosecondsSinceEpoch() - m_nanoseconds;
14055 }
14056 auto Timer::getElapsedMicroseconds() const -> uint64_t {
14057 return getElapsedNanoseconds()/1000;
14058 }
14059 auto Timer::getElapsedMilliseconds() const -> unsigned int {
14060 return static_cast<unsigned int>(getElapsedMicroseconds()/1000);
14061 }
14062 auto Timer::getElapsedSeconds() const -> double {
14063 return getElapsedMicroseconds()/1000000.0;
14064 }
14065
14066 } // namespace Catch
14067 // end catch_timer.cpp
14068 // start catch_tostring.cpp
14069
14070 #if defined(__clang__)
14071 # pragma clang diagnostic push
14072 # pragma clang diagnostic ignored "-Wexit-time-destructors"
14073 # pragma clang diagnostic ignored "-Wglobal-constructors"
14074 #endif
14075
14076 // Enable specific decls locally
14077 #if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
14078 #define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
14079 #endif
14080
14081 #include <cmath>
14082 #include <iomanip>
14083
14084 namespace Catch {
14085
14086 namespace Detail {
14087
14088 const std::string unprintableString = "{?}";
14089
14090 namespace {
14091 const int hexThreshold = 255;
14092
14093 struct Endianness {
14094 enum Arch { Big, Little };
14095
14096 static Arch which() {
14097 union _{
14098 int asInt;
14099 char asChar[sizeof (int)];
14100 } u;
14101
14102 u.asInt = 1;
14103 return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little;
14104 }
14105 };
14106 }
14107
14108 std::string rawMemoryToString( const void *object, std::size_t size ) {
14109 // Reverse order for little endian architectures
14110 int i = 0, end = static_cast<int>( size ), inc = 1;
14111 if( Endianness::which() == Endianness::Little ) {
14112 i = end-1;
14113 end = inc = -1;
14114 }
14115
14116 unsigned char const *bytes = static_cast<unsigned char const *>(object);
14117 ReusableStringStream rss;
14118 rss << "0x" << std::setfill('0') << std::hex;
14119 for( ; i != end; i += inc )
14120 rss << std::setw(2) << static_cast<unsigned>(bytes[i]);
14121 return rss.str();
14122 }
14123 }
14124
14125 template<typename T>
14126 std::string fpToString( T value, int precision ) {
14127 if (Catch::isnan(value)) {
14128 return "nan";
14129 }
14130
14131 ReusableStringStream rss;
14132 rss << std::setprecision( precision )
14133 << std::fixed
14134 << value;
14135 std::string d = rss.str();
14136 std::size_t i = d.find_last_not_of( '0' );
14137 if( i != std::string::npos && i != d.size()-1 ) {
14138 if( d[i] == '.' )
14139 i++;
14140 d = d.substr( 0, i+1 );
14141 }
14142 return d;
14143 }
14144
14145 //// ======================================================= ////
14146 //
14147 // Out-of-line defs for full specialization of StringMaker
14148 //
14149 //// ======================================================= ////
14150
14151 std::string StringMaker<std::string>::convert(const std::string& str) {
14152 if (!getCurrentContext().getConfig()->showInvisibles()) {
14153 return '"' + str + '"';
14154 }
14155
14156 std::string s("\"");
14157 for (char c : str) {
14158 switch (c) {
14159 case '\n':
14160 s.append("\\n");
14161 break;
14162 case '\t':
14163 s.append("\\t");
14164 break;
14165 default:
14166 s.push_back(c);
14167 break;
14168 }
14169 }
14170 s.append("\"");
14171 return s;
14172 }
14173
14174 #ifdef CATCH_CONFIG_CPP17_STRING_VIEW
14175 std::string StringMaker<std::string_view>::convert(std::string_view str) {
14176 return ::Catch::Detail::stringify(std::string{ str });
14177 }
14178 #endif
14179
14180 std::string StringMaker<char const*>::convert(char const* str) {
14181 if (str) {
14182 return ::Catch::Detail::stringify(std::string{ str });
14183 } else {
14184 return{ "{null string}" };
14185 }
14186 }
14187 std::string StringMaker<char*>::convert(char* str) {
14188 if (str) {
14189 return ::Catch::Detail::stringify(std::string{ str });
14190 } else {
14191 return{ "{null string}" };
14192 }
14193 }
14194
14195 #ifdef CATCH_CONFIG_WCHAR
14196 std::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {
14197 std::string s;
14198 s.reserve(wstr.size());
14199 for (auto c : wstr) {
14200 s += (c <= 0xff) ? static_cast<char>(c) : '?';
14201 }
14202 return ::Catch::Detail::stringify(s);
14203 }
14204
14205 # ifdef CATCH_CONFIG_CPP17_STRING_VIEW
14206 std::string StringMaker<std::wstring_view>::convert(std::wstring_view str) {
14207 return StringMaker<std::wstring>::convert(std::wstring(str));
14208 }
14209 # endif
14210
14211 std::string StringMaker<wchar_t const*>::convert(wchar_t const * str) {
14212 if (str) {
14213 return ::Catch::Detail::stringify(std::wstring{ str });
14214 } else {
14215 return{ "{null string}" };
14216 }
14217 }
14218 std::string StringMaker<wchar_t *>::convert(wchar_t * str) {
14219 if (str) {
14220 return ::Catch::Detail::stringify(std::wstring{ str });
14221 } else {
14222 return{ "{null string}" };
14223 }
14224 }
14225 #endif
14226
14227 std::string StringMaker<int>::convert(int value) {
14228 return ::Catch::Detail::stringify(static_cast<long long>(value));
14229 }
14230 std::string StringMaker<long>::convert(long value) {
14231 return ::Catch::Detail::stringify(static_cast<long long>(value));
14232 }
14233 std::string StringMaker<long long>::convert(long long value) {
14234 ReusableStringStream rss;
14235 rss << value;
14236 if (value > Detail::hexThreshold) {
14237 rss << " (0x" << std::hex << value << ')';
14238 }
14239 return rss.str();
14240 }
14241
14242 std::string StringMaker<unsigned int>::convert(unsigned int value) {
14243 return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));
14244 }
14245 std::string StringMaker<unsigned long>::convert(unsigned long value) {
14246 return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));
14247 }
14248 std::string StringMaker<unsigned long long>::convert(unsigned long long value) {
14249 ReusableStringStream rss;
14250 rss << value;
14251 if (value > Detail::hexThreshold) {
14252 rss << " (0x" << std::hex << value << ')';
14253 }
14254 return rss.str();
14255 }
14256
14257 std::string StringMaker<bool>::convert(bool b) {
14258 return b ? "true" : "false";
14259 }
14260
14261 std::string StringMaker<signed char>::convert(signed char value) {
14262 if (value == '\r') {
14263 return "'\\r'";
14264 } else if (value == '\f') {
14265 return "'\\f'";
14266 } else if (value == '\n') {
14267 return "'\\n'";
14268 } else if (value == '\t') {
14269 return "'\\t'";
14270 } else if ('\0' <= value && value < ' ') {
14271 return ::Catch::Detail::stringify(static_cast<unsigned int>(value));
14272 } else {
14273 char chstr[] = "' '";
14274 chstr[1] = value;
14275 return chstr;
14276 }
14277 }
14278 std::string StringMaker<char>::convert(char c) {
14279 return ::Catch::Detail::stringify(static_cast<signed char>(c));
14280 }
14281 std::string StringMaker<unsigned char>::convert(unsigned char c) {
14282 return ::Catch::Detail::stringify(static_cast<char>(c));
14283 }
14284
14285 std::string StringMaker<std::nullptr_t>::convert(std::nullptr_t) {
14286 return "nullptr";
14287 }
14288
14289 int StringMaker<float>::precision = 5;
14290
14291 std::string StringMaker<float>::convert(float value) {
14292 return fpToString(value, precision) + 'f';
14293 }
14294
14295 int StringMaker<double>::precision = 10;
14296
14297 std::string StringMaker<double>::convert(double value) {
14298 return fpToString(value, precision);
14299 }
14300
14301 std::string ratio_string<std::atto>::symbol() { return "a"; }
14302 std::string ratio_string<std::femto>::symbol() { return "f"; }
14303 std::string ratio_string<std::pico>::symbol() { return "p"; }
14304 std::string ratio_string<std::nano>::symbol() { return "n"; }
14305 std::string ratio_string<std::micro>::symbol() { return "u"; }
14306 std::string ratio_string<std::milli>::symbol() { return "m"; }
14307
14308 } // end namespace Catch
14309
14310 #if defined(__clang__)
14311 # pragma clang diagnostic pop
14312 #endif
14313
14314 // end catch_tostring.cpp
14315 // start catch_totals.cpp
14316
14317 namespace Catch {
14318
14319 Counts Counts::operator - ( Counts const& other ) const {
14320 Counts diff;
14321 diff.passed = passed - other.passed;
14322 diff.failed = failed - other.failed;
14323 diff.failedButOk = failedButOk - other.failedButOk;
14324 return diff;
14325 }
14326
14327 Counts& Counts::operator += ( Counts const& other ) {
14328 passed += other.passed;
14329 failed += other.failed;
14330 failedButOk += other.failedButOk;
14331 return *this;
14332 }
14333
14334 std::size_t Counts::total() const {
14335 return passed + failed + failedButOk;
14336 }
14337 bool Counts::allPassed() const {
14338 return failed == 0 && failedButOk == 0;
14339 }
14340 bool Counts::allOk() const {
14341 return failed == 0;
14342 }
14343
14344 Totals Totals::operator - ( Totals const& other ) const {
14345 Totals diff;
14346 diff.assertions = assertions - other.assertions;
14347 diff.testCases = testCases - other.testCases;
14348 return diff;
14349 }
14350
14351 Totals& Totals::operator += ( Totals const& other ) {
14352 assertions += other.assertions;
14353 testCases += other.testCases;
14354 return *this;
14355 }
14356
14357 Totals Totals::delta( Totals const& prevTotals ) const {
14358 Totals diff = *this - prevTotals;
14359 if( diff.assertions.failed > 0 )
14360 ++diff.testCases.failed;
14361 else if( diff.assertions.failedButOk > 0 )
14362 ++diff.testCases.failedButOk;
14363 else
14364 ++diff.testCases.passed;
14365 return diff;
14366 }
14367
14368 }
14369 // end catch_totals.cpp
14370 // start catch_uncaught_exceptions.cpp
14371
14372 #include <exception>
14373
14374 namespace Catch {
14375 bool uncaught_exceptions() {
14376 #if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
14377 return std::uncaught_exceptions() > 0;
14378 #else
14379 return std::uncaught_exception();
14380 #endif
14381 }
14382 } // end namespace Catch
14383 // end catch_uncaught_exceptions.cpp
14384 // start catch_version.cpp
14385
14386 #include <ostream>
14387
14388 namespace Catch {
14389
14390 Version::Version
14391 ( unsigned int _majorVersion,
14392 unsigned int _minorVersion,
14393 unsigned int _patchNumber,
14394 char const * const _branchName,
14395 unsigned int _buildNumber )
14396 : majorVersion( _majorVersion ),
14397 minorVersion( _minorVersion ),
14398 patchNumber( _patchNumber ),
14399 branchName( _branchName ),
14400 buildNumber( _buildNumber )
14401 {}
14402
14403 std::ostream& operator << ( std::ostream& os, Version const& version ) {
14404 os << version.majorVersion << '.'
14405 << version.minorVersion << '.'
14406 << version.patchNumber;
14407 // branchName is never null -> 0th char is \0 if it is empty
14408 if (version.branchName[0]) {
14409 os << '-' << version.branchName
14410 << '.' << version.buildNumber;
14411 }
14412 return os;
14413 }
14414
14415 Version const& libraryVersion() {
14416 static Version version( 2, 9, 1, "", 0 );
14417 return version;
14418 }
14419
14420 }
14421 // end catch_version.cpp
14422 // start catch_wildcard_pattern.cpp
14423
14424 #include <sstream>
14425
14426 namespace Catch {
14427
14428 WildcardPattern::WildcardPattern( std::string const& pattern,
14429 CaseSensitive::Choice caseSensitivity )
14430 : m_caseSensitivity( caseSensitivity ),
14431 m_pattern( adjustCase( pattern ) )
14432 {
14433 if( startsWith( m_pattern, '*' ) ) {
14434 m_pattern = m_pattern.substr( 1 );
14435 m_wildcard = WildcardAtStart;
14436 }
14437 if( endsWith( m_pattern, '*' ) ) {
14438 m_pattern = m_pattern.substr( 0, m_pattern.size()-1 );
14439 m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );
14440 }
14441 }
14442
14443 bool WildcardPattern::matches( std::string const& str ) const {
14444 switch( m_wildcard ) {
14445 case NoWildcard:
14446 return m_pattern == adjustCase( str );
14447 case WildcardAtStart:
14448 return endsWith( adjustCase( str ), m_pattern );
14449 case WildcardAtEnd:
14450 return startsWith( adjustCase( str ), m_pattern );
14451 case WildcardAtBothEnds:
14452 return contains( adjustCase( str ), m_pattern );
14453 default:
14454 CATCH_INTERNAL_ERROR( "Unknown enum" );
14455 }
14456 }
14457
14458 std::string WildcardPattern::adjustCase( std::string const& str ) const {
14459 return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str;
14460 }
14461 }
14462 // end catch_wildcard_pattern.cpp
14463 // start catch_xmlwriter.cpp
14464
14465 #include <iomanip>
14466
14467 using uchar = unsigned char;
14468
14469 namespace Catch {
14470
14471 namespace {
14472
14473 size_t trailingBytes(unsigned char c) {
14474 if ((c & 0xE0) == 0xC0) {
14475 return 2;
14476 }
14477 if ((c & 0xF0) == 0xE0) {
14478 return 3;
14479 }
14480 if ((c & 0xF8) == 0xF0) {
14481 return 4;
14482 }
14483 CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered");
14484 }
14485
14486 uint32_t headerValue(unsigned char c) {
14487 if ((c & 0xE0) == 0xC0) {
14488 return c & 0x1F;
14489 }
14490 if ((c & 0xF0) == 0xE0) {
14491 return c & 0x0F;
14492 }
14493 if ((c & 0xF8) == 0xF0) {
14494 return c & 0x07;
14495 }
14496 CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered");
14497 }
14498
14499 void hexEscapeChar(std::ostream& os, unsigned char c) {
14500 std::ios_base::fmtflags f(os.flags());
14501 os << "\\x"
14502 << std::uppercase << std::hex << std::setfill('0') << std::setw(2)
14503 << static_cast<int>(c);
14504 os.flags(f);
14505 }
14506
14507 } // anonymous namespace
14508
14509 XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat )
14510 : m_str( str ),
14511 m_forWhat( forWhat )
14512 {}
14513
14514 void XmlEncode::encodeTo( std::ostream& os ) const {
14515 // Apostrophe escaping not necessary if we always use " to write attributes
14516 // (see: http://www.w3.org/TR/xml/#syntax)
14517
14518 for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) {
14519 uchar c = m_str[idx];
14520 switch (c) {
14521 case '<': os << "&lt;"; break;
14522 case '&': os << "&amp;"; break;
14523
14524 case '>':
14525 // See: http://www.w3.org/TR/xml/#syntax
14526 if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']')
14527 os << "&gt;";
14528 else
14529 os << c;
14530 break;
14531
14532 case '\"':
14533 if (m_forWhat == ForAttributes)
14534 os << "&quot;";
14535 else
14536 os << c;
14537 break;
14538
14539 default:
14540 // Check for control characters and invalid utf-8
14541
14542 // Escape control characters in standard ascii
14543 // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0
14544 if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) {
14545 hexEscapeChar(os, c);
14546 break;
14547 }
14548
14549 // Plain ASCII: Write it to stream
14550 if (c < 0x7F) {
14551 os << c;
14552 break;
14553 }
14554
14555 // UTF-8 territory
14556 // Check if the encoding is valid and if it is not, hex escape bytes.
14557 // Important: We do not check the exact decoded values for validity, only the encoding format
14558 // First check that this bytes is a valid lead byte:
14559 // This means that it is not encoded as 1111 1XXX
14560 // Or as 10XX XXXX
14561 if (c < 0xC0 ||
14562 c >= 0xF8) {
14563 hexEscapeChar(os, c);
14564 break;
14565 }
14566
14567 auto encBytes = trailingBytes(c);
14568 // Are there enough bytes left to avoid accessing out-of-bounds memory?
14569 if (idx + encBytes - 1 >= m_str.size()) {
14570 hexEscapeChar(os, c);
14571 break;
14572 }
14573 // The header is valid, check data
14574 // The next encBytes bytes must together be a valid utf-8
14575 // This means: bitpattern 10XX XXXX and the extracted value is sane (ish)
14576 bool valid = true;
14577 uint32_t value = headerValue(c);
14578 for (std::size_t n = 1; n < encBytes; ++n) {
14579 uchar nc = m_str[idx + n];
14580 valid &= ((nc & 0xC0) == 0x80);
14581 value = (value << 6) | (nc & 0x3F);
14582 }
14583
14584 if (
14585 // Wrong bit pattern of following bytes
14586 (!valid) ||
14587 // Overlong encodings
14588 (value < 0x80) ||
14589 (0x80 <= value && value < 0x800 && encBytes > 2) ||
14590 (0x800 < value && value < 0x10000 && encBytes > 3) ||
14591 // Encoded value out of range
14592 (value >= 0x110000)
14593 ) {
14594 hexEscapeChar(os, c);
14595 break;
14596 }
14597
14598 // If we got here, this is in fact a valid(ish) utf-8 sequence
14599 for (std::size_t n = 0; n < encBytes; ++n) {
14600 os << m_str[idx + n];
14601 }
14602 idx += encBytes - 1;
14603 break;
14604 }
14605 }
14606 }
14607
14608 std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) {
14609 xmlEncode.encodeTo( os );
14610 return os;
14611 }
14612
14613 XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer )
14614 : m_writer( writer )
14615 {}
14616
14617 XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept
14618 : m_writer( other.m_writer ){
14619 other.m_writer = nullptr;
14620 }
14621 XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept {
14622 if ( m_writer ) {
14623 m_writer->endElement();
14624 }
14625 m_writer = other.m_writer;
14626 other.m_writer = nullptr;
14627 return *this;
14628 }
14629
14630 XmlWriter::ScopedElement::~ScopedElement() {
14631 if( m_writer )
14632 m_writer->endElement();
14633 }
14634
14635 XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) {
14636 m_writer->writeText( text, indent );
14637 return *this;
14638 }
14639
14640 XmlWriter::XmlWriter( std::ostream& os ) : m_os( os )
14641 {
14642 writeDeclaration();
14643 }
14644
14645 XmlWriter::~XmlWriter() {
14646 while( !m_tags.empty() )
14647 endElement();
14648 }
14649
14650 XmlWriter& XmlWriter::startElement( std::string const& name ) {
14651 ensureTagClosed();
14652 newlineIfNecessary();
14653 m_os << m_indent << '<' << name;
14654 m_tags.push_back( name );
14655 m_indent += " ";
14656 m_tagIsOpen = true;
14657 return *this;
14658 }
14659
14660 XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) {
14661 ScopedElement scoped( this );
14662 startElement( name );
14663 return scoped;
14664 }
14665
14666 XmlWriter& XmlWriter::endElement() {
14667 newlineIfNecessary();
14668 m_indent = m_indent.substr( 0, m_indent.size()-2 );
14669 if( m_tagIsOpen ) {
14670 m_os << "/>";
14671 m_tagIsOpen = false;
14672 }
14673 else {
14674 m_os << m_indent << "</" << m_tags.back() << ">";
14675 }
14676 m_os << std::endl;
14677 m_tags.pop_back();
14678 return *this;
14679 }
14680
14681 XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) {
14682 if( !name.empty() && !attribute.empty() )
14683 m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"';
14684 return *this;
14685 }
14686
14687 XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) {
14688 m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"';
14689 return *this;
14690 }
14691
14692 XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) {
14693 if( !text.empty() ){
14694 bool tagWasOpen = m_tagIsOpen;
14695 ensureTagClosed();
14696 if( tagWasOpen && indent )
14697 m_os << m_indent;
14698 m_os << XmlEncode( text );
14699 m_needsNewline = true;
14700 }
14701 return *this;
14702 }
14703
14704 XmlWriter& XmlWriter::writeComment( std::string const& text ) {
14705 ensureTagClosed();
14706 m_os << m_indent << "<!--" << text << "-->";
14707 m_needsNewline = true;
14708 return *this;
14709 }
14710
14711 void XmlWriter::writeStylesheetRef( std::string const& url ) {
14712 m_os << "<?xml-stylesheet type=\"text/xsl\" href=\"" << url << "\"?>\n";
14713 }
14714
14715 XmlWriter& XmlWriter::writeBlankLine() {
14716 ensureTagClosed();
14717 m_os << '\n';
14718 return *this;
14719 }
14720
14721 void XmlWriter::ensureTagClosed() {
14722 if( m_tagIsOpen ) {
14723 m_os << ">" << std::endl;
14724 m_tagIsOpen = false;
14725 }
14726 }
14727
14728 void XmlWriter::writeDeclaration() {
14729 m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
14730 }
14731
14732 void XmlWriter::newlineIfNecessary() {
14733 if( m_needsNewline ) {
14734 m_os << std::endl;
14735 m_needsNewline = false;
14736 }
14737 }
14738 }
14739 // end catch_xmlwriter.cpp
14740 // start catch_reporter_bases.cpp
14741
14742 #include <cstring>
14743 #include <cfloat>
14744 #include <cstdio>
14745 #include <cassert>
14746 #include <memory>
14747
14748 namespace Catch {
14749 void prepareExpandedExpression(AssertionResult& result) {
14750 result.getExpandedExpression();
14751 }
14752
14753 // Because formatting using c++ streams is stateful, drop down to C is required
14754 // Alternatively we could use stringstream, but its performance is... not good.
14755 std::string getFormattedDuration( double duration ) {
14756 // Max exponent + 1 is required to represent the whole part
14757 // + 1 for decimal point
14758 // + 3 for the 3 decimal places
14759 // + 1 for null terminator
14760 const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
14761 char buffer[maxDoubleSize];
14762
14763 // Save previous errno, to prevent sprintf from overwriting it
14764 ErrnoGuard guard;
14765 #ifdef _MSC_VER
14766 sprintf_s(buffer, "%.3f", duration);
14767 #else
14768 std::sprintf(buffer, "%.3f", duration);
14769 #endif
14770 return std::string(buffer);
14771 }
14772
14773 std::string serializeFilters( std::vector<std::string> const& container ) {
14774 ReusableStringStream oss;
14775 bool first = true;
14776 for (auto&& filter : container)
14777 {
14778 if (!first)
14779 oss << ' ';
14780 else
14781 first = false;
14782
14783 oss << filter;
14784 }
14785 return oss.str();
14786 }
14787
14788 TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config)
14789 :StreamingReporterBase(_config) {}
14790
14791 std::set<Verbosity> TestEventListenerBase::getSupportedVerbosities() {
14792 return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High };
14793 }
14794
14795 void TestEventListenerBase::assertionStarting(AssertionInfo const &) {}
14796
14797 bool TestEventListenerBase::assertionEnded(AssertionStats const &) {
14798 return false;
14799 }
14800
14801 } // end namespace Catch
14802 // end catch_reporter_bases.cpp
14803 // start catch_reporter_compact.cpp
14804
14805 namespace {
14806
14807 #ifdef CATCH_PLATFORM_MAC
14808 const char* failedString() { return "FAILED"; }
14809 const char* passedString() { return "PASSED"; }
14810 #else
14811 const char* failedString() { return "failed"; }
14812 const char* passedString() { return "passed"; }
14813 #endif
14814
14815 // Colour::LightGrey
14816 Catch::Colour::Code dimColour() { return Catch::Colour::FileName; }
14817
14818 std::string bothOrAll( std::size_t count ) {
14819 return count == 1 ? std::string() :
14820 count == 2 ? "both " : "all " ;
14821 }
14822
14823 } // anon namespace
14824
14825 namespace Catch {
14826 namespace {
14827 // Colour, message variants:
14828 // - white: No tests ran.
14829 // - red: Failed [both/all] N test cases, failed [both/all] M assertions.
14830 // - white: Passed [both/all] N test cases (no assertions).
14831 // - red: Failed N tests cases, failed M assertions.
14832 // - green: Passed [both/all] N tests cases with M assertions.
14833 void printTotals(std::ostream& out, const Totals& totals) {
14834 if (totals.testCases.total() == 0) {
14835 out << "No tests ran.";
14836 } else if (totals.testCases.failed == totals.testCases.total()) {
14837 Colour colour(Colour::ResultError);
14838 const std::string qualify_assertions_failed =
14839 totals.assertions.failed == totals.assertions.total() ?
14840 bothOrAll(totals.assertions.failed) : std::string();
14841 out <<
14842 "Failed " << bothOrAll(totals.testCases.failed)
14843 << pluralise(totals.testCases.failed, "test case") << ", "
14844 "failed " << qualify_assertions_failed <<
14845 pluralise(totals.assertions.failed, "assertion") << '.';
14846 } else if (totals.assertions.total() == 0) {
14847 out <<
14848 "Passed " << bothOrAll(totals.testCases.total())
14849 << pluralise(totals.testCases.total(), "test case")
14850 << " (no assertions).";
14851 } else if (totals.assertions.failed) {
14852 Colour colour(Colour::ResultError);
14853 out <<
14854 "Failed " << pluralise(totals.testCases.failed, "test case") << ", "
14855 "failed " << pluralise(totals.assertions.failed, "assertion") << '.';
14856 } else {
14857 Colour colour(Colour::ResultSuccess);
14858 out <<
14859 "Passed " << bothOrAll(totals.testCases.passed)
14860 << pluralise(totals.testCases.passed, "test case") <<
14861 " with " << pluralise(totals.assertions.passed, "assertion") << '.';
14862 }
14863 }
14864
14865 // Implementation of CompactReporter formatting
14866 class AssertionPrinter {
14867 public:
14868 AssertionPrinter& operator= (AssertionPrinter const&) = delete;
14869 AssertionPrinter(AssertionPrinter const&) = delete;
14870 AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)
14871 : stream(_stream)
14872 , result(_stats.assertionResult)
14873 , messages(_stats.infoMessages)
14874 , itMessage(_stats.infoMessages.begin())
14875 , printInfoMessages(_printInfoMessages) {}
14876
14877 void print() {
14878 printSourceInfo();
14879
14880 itMessage = messages.begin();
14881
14882 switch (result.getResultType()) {
14883 case ResultWas::Ok:
14884 printResultType(Colour::ResultSuccess, passedString());
14885 printOriginalExpression();
14886 printReconstructedExpression();
14887 if (!result.hasExpression())
14888 printRemainingMessages(Colour::None);
14889 else
14890 printRemainingMessages();
14891 break;
14892 case ResultWas::ExpressionFailed:
14893 if (result.isOk())
14894 printResultType(Colour::ResultSuccess, failedString() + std::string(" - but was ok"));
14895 else
14896 printResultType(Colour::Error, failedString());
14897 printOriginalExpression();
14898 printReconstructedExpression();
14899 printRemainingMessages();
14900 break;
14901 case ResultWas::ThrewException:
14902 printResultType(Colour::Error, failedString());
14903 printIssue("unexpected exception with message:");
14904 printMessage();
14905 printExpressionWas();
14906 printRemainingMessages();
14907 break;
14908 case ResultWas::FatalErrorCondition:
14909 printResultType(Colour::Error, failedString());
14910 printIssue("fatal error condition with message:");
14911 printMessage();
14912 printExpressionWas();
14913 printRemainingMessages();
14914 break;
14915 case ResultWas::DidntThrowException:
14916 printResultType(Colour::Error, failedString());
14917 printIssue("expected exception, got none");
14918 printExpressionWas();
14919 printRemainingMessages();
14920 break;
14921 case ResultWas::Info:
14922 printResultType(Colour::None, "info");
14923 printMessage();
14924 printRemainingMessages();
14925 break;
14926 case ResultWas::Warning:
14927 printResultType(Colour::None, "warning");
14928 printMessage();
14929 printRemainingMessages();
14930 break;
14931 case ResultWas::ExplicitFailure:
14932 printResultType(Colour::Error, failedString());
14933 printIssue("explicitly");
14934 printRemainingMessages(Colour::None);
14935 break;
14936 // These cases are here to prevent compiler warnings
14937 case ResultWas::Unknown:
14938 case ResultWas::FailureBit:
14939 case ResultWas::Exception:
14940 printResultType(Colour::Error, "** internal error **");
14941 break;
14942 }
14943 }
14944
14945 private:
14946 void printSourceInfo() const {
14947 Colour colourGuard(Colour::FileName);
14948 stream << result.getSourceInfo() << ':';
14949 }
14950
14951 void printResultType(Colour::Code colour, std::string const& passOrFail) const {
14952 if (!passOrFail.empty()) {
14953 {
14954 Colour colourGuard(colour);
14955 stream << ' ' << passOrFail;
14956 }
14957 stream << ':';
14958 }
14959 }
14960
14961 void printIssue(std::string const& issue) const {
14962 stream << ' ' << issue;
14963 }
14964
14965 void printExpressionWas() {
14966 if (result.hasExpression()) {
14967 stream << ';';
14968 {
14969 Colour colour(dimColour());
14970 stream << " expression was:";
14971 }
14972 printOriginalExpression();
14973 }
14974 }
14975
14976 void printOriginalExpression() const {
14977 if (result.hasExpression()) {
14978 stream << ' ' << result.getExpression();
14979 }
14980 }
14981
14982 void printReconstructedExpression() const {
14983 if (result.hasExpandedExpression()) {
14984 {
14985 Colour colour(dimColour());
14986 stream << " for: ";
14987 }
14988 stream << result.getExpandedExpression();
14989 }
14990 }
14991
14992 void printMessage() {
14993 if (itMessage != messages.end()) {
14994 stream << " '" << itMessage->message << '\'';
14995 ++itMessage;
14996 }
14997 }
14998
14999 void printRemainingMessages(Colour::Code colour = dimColour()) {
15000 if (itMessage == messages.end())
15001 return;
15002
15003 // using messages.end() directly yields (or auto) compilation error:
15004 std::vector<MessageInfo>::const_iterator itEnd = messages.end();
15005 const std::size_t N = static_cast<std::size_t>(std::distance(itMessage, itEnd));
15006
15007 {
15008 Colour colourGuard(colour);
15009 stream << " with " << pluralise(N, "message") << ':';
15010 }
15011
15012 for (; itMessage != itEnd; ) {
15013 // If this assertion is a warning ignore any INFO messages
15014 if (printInfoMessages || itMessage->type != ResultWas::Info) {
15015 stream << " '" << itMessage->message << '\'';
15016 if (++itMessage != itEnd) {
15017 Colour colourGuard(dimColour());
15018 stream << " and";
15019 }
15020 }
15021 }
15022 }
15023
15024 private:
15025 std::ostream& stream;
15026 AssertionResult const& result;
15027 std::vector<MessageInfo> messages;
15028 std::vector<MessageInfo>::const_iterator itMessage;
15029 bool printInfoMessages;
15030 };
15031
15032 } // anon namespace
15033
15034 std::string CompactReporter::getDescription() {
15035 return "Reports test results on a single line, suitable for IDEs";
15036 }
15037
15038 ReporterPreferences CompactReporter::getPreferences() const {
15039 return m_reporterPrefs;
15040 }
15041
15042 void CompactReporter::noMatchingTestCases( std::string const& spec ) {
15043 stream << "No test cases matched '" << spec << '\'' << std::endl;
15044 }
15045
15046 void CompactReporter::assertionStarting( AssertionInfo const& ) {}
15047
15048 bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {
15049 AssertionResult const& result = _assertionStats.assertionResult;
15050
15051 bool printInfoMessages = true;
15052
15053 // Drop out if result was successful and we're not printing those
15054 if( !m_config->includeSuccessfulResults() && result.isOk() ) {
15055 if( result.getResultType() != ResultWas::Warning )
15056 return false;
15057 printInfoMessages = false;
15058 }
15059
15060 AssertionPrinter printer( stream, _assertionStats, printInfoMessages );
15061 printer.print();
15062
15063 stream << std::endl;
15064 return true;
15065 }
15066
15067 void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {
15068 if (m_config->showDurations() == ShowDurations::Always) {
15069 stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
15070 }
15071 }
15072
15073 void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) {
15074 printTotals( stream, _testRunStats.totals );
15075 stream << '\n' << std::endl;
15076 StreamingReporterBase::testRunEnded( _testRunStats );
15077 }
15078
15079 CompactReporter::~CompactReporter() {}
15080
15081 CATCH_REGISTER_REPORTER( "compact", CompactReporter )
15082
15083 } // end namespace Catch
15084 // end catch_reporter_compact.cpp
15085 // start catch_reporter_console.cpp
15086
15087 #include <cfloat>
15088 #include <cstdio>
15089
15090 #if defined(_MSC_VER)
15091 #pragma warning(push)
15092 #pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
15093 // Note that 4062 (not all labels are handled and default is missing) is enabled
15094 #endif
15095
15096 #if defined(__clang__)
15097 # pragma clang diagnostic push
15098 // For simplicity, benchmarking-only helpers are always enabled
15099 # pragma clang diagnostic ignored "-Wunused-function"
15100 #endif
15101
15102 namespace Catch {
15103
15104 namespace {
15105
15106 // Formatter impl for ConsoleReporter
15107 class ConsoleAssertionPrinter {
15108 public:
15109 ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete;
15110 ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete;
15111 ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)
15112 : stream(_stream),
15113 stats(_stats),
15114 result(_stats.assertionResult),
15115 colour(Colour::None),
15116 message(result.getMessage()),
15117 messages(_stats.infoMessages),
15118 printInfoMessages(_printInfoMessages) {
15119 switch (result.getResultType()) {
15120 case ResultWas::Ok:
15121 colour = Colour::Success;
15122 passOrFail = "PASSED";
15123 //if( result.hasMessage() )
15124 if (_stats.infoMessages.size() == 1)
15125 messageLabel = "with message";
15126 if (_stats.infoMessages.size() > 1)
15127 messageLabel = "with messages";
15128 break;
15129 case ResultWas::ExpressionFailed:
15130 if (result.isOk()) {
15131 colour = Colour::Success;
15132 passOrFail = "FAILED - but was ok";
15133 } else {
15134 colour = Colour::Error;
15135 passOrFail = "FAILED";
15136 }
15137 if (_stats.infoMessages.size() == 1)
15138 messageLabel = "with message";
15139 if (_stats.infoMessages.size() > 1)
15140 messageLabel = "with messages";
15141 break;
15142 case ResultWas::ThrewException:
15143 colour = Colour::Error;
15144 passOrFail = "FAILED";
15145 messageLabel = "due to unexpected exception with ";
15146 if (_stats.infoMessages.size() == 1)
15147 messageLabel += "message";
15148 if (_stats.infoMessages.size() > 1)
15149 messageLabel += "messages";
15150 break;
15151 case ResultWas::FatalErrorCondition:
15152 colour = Colour::Error;
15153 passOrFail = "FAILED";
15154 messageLabel = "due to a fatal error condition";
15155 break;
15156 case ResultWas::DidntThrowException:
15157 colour = Colour::Error;
15158 passOrFail = "FAILED";
15159 messageLabel = "because no exception was thrown where one was expected";
15160 break;
15161 case ResultWas::Info:
15162 messageLabel = "info";
15163 break;
15164 case ResultWas::Warning:
15165 messageLabel = "warning";
15166 break;
15167 case ResultWas::ExplicitFailure:
15168 passOrFail = "FAILED";
15169 colour = Colour::Error;
15170 if (_stats.infoMessages.size() == 1)
15171 messageLabel = "explicitly with message";
15172 if (_stats.infoMessages.size() > 1)
15173 messageLabel = "explicitly with messages";
15174 break;
15175 // These cases are here to prevent compiler warnings
15176 case ResultWas::Unknown:
15177 case ResultWas::FailureBit:
15178 case ResultWas::Exception:
15179 passOrFail = "** internal error **";
15180 colour = Colour::Error;
15181 break;
15182 }
15183 }
15184
15185 void print() const {
15186 printSourceInfo();
15187 if (stats.totals.assertions.total() > 0) {
15188 printResultType();
15189 printOriginalExpression();
15190 printReconstructedExpression();
15191 } else {
15192 stream << '\n';
15193 }
15194 printMessage();
15195 }
15196
15197 private:
15198 void printResultType() const {
15199 if (!passOrFail.empty()) {
15200 Colour colourGuard(colour);
15201 stream << passOrFail << ":\n";
15202 }
15203 }
15204 void printOriginalExpression() const {
15205 if (result.hasExpression()) {
15206 Colour colourGuard(Colour::OriginalExpression);
15207 stream << " ";
15208 stream << result.getExpressionInMacro();
15209 stream << '\n';
15210 }
15211 }
15212 void printReconstructedExpression() const {
15213 if (result.hasExpandedExpression()) {
15214 stream << "with expansion:\n";
15215 Colour colourGuard(Colour::ReconstructedExpression);
15216 stream << Column(result.getExpandedExpression()).indent(2) << '\n';
15217 }
15218 }
15219 void printMessage() const {
15220 if (!messageLabel.empty())
15221 stream << messageLabel << ':' << '\n';
15222 for (auto const& msg : messages) {
15223 // If this assertion is a warning ignore any INFO messages
15224 if (printInfoMessages || msg.type != ResultWas::Info)
15225 stream << Column(msg.message).indent(2) << '\n';
15226 }
15227 }
15228 void printSourceInfo() const {
15229 Colour colourGuard(Colour::FileName);
15230 stream << result.getSourceInfo() << ": ";
15231 }
15232
15233 std::ostream& stream;
15234 AssertionStats const& stats;
15235 AssertionResult const& result;
15236 Colour::Code colour;
15237 std::string passOrFail;
15238 std::string messageLabel;
15239 std::string message;
15240 std::vector<MessageInfo> messages;
15241 bool printInfoMessages;
15242 };
15243
15244 std::size_t makeRatio(std::size_t number, std::size_t total) {
15245 std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0;
15246 return (ratio == 0 && number > 0) ? 1 : ratio;
15247 }
15248
15249 std::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) {
15250 if (i > j && i > k)
15251 return i;
15252 else if (j > k)
15253 return j;
15254 else
15255 return k;
15256 }
15257
15258 struct ColumnInfo {
15259 enum Justification { Left, Right };
15260 std::string name;
15261 int width;
15262 Justification justification;
15263 };
15264 struct ColumnBreak {};
15265 struct RowBreak {};
15266
15267 class Duration {
15268 enum class Unit {
15269 Auto,
15270 Nanoseconds,
15271 Microseconds,
15272 Milliseconds,
15273 Seconds,
15274 Minutes
15275 };
15276 static const uint64_t s_nanosecondsInAMicrosecond = 1000;
15277 static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond;
15278 static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond;
15279 static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond;
15280
15281 uint64_t m_inNanoseconds;
15282 Unit m_units;
15283
15284 public:
15285 explicit Duration(double inNanoseconds, Unit units = Unit::Auto)
15286 : Duration(static_cast<uint64_t>(inNanoseconds), units) {
15287 }
15288
15289 explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto)
15290 : m_inNanoseconds(inNanoseconds),
15291 m_units(units) {
15292 if (m_units == Unit::Auto) {
15293 if (m_inNanoseconds < s_nanosecondsInAMicrosecond)
15294 m_units = Unit::Nanoseconds;
15295 else if (m_inNanoseconds < s_nanosecondsInAMillisecond)
15296 m_units = Unit::Microseconds;
15297 else if (m_inNanoseconds < s_nanosecondsInASecond)
15298 m_units = Unit::Milliseconds;
15299 else if (m_inNanoseconds < s_nanosecondsInAMinute)
15300 m_units = Unit::Seconds;
15301 else
15302 m_units = Unit::Minutes;
15303 }
15304
15305 }
15306
15307 auto value() const -> double {
15308 switch (m_units) {
15309 case Unit::Microseconds:
15310 return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMicrosecond);
15311 case Unit::Milliseconds:
15312 return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMillisecond);
15313 case Unit::Seconds:
15314 return m_inNanoseconds / static_cast<double>(s_nanosecondsInASecond);
15315 case Unit::Minutes:
15316 return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMinute);
15317 default:
15318 return static_cast<double>(m_inNanoseconds);
15319 }
15320 }
15321 auto unitsAsString() const -> std::string {
15322 switch (m_units) {
15323 case Unit::Nanoseconds:
15324 return "ns";
15325 case Unit::Microseconds:
15326 return "us";
15327 case Unit::Milliseconds:
15328 return "ms";
15329 case Unit::Seconds:
15330 return "s";
15331 case Unit::Minutes:
15332 return "m";
15333 default:
15334 return "** internal error **";
15335 }
15336
15337 }
15338 friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& {
15339 return os << duration.value() << " " << duration.unitsAsString();
15340 }
15341 };
15342 } // end anon namespace
15343
15344 class TablePrinter {
15345 std::ostream& m_os;
15346 std::vector<ColumnInfo> m_columnInfos;
15347 std::ostringstream m_oss;
15348 int m_currentColumn = -1;
15349 bool m_isOpen = false;
15350
15351 public:
15352 TablePrinter( std::ostream& os, std::vector<ColumnInfo> columnInfos )
15353 : m_os( os ),
15354 m_columnInfos( std::move( columnInfos ) ) {}
15355
15356 auto columnInfos() const -> std::vector<ColumnInfo> const& {
15357 return m_columnInfos;
15358 }
15359
15360 void open() {
15361 if (!m_isOpen) {
15362 m_isOpen = true;
15363 *this << RowBreak();
15364
15365 Columns headerCols;
15366 Spacer spacer(2);
15367 for (auto const& info : m_columnInfos) {
15368 headerCols += Column(info.name).width(static_cast<std::size_t>(info.width - 2));
15369 headerCols += spacer;
15370 }
15371 m_os << headerCols << "\n";
15372
15373 m_os << Catch::getLineOfChars<'-'>() << "\n";
15374 }
15375 }
15376 void close() {
15377 if (m_isOpen) {
15378 *this << RowBreak();
15379 m_os << std::endl;
15380 m_isOpen = false;
15381 }
15382 }
15383
15384 template<typename T>
15385 friend TablePrinter& operator << (TablePrinter& tp, T const& value) {
15386 tp.m_oss << value;
15387 return tp;
15388 }
15389
15390 friend TablePrinter& operator << (TablePrinter& tp, ColumnBreak) {
15391 auto colStr = tp.m_oss.str();
15392 // This takes account of utf8 encodings
15393 auto strSize = Catch::StringRef(colStr).numberOfCharacters();
15394 tp.m_oss.str("");
15395 tp.open();
15396 if (tp.m_currentColumn == static_cast<int>(tp.m_columnInfos.size() - 1)) {
15397 tp.m_currentColumn = -1;
15398 tp.m_os << "\n";
15399 }
15400 tp.m_currentColumn++;
15401
15402 auto colInfo = tp.m_columnInfos[tp.m_currentColumn];
15403 auto padding = (strSize + 2 < static_cast<std::size_t>(colInfo.width))
15404 ? std::string(colInfo.width - (strSize + 2), ' ')
15405 : std::string();
15406 if (colInfo.justification == ColumnInfo::Left)
15407 tp.m_os << colStr << padding << " ";
15408 else
15409 tp.m_os << padding << colStr << " ";
15410 return tp;
15411 }
15412
15413 friend TablePrinter& operator << (TablePrinter& tp, RowBreak) {
15414 if (tp.m_currentColumn > 0) {
15415 tp.m_os << "\n";
15416 tp.m_currentColumn = -1;
15417 }
15418 return tp;
15419 }
15420 };
15421
15422 ConsoleReporter::ConsoleReporter(ReporterConfig const& config)
15423 : StreamingReporterBase(config),
15424 m_tablePrinter(new TablePrinter(config.stream(),
15425 {
15426 { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 32, ColumnInfo::Left },
15427 { "samples mean std dev", 14, ColumnInfo::Right },
15428 { "iterations low mean low std dev", 14, ColumnInfo::Right },
15429 { "estimated high mean high std dev", 14, ColumnInfo::Right }
15430 })) {}
15431 ConsoleReporter::~ConsoleReporter() = default;
15432
15433 std::string ConsoleReporter::getDescription() {
15434 return "Reports test results as plain lines of text";
15435 }
15436
15437 void ConsoleReporter::noMatchingTestCases(std::string const& spec) {
15438 stream << "No test cases matched '" << spec << '\'' << std::endl;
15439 }
15440
15441 void ConsoleReporter::assertionStarting(AssertionInfo const&) {}
15442
15443 bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) {
15444 AssertionResult const& result = _assertionStats.assertionResult;
15445
15446 bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
15447
15448 // Drop out if result was successful but we're not printing them.
15449 if (!includeResults && result.getResultType() != ResultWas::Warning)
15450 return false;
15451
15452 lazyPrint();
15453
15454 ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults);
15455 printer.print();
15456 stream << std::endl;
15457 return true;
15458 }
15459
15460 void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) {
15461 m_tablePrinter->close();
15462 m_headerPrinted = false;
15463 StreamingReporterBase::sectionStarting(_sectionInfo);
15464 }
15465 void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
15466 m_tablePrinter->close();
15467 if (_sectionStats.missingAssertions) {
15468 lazyPrint();
15469 Colour colour(Colour::ResultError);
15470 if (m_sectionStack.size() > 1)
15471 stream << "\nNo assertions in section";
15472 else
15473 stream << "\nNo assertions in test case";
15474 stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
15475 }
15476 if (m_config->showDurations() == ShowDurations::Always) {
15477 stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
15478 }
15479 if (m_headerPrinted) {
15480 m_headerPrinted = false;
15481 }
15482 StreamingReporterBase::sectionEnded(_sectionStats);
15483 }
15484
15485 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
15486 void ConsoleReporter::benchmarkPreparing(std::string const& name) {
15487 lazyPrintWithoutClosingBenchmarkTable();
15488
15489 auto nameCol = Column(name).width(static_cast<std::size_t>(m_tablePrinter->columnInfos()[0].width - 2));
15490
15491 bool firstLine = true;
15492 for (auto line : nameCol) {
15493 if (!firstLine)
15494 (*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak();
15495 else
15496 firstLine = false;
15497
15498 (*m_tablePrinter) << line << ColumnBreak();
15499 }
15500 }
15501
15502 void ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) {
15503 (*m_tablePrinter) << info.samples << ColumnBreak()
15504 << info.iterations << ColumnBreak()
15505 << Duration(info.estimatedDuration) << ColumnBreak();
15506 }
15507 void ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) {
15508 (*m_tablePrinter) << ColumnBreak()
15509 << Duration(stats.mean.point.count()) << ColumnBreak()
15510 << Duration(stats.mean.lower_bound.count()) << ColumnBreak()
15511 << Duration(stats.mean.upper_bound.count()) << ColumnBreak() << ColumnBreak()
15512 << Duration(stats.standardDeviation.point.count()) << ColumnBreak()
15513 << Duration(stats.standardDeviation.lower_bound.count()) << ColumnBreak()
15514 << Duration(stats.standardDeviation.upper_bound.count()) << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak();
15515 }
15516
15517 void ConsoleReporter::benchmarkFailed(std::string const& error) {
15518 Colour colour(Colour::Red);
15519 (*m_tablePrinter)
15520 << "Benchmark failed (" << error << ")"
15521 << ColumnBreak() << RowBreak();
15522 }
15523 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
15524
15525 void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) {
15526 m_tablePrinter->close();
15527 StreamingReporterBase::testCaseEnded(_testCaseStats);
15528 m_headerPrinted = false;
15529 }
15530 void ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) {
15531 if (currentGroupInfo.used) {
15532 printSummaryDivider();
15533 stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n";
15534 printTotals(_testGroupStats.totals);
15535 stream << '\n' << std::endl;
15536 }
15537 StreamingReporterBase::testGroupEnded(_testGroupStats);
15538 }
15539 void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {
15540 printTotalsDivider(_testRunStats.totals);
15541 printTotals(_testRunStats.totals);
15542 stream << std::endl;
15543 StreamingReporterBase::testRunEnded(_testRunStats);
15544 }
15545 void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) {
15546 StreamingReporterBase::testRunStarting(_testInfo);
15547 printTestFilters();
15548 }
15549
15550 void ConsoleReporter::lazyPrint() {
15551
15552 m_tablePrinter->close();
15553 lazyPrintWithoutClosingBenchmarkTable();
15554 }
15555
15556 void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() {
15557
15558 if (!currentTestRunInfo.used)
15559 lazyPrintRunInfo();
15560 if (!currentGroupInfo.used)
15561 lazyPrintGroupInfo();
15562
15563 if (!m_headerPrinted) {
15564 printTestCaseAndSectionHeader();
15565 m_headerPrinted = true;
15566 }
15567 }
15568 void ConsoleReporter::lazyPrintRunInfo() {
15569 stream << '\n' << getLineOfChars<'~'>() << '\n';
15570 Colour colour(Colour::SecondaryText);
15571 stream << currentTestRunInfo->name
15572 << " is a Catch v" << libraryVersion() << " host application.\n"
15573 << "Run with -? for options\n\n";
15574
15575 if (m_config->rngSeed() != 0)
15576 stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n";
15577
15578 currentTestRunInfo.used = true;
15579 }
15580 void ConsoleReporter::lazyPrintGroupInfo() {
15581 if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) {
15582 printClosedHeader("Group: " + currentGroupInfo->name);
15583 currentGroupInfo.used = true;
15584 }
15585 }
15586 void ConsoleReporter::printTestCaseAndSectionHeader() {
15587 assert(!m_sectionStack.empty());
15588 printOpenHeader(currentTestCaseInfo->name);
15589
15590 if (m_sectionStack.size() > 1) {
15591 Colour colourGuard(Colour::Headers);
15592
15593 auto
15594 it = m_sectionStack.begin() + 1, // Skip first section (test case)
15595 itEnd = m_sectionStack.end();
15596 for (; it != itEnd; ++it)
15597 printHeaderString(it->name, 2);
15598 }
15599
15600 SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;
15601
15602 if (!lineInfo.empty()) {
15603 stream << getLineOfChars<'-'>() << '\n';
15604 Colour colourGuard(Colour::FileName);
15605 stream << lineInfo << '\n';
15606 }
15607 stream << getLineOfChars<'.'>() << '\n' << std::endl;
15608 }
15609
15610 void ConsoleReporter::printClosedHeader(std::string const& _name) {
15611 printOpenHeader(_name);
15612 stream << getLineOfChars<'.'>() << '\n';
15613 }
15614 void ConsoleReporter::printOpenHeader(std::string const& _name) {
15615 stream << getLineOfChars<'-'>() << '\n';
15616 {
15617 Colour colourGuard(Colour::Headers);
15618 printHeaderString(_name);
15619 }
15620 }
15621
15622 // if string has a : in first line will set indent to follow it on
15623 // subsequent lines
15624 void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) {
15625 std::size_t i = _string.find(": ");
15626 if (i != std::string::npos)
15627 i += 2;
15628 else
15629 i = 0;
15630 stream << Column(_string).indent(indent + i).initialIndent(indent) << '\n';
15631 }
15632
15633 struct SummaryColumn {
15634
15635 SummaryColumn( std::string _label, Colour::Code _colour )
15636 : label( std::move( _label ) ),
15637 colour( _colour ) {}
15638 SummaryColumn addRow( std::size_t count ) {
15639 ReusableStringStream rss;
15640 rss << count;
15641 std::string row = rss.str();
15642 for (auto& oldRow : rows) {
15643 while (oldRow.size() < row.size())
15644 oldRow = ' ' + oldRow;
15645 while (oldRow.size() > row.size())
15646 row = ' ' + row;
15647 }
15648 rows.push_back(row);
15649 return *this;
15650 }
15651
15652 std::string label;
15653 Colour::Code colour;
15654 std::vector<std::string> rows;
15655
15656 };
15657
15658 void ConsoleReporter::printTotals( Totals const& totals ) {
15659 if (totals.testCases.total() == 0) {
15660 stream << Colour(Colour::Warning) << "No tests ran\n";
15661 } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) {
15662 stream << Colour(Colour::ResultSuccess) << "All tests passed";
15663 stream << " ("
15664 << pluralise(totals.assertions.passed, "assertion") << " in "
15665 << pluralise(totals.testCases.passed, "test case") << ')'
15666 << '\n';
15667 } else {
15668
15669 std::vector<SummaryColumn> columns;
15670 columns.push_back(SummaryColumn("", Colour::None)
15671 .addRow(totals.testCases.total())
15672 .addRow(totals.assertions.total()));
15673 columns.push_back(SummaryColumn("passed", Colour::Success)
15674 .addRow(totals.testCases.passed)
15675 .addRow(totals.assertions.passed));
15676 columns.push_back(SummaryColumn("failed", Colour::ResultError)
15677 .addRow(totals.testCases.failed)
15678 .addRow(totals.assertions.failed));
15679 columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure)
15680 .addRow(totals.testCases.failedButOk)
15681 .addRow(totals.assertions.failedButOk));
15682
15683 printSummaryRow("test cases", columns, 0);
15684 printSummaryRow("assertions", columns, 1);
15685 }
15686 }
15687 void ConsoleReporter::printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row) {
15688 for (auto col : cols) {
15689 std::string value = col.rows[row];
15690 if (col.label.empty()) {
15691 stream << label << ": ";
15692 if (value != "0")
15693 stream << value;
15694 else
15695 stream << Colour(Colour::Warning) << "- none -";
15696 } else if (value != "0") {
15697 stream << Colour(Colour::LightGrey) << " | ";
15698 stream << Colour(col.colour)
15699 << value << ' ' << col.label;
15700 }
15701 }
15702 stream << '\n';
15703 }
15704
15705 void ConsoleReporter::printTotalsDivider(Totals const& totals) {
15706 if (totals.testCases.total() > 0) {
15707 std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total());
15708 std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total());
15709 std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total());
15710 while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1)
15711 findMax(failedRatio, failedButOkRatio, passedRatio)++;
15712 while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1)
15713 findMax(failedRatio, failedButOkRatio, passedRatio)--;
15714
15715 stream << Colour(Colour::Error) << std::string(failedRatio, '=');
15716 stream << Colour(Colour::ResultExpectedFailure) << std::string(failedButOkRatio, '=');
15717 if (totals.testCases.allPassed())
15718 stream << Colour(Colour::ResultSuccess) << std::string(passedRatio, '=');
15719 else
15720 stream << Colour(Colour::Success) << std::string(passedRatio, '=');
15721 } else {
15722 stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '=');
15723 }
15724 stream << '\n';
15725 }
15726 void ConsoleReporter::printSummaryDivider() {
15727 stream << getLineOfChars<'-'>() << '\n';
15728 }
15729
15730 void ConsoleReporter::printTestFilters() {
15731 if (m_config->testSpec().hasFilters())
15732 stream << Colour(Colour::BrightYellow) << "Filters: " << serializeFilters( m_config->getTestsOrTags() ) << '\n';
15733 }
15734
15735 CATCH_REGISTER_REPORTER("console", ConsoleReporter)
15736
15737 } // end namespace Catch
15738
15739 #if defined(_MSC_VER)
15740 #pragma warning(pop)
15741 #endif
15742
15743 #if defined(__clang__)
15744 # pragma clang diagnostic pop
15745 #endif
15746 // end catch_reporter_console.cpp
15747 // start catch_reporter_junit.cpp
15748
15749 #include <cassert>
15750 #include <sstream>
15751 #include <ctime>
15752 #include <algorithm>
15753
15754 namespace Catch {
15755
15756 namespace {
15757 std::string getCurrentTimestamp() {
15758 // Beware, this is not reentrant because of backward compatibility issues
15759 // Also, UTC only, again because of backward compatibility (%z is C++11)
15760 time_t rawtime;
15761 std::time(&rawtime);
15762 auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
15763
15764 #ifdef _MSC_VER
15765 std::tm timeInfo = {};
15766 gmtime_s(&timeInfo, &rawtime);
15767 #else
15768 std::tm* timeInfo;
15769 timeInfo = std::gmtime(&rawtime);
15770 #endif
15771
15772 char timeStamp[timeStampSize];
15773 const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
15774
15775 #ifdef _MSC_VER
15776 std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
15777 #else
15778 std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
15779 #endif
15780 return std::string(timeStamp);
15781 }
15782
15783 std::string fileNameTag(const std::vector<std::string> &tags) {
15784 auto it = std::find_if(begin(tags),
15785 end(tags),
15786 [] (std::string const& tag) {return tag.front() == '#'; });
15787 if (it != tags.end())
15788 return it->substr(1);
15789 return std::string();
15790 }
15791 } // anonymous namespace
15792
15793 JunitReporter::JunitReporter( ReporterConfig const& _config )
15794 : CumulativeReporterBase( _config ),
15795 xml( _config.stream() )
15796 {
15797 m_reporterPrefs.shouldRedirectStdOut = true;
15798 m_reporterPrefs.shouldReportAllAssertions = true;
15799 }
15800
15801 JunitReporter::~JunitReporter() {}
15802
15803 std::string JunitReporter::getDescription() {
15804 return "Reports test results in an XML format that looks like Ant's junitreport target";
15805 }
15806
15807 void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {}
15808
15809 void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) {
15810 CumulativeReporterBase::testRunStarting( runInfo );
15811 xml.startElement( "testsuites" );
15812 }
15813
15814 void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) {
15815 suiteTimer.start();
15816 stdOutForSuite.clear();
15817 stdErrForSuite.clear();
15818 unexpectedExceptions = 0;
15819 CumulativeReporterBase::testGroupStarting( groupInfo );
15820 }
15821
15822 void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) {
15823 m_okToFail = testCaseInfo.okToFail();
15824 }
15825
15826 bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) {
15827 if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )
15828 unexpectedExceptions++;
15829 return CumulativeReporterBase::assertionEnded( assertionStats );
15830 }
15831
15832 void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
15833 stdOutForSuite += testCaseStats.stdOut;
15834 stdErrForSuite += testCaseStats.stdErr;
15835 CumulativeReporterBase::testCaseEnded( testCaseStats );
15836 }
15837
15838 void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
15839 double suiteTime = suiteTimer.getElapsedSeconds();
15840 CumulativeReporterBase::testGroupEnded( testGroupStats );
15841 writeGroup( *m_testGroups.back(), suiteTime );
15842 }
15843
15844 void JunitReporter::testRunEndedCumulative() {
15845 xml.endElement();
15846 }
15847
15848 void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) {
15849 XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
15850
15851 TestGroupStats const& stats = groupNode.value;
15852 xml.writeAttribute( "name", stats.groupInfo.name );
15853 xml.writeAttribute( "errors", unexpectedExceptions );
15854 xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions );
15855 xml.writeAttribute( "tests", stats.totals.assertions.total() );
15856 xml.writeAttribute( "hostname", "tbd" ); // !TBD
15857 if( m_config->showDurations() == ShowDurations::Never )
15858 xml.writeAttribute( "time", "" );
15859 else
15860 xml.writeAttribute( "time", suiteTime );
15861 xml.writeAttribute( "timestamp", getCurrentTimestamp() );
15862
15863 // Write properties if there are any
15864 if (m_config->hasTestFilters() || m_config->rngSeed() != 0) {
15865 auto properties = xml.scopedElement("properties");
15866 if (m_config->hasTestFilters()) {
15867 xml.scopedElement("property")
15868 .writeAttribute("name", "filters")
15869 .writeAttribute("value", serializeFilters(m_config->getTestsOrTags()));
15870 }
15871 if (m_config->rngSeed() != 0) {
15872 xml.scopedElement("property")
15873 .writeAttribute("name", "random-seed")
15874 .writeAttribute("value", m_config->rngSeed());
15875 }
15876 }
15877
15878 // Write test cases
15879 for( auto const& child : groupNode.children )
15880 writeTestCase( *child );
15881
15882 xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), false );
15883 xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), false );
15884 }
15885
15886 void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) {
15887 TestCaseStats const& stats = testCaseNode.value;
15888
15889 // All test cases have exactly one section - which represents the
15890 // test case itself. That section may have 0-n nested sections
15891 assert( testCaseNode.children.size() == 1 );
15892 SectionNode const& rootSection = *testCaseNode.children.front();
15893
15894 std::string className = stats.testInfo.className;
15895
15896 if( className.empty() ) {
15897 className = fileNameTag(stats.testInfo.tags);
15898 if ( className.empty() )
15899 className = "global";
15900 }
15901
15902 if ( !m_config->name().empty() )
15903 className = m_config->name() + "." + className;
15904
15905 writeSection( className, "", rootSection );
15906 }
15907
15908 void JunitReporter::writeSection( std::string const& className,
15909 std::string const& rootName,
15910 SectionNode const& sectionNode ) {
15911 std::string name = trim( sectionNode.stats.sectionInfo.name );
15912 if( !rootName.empty() )
15913 name = rootName + '/' + name;
15914
15915 if( !sectionNode.assertions.empty() ||
15916 !sectionNode.stdOut.empty() ||
15917 !sectionNode.stdErr.empty() ) {
15918 XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
15919 if( className.empty() ) {
15920 xml.writeAttribute( "classname", name );
15921 xml.writeAttribute( "name", "root" );
15922 }
15923 else {
15924 xml.writeAttribute( "classname", className );
15925 xml.writeAttribute( "name", name );
15926 }
15927 xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) );
15928
15929 writeAssertions( sectionNode );
15930
15931 if( !sectionNode.stdOut.empty() )
15932 xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false );
15933 if( !sectionNode.stdErr.empty() )
15934 xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false );
15935 }
15936 for( auto const& childNode : sectionNode.childSections )
15937 if( className.empty() )
15938 writeSection( name, "", *childNode );
15939 else
15940 writeSection( className, name, *childNode );
15941 }
15942
15943 void JunitReporter::writeAssertions( SectionNode const& sectionNode ) {
15944 for( auto const& assertion : sectionNode.assertions )
15945 writeAssertion( assertion );
15946 }
15947
15948 void JunitReporter::writeAssertion( AssertionStats const& stats ) {
15949 AssertionResult const& result = stats.assertionResult;
15950 if( !result.isOk() ) {
15951 std::string elementName;
15952 switch( result.getResultType() ) {
15953 case ResultWas::ThrewException:
15954 case ResultWas::FatalErrorCondition:
15955 elementName = "error";
15956 break;
15957 case ResultWas::ExplicitFailure:
15958 elementName = "failure";
15959 break;
15960 case ResultWas::ExpressionFailed:
15961 elementName = "failure";
15962 break;
15963 case ResultWas::DidntThrowException:
15964 elementName = "failure";
15965 break;
15966
15967 // We should never see these here:
15968 case ResultWas::Info:
15969 case ResultWas::Warning:
15970 case ResultWas::Ok:
15971 case ResultWas::Unknown:
15972 case ResultWas::FailureBit:
15973 case ResultWas::Exception:
15974 elementName = "internalError";
15975 break;
15976 }
15977
15978 XmlWriter::ScopedElement e = xml.scopedElement( elementName );
15979
15980 xml.writeAttribute( "message", result.getExpandedExpression() );
15981 xml.writeAttribute( "type", result.getTestMacroName() );
15982
15983 ReusableStringStream rss;
15984 if( !result.getMessage().empty() )
15985 rss << result.getMessage() << '\n';
15986 for( auto const& msg : stats.infoMessages )
15987 if( msg.type == ResultWas::Info )
15988 rss << msg.message << '\n';
15989
15990 rss << "at " << result.getSourceInfo();
15991 xml.writeText( rss.str(), false );
15992 }
15993 }
15994
15995 CATCH_REGISTER_REPORTER( "junit", JunitReporter )
15996
15997 } // end namespace Catch
15998 // end catch_reporter_junit.cpp
15999 // start catch_reporter_listening.cpp
16000
16001 #include <cassert>
16002
16003 namespace Catch {
16004
16005 ListeningReporter::ListeningReporter() {
16006 // We will assume that listeners will always want all assertions
16007 m_preferences.shouldReportAllAssertions = true;
16008 }
16009
16010 void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) {
16011 m_listeners.push_back( std::move( listener ) );
16012 }
16013
16014 void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) {
16015 assert(!m_reporter && "Listening reporter can wrap only 1 real reporter");
16016 m_reporter = std::move( reporter );
16017 m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut;
16018 }
16019
16020 ReporterPreferences ListeningReporter::getPreferences() const {
16021 return m_preferences;
16022 }
16023
16024 std::set<Verbosity> ListeningReporter::getSupportedVerbosities() {
16025 return std::set<Verbosity>{ };
16026 }
16027
16028 void ListeningReporter::noMatchingTestCases( std::string const& spec ) {
16029 for ( auto const& listener : m_listeners ) {
16030 listener->noMatchingTestCases( spec );
16031 }
16032 m_reporter->noMatchingTestCases( spec );
16033 }
16034
16035 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
16036 void ListeningReporter::benchmarkPreparing( std::string const& name ) {
16037 for (auto const& listener : m_listeners) {
16038 listener->benchmarkPreparing(name);
16039 }
16040 m_reporter->benchmarkPreparing(name);
16041 }
16042 void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {
16043 for ( auto const& listener : m_listeners ) {
16044 listener->benchmarkStarting( benchmarkInfo );
16045 }
16046 m_reporter->benchmarkStarting( benchmarkInfo );
16047 }
16048 void ListeningReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) {
16049 for ( auto const& listener : m_listeners ) {
16050 listener->benchmarkEnded( benchmarkStats );
16051 }
16052 m_reporter->benchmarkEnded( benchmarkStats );
16053 }
16054
16055 void ListeningReporter::benchmarkFailed( std::string const& error ) {
16056 for (auto const& listener : m_listeners) {
16057 listener->benchmarkFailed(error);
16058 }
16059 m_reporter->benchmarkFailed(error);
16060 }
16061 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
16062
16063 void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) {
16064 for ( auto const& listener : m_listeners ) {
16065 listener->testRunStarting( testRunInfo );
16066 }
16067 m_reporter->testRunStarting( testRunInfo );
16068 }
16069
16070 void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) {
16071 for ( auto const& listener : m_listeners ) {
16072 listener->testGroupStarting( groupInfo );
16073 }
16074 m_reporter->testGroupStarting( groupInfo );
16075 }
16076
16077 void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
16078 for ( auto const& listener : m_listeners ) {
16079 listener->testCaseStarting( testInfo );
16080 }
16081 m_reporter->testCaseStarting( testInfo );
16082 }
16083
16084 void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) {
16085 for ( auto const& listener : m_listeners ) {
16086 listener->sectionStarting( sectionInfo );
16087 }
16088 m_reporter->sectionStarting( sectionInfo );
16089 }
16090
16091 void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) {
16092 for ( auto const& listener : m_listeners ) {
16093 listener->assertionStarting( assertionInfo );
16094 }
16095 m_reporter->assertionStarting( assertionInfo );
16096 }
16097
16098 // The return value indicates if the messages buffer should be cleared:
16099 bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) {
16100 for( auto const& listener : m_listeners ) {
16101 static_cast<void>( listener->assertionEnded( assertionStats ) );
16102 }
16103 return m_reporter->assertionEnded( assertionStats );
16104 }
16105
16106 void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) {
16107 for ( auto const& listener : m_listeners ) {
16108 listener->sectionEnded( sectionStats );
16109 }
16110 m_reporter->sectionEnded( sectionStats );
16111 }
16112
16113 void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
16114 for ( auto const& listener : m_listeners ) {
16115 listener->testCaseEnded( testCaseStats );
16116 }
16117 m_reporter->testCaseEnded( testCaseStats );
16118 }
16119
16120 void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
16121 for ( auto const& listener : m_listeners ) {
16122 listener->testGroupEnded( testGroupStats );
16123 }
16124 m_reporter->testGroupEnded( testGroupStats );
16125 }
16126
16127 void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) {
16128 for ( auto const& listener : m_listeners ) {
16129 listener->testRunEnded( testRunStats );
16130 }
16131 m_reporter->testRunEnded( testRunStats );
16132 }
16133
16134 void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) {
16135 for ( auto const& listener : m_listeners ) {
16136 listener->skipTest( testInfo );
16137 }
16138 m_reporter->skipTest( testInfo );
16139 }
16140
16141 bool ListeningReporter::isMulti() const {
16142 return true;
16143 }
16144
16145 } // end namespace Catch
16146 // end catch_reporter_listening.cpp
16147 // start catch_reporter_xml.cpp
16148
16149 #if defined(_MSC_VER)
16150 #pragma warning(push)
16151 #pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
16152 // Note that 4062 (not all labels are handled
16153 // and default is missing) is enabled
16154 #endif
16155
16156 namespace Catch {
16157 XmlReporter::XmlReporter( ReporterConfig const& _config )
16158 : StreamingReporterBase( _config ),
16159 m_xml(_config.stream())
16160 {
16161 m_reporterPrefs.shouldRedirectStdOut = true;
16162 m_reporterPrefs.shouldReportAllAssertions = true;
16163 }
16164
16165 XmlReporter::~XmlReporter() = default;
16166
16167 std::string XmlReporter::getDescription() {
16168 return "Reports test results as an XML document";
16169 }
16170
16171 std::string XmlReporter::getStylesheetRef() const {
16172 return std::string();
16173 }
16174
16175 void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) {
16176 m_xml
16177 .writeAttribute( "filename", sourceInfo.file )
16178 .writeAttribute( "line", sourceInfo.line );
16179 }
16180
16181 void XmlReporter::noMatchingTestCases( std::string const& s ) {
16182 StreamingReporterBase::noMatchingTestCases( s );
16183 }
16184
16185 void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) {
16186 StreamingReporterBase::testRunStarting( testInfo );
16187 std::string stylesheetRef = getStylesheetRef();
16188 if( !stylesheetRef.empty() )
16189 m_xml.writeStylesheetRef( stylesheetRef );
16190 m_xml.startElement( "Catch" );
16191 if( !m_config->name().empty() )
16192 m_xml.writeAttribute( "name", m_config->name() );
16193 if (m_config->testSpec().hasFilters())
16194 m_xml.writeAttribute( "filters", serializeFilters( m_config->getTestsOrTags() ) );
16195 if( m_config->rngSeed() != 0 )
16196 m_xml.scopedElement( "Randomness" )
16197 .writeAttribute( "seed", m_config->rngSeed() );
16198 }
16199
16200 void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) {
16201 StreamingReporterBase::testGroupStarting( groupInfo );
16202 m_xml.startElement( "Group" )
16203 .writeAttribute( "name", groupInfo.name );
16204 }
16205
16206 void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
16207 StreamingReporterBase::testCaseStarting(testInfo);
16208 m_xml.startElement( "TestCase" )
16209 .writeAttribute( "name", trim( testInfo.name ) )
16210 .writeAttribute( "description", testInfo.description )
16211 .writeAttribute( "tags", testInfo.tagsAsString() );
16212
16213 writeSourceInfo( testInfo.lineInfo );
16214
16215 if ( m_config->showDurations() == ShowDurations::Always )
16216 m_testCaseTimer.start();
16217 m_xml.ensureTagClosed();
16218 }
16219
16220 void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) {
16221 StreamingReporterBase::sectionStarting( sectionInfo );
16222 if( m_sectionDepth++ > 0 ) {
16223 m_xml.startElement( "Section" )
16224 .writeAttribute( "name", trim( sectionInfo.name ) );
16225 writeSourceInfo( sectionInfo.lineInfo );
16226 m_xml.ensureTagClosed();
16227 }
16228 }
16229
16230 void XmlReporter::assertionStarting( AssertionInfo const& ) { }
16231
16232 bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) {
16233
16234 AssertionResult const& result = assertionStats.assertionResult;
16235
16236 bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
16237
16238 if( includeResults || result.getResultType() == ResultWas::Warning ) {
16239 // Print any info messages in <Info> tags.
16240 for( auto const& msg : assertionStats.infoMessages ) {
16241 if( msg.type == ResultWas::Info && includeResults ) {
16242 m_xml.scopedElement( "Info" )
16243 .writeText( msg.message );
16244 } else if ( msg.type == ResultWas::Warning ) {
16245 m_xml.scopedElement( "Warning" )
16246 .writeText( msg.message );
16247 }
16248 }
16249 }
16250
16251 // Drop out if result was successful but we're not printing them.
16252 if( !includeResults && result.getResultType() != ResultWas::Warning )
16253 return true;
16254
16255 // Print the expression if there is one.
16256 if( result.hasExpression() ) {
16257 m_xml.startElement( "Expression" )
16258 .writeAttribute( "success", result.succeeded() )
16259 .writeAttribute( "type", result.getTestMacroName() );
16260
16261 writeSourceInfo( result.getSourceInfo() );
16262
16263 m_xml.scopedElement( "Original" )
16264 .writeText( result.getExpression() );
16265 m_xml.scopedElement( "Expanded" )
16266 .writeText( result.getExpandedExpression() );
16267 }
16268
16269 // And... Print a result applicable to each result type.
16270 switch( result.getResultType() ) {
16271 case ResultWas::ThrewException:
16272 m_xml.startElement( "Exception" );
16273 writeSourceInfo( result.getSourceInfo() );
16274 m_xml.writeText( result.getMessage() );
16275 m_xml.endElement();
16276 break;
16277 case ResultWas::FatalErrorCondition:
16278 m_xml.startElement( "FatalErrorCondition" );
16279 writeSourceInfo( result.getSourceInfo() );
16280 m_xml.writeText( result.getMessage() );
16281 m_xml.endElement();
16282 break;
16283 case ResultWas::Info:
16284 m_xml.scopedElement( "Info" )
16285 .writeText( result.getMessage() );
16286 break;
16287 case ResultWas::Warning:
16288 // Warning will already have been written
16289 break;
16290 case ResultWas::ExplicitFailure:
16291 m_xml.startElement( "Failure" );
16292 writeSourceInfo( result.getSourceInfo() );
16293 m_xml.writeText( result.getMessage() );
16294 m_xml.endElement();
16295 break;
16296 default:
16297 break;
16298 }
16299
16300 if( result.hasExpression() )
16301 m_xml.endElement();
16302
16303 return true;
16304 }
16305
16306 void XmlReporter::sectionEnded( SectionStats const& sectionStats ) {
16307 StreamingReporterBase::sectionEnded( sectionStats );
16308 if( --m_sectionDepth > 0 ) {
16309 XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" );
16310 e.writeAttribute( "successes", sectionStats.assertions.passed );
16311 e.writeAttribute( "failures", sectionStats.assertions.failed );
16312 e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk );
16313
16314 if ( m_config->showDurations() == ShowDurations::Always )
16315 e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds );
16316
16317 m_xml.endElement();
16318 }
16319 }
16320
16321 void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
16322 StreamingReporterBase::testCaseEnded( testCaseStats );
16323 XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" );
16324 e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() );
16325
16326 if ( m_config->showDurations() == ShowDurations::Always )
16327 e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() );
16328
16329 if( !testCaseStats.stdOut.empty() )
16330 m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false );
16331 if( !testCaseStats.stdErr.empty() )
16332 m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false );
16333
16334 m_xml.endElement();
16335 }
16336
16337 void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
16338 StreamingReporterBase::testGroupEnded( testGroupStats );
16339 // TODO: Check testGroupStats.aborting and act accordingly.
16340 m_xml.scopedElement( "OverallResults" )
16341 .writeAttribute( "successes", testGroupStats.totals.assertions.passed )
16342 .writeAttribute( "failures", testGroupStats.totals.assertions.failed )
16343 .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk );
16344 m_xml.endElement();
16345 }
16346
16347 void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) {
16348 StreamingReporterBase::testRunEnded( testRunStats );
16349 m_xml.scopedElement( "OverallResults" )
16350 .writeAttribute( "successes", testRunStats.totals.assertions.passed )
16351 .writeAttribute( "failures", testRunStats.totals.assertions.failed )
16352 .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk );
16353 m_xml.endElement();
16354 }
16355
16356 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
16357 void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) {
16358 m_xml.startElement("BenchmarkResults")
16359 .writeAttribute("name", info.name)
16360 .writeAttribute("samples", info.samples)
16361 .writeAttribute("resamples", info.resamples)
16362 .writeAttribute("iterations", info.iterations)
16363 .writeAttribute("clockResolution", static_cast<uint64_t>(info.clockResolution))
16364 .writeAttribute("estimatedDuration", static_cast<uint64_t>(info.estimatedDuration))
16365 .writeComment("All values in nano seconds");
16366 }
16367
16368 void XmlReporter::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) {
16369 m_xml.startElement("mean")
16370 .writeAttribute("value", static_cast<uint64_t>(benchmarkStats.mean.point.count()))
16371 .writeAttribute("lowerBound", static_cast<uint64_t>(benchmarkStats.mean.lower_bound.count()))
16372 .writeAttribute("upperBound", static_cast<uint64_t>(benchmarkStats.mean.upper_bound.count()))
16373 .writeAttribute("ci", benchmarkStats.mean.confidence_interval);
16374 m_xml.endElement();
16375 m_xml.startElement("standardDeviation")
16376 .writeAttribute("value", benchmarkStats.standardDeviation.point.count())
16377 .writeAttribute("lowerBound", benchmarkStats.standardDeviation.lower_bound.count())
16378 .writeAttribute("upperBound", benchmarkStats.standardDeviation.upper_bound.count())
16379 .writeAttribute("ci", benchmarkStats.standardDeviation.confidence_interval);
16380 m_xml.endElement();
16381 m_xml.startElement("outliers")
16382 .writeAttribute("variance", benchmarkStats.outlierVariance)
16383 .writeAttribute("lowMild", benchmarkStats.outliers.low_mild)
16384 .writeAttribute("lowSevere", benchmarkStats.outliers.low_severe)
16385 .writeAttribute("highMild", benchmarkStats.outliers.high_mild)
16386 .writeAttribute("highSevere", benchmarkStats.outliers.high_severe);
16387 m_xml.endElement();
16388 m_xml.endElement();
16389 }
16390
16391 void XmlReporter::benchmarkFailed(std::string const &error) {
16392 m_xml.scopedElement("failed").
16393 writeAttribute("message", error);
16394 m_xml.endElement();
16395 }
16396 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
16397
16398 CATCH_REGISTER_REPORTER( "xml", XmlReporter )
16399
16400 } // end namespace Catch
16401
16402 #if defined(_MSC_VER)
16403 #pragma warning(pop)
16404 #endif
16405 // end catch_reporter_xml.cpp
16406
16407 namespace Catch {
16408 LeakDetector leakDetector;
16409 }
16410
16411 #ifdef __clang__
16412 #pragma clang diagnostic pop
16413 #endif
16414
16415 // end catch_impl.hpp
16416 #endif
16417
16418 #ifdef CATCH_CONFIG_MAIN
16419 // start catch_default_main.hpp
16420
16421 #ifndef __OBJC__
16422
16423 #if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
16424 // Standard C/C++ Win32 Unicode wmain entry point
16425 extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
16426 #else
16427 // Standard C/C++ main entry point
16428 int main (int argc, char * argv[]) {
16429 #endif
16430
16431 return Catch::Session().run( argc, argv );
16432 }
16433
16434 #else // __OBJC__
16435
16436 // Objective-C entry point
16437 int main (int argc, char * const argv[]) {
16438 #if !CATCH_ARC_ENABLED
16439 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
16440 #endif
16441
16442 Catch::registerTestMethods();
16443 int result = Catch::Session().run( argc, (char**)argv );
16444
16445 #if !CATCH_ARC_ENABLED
16446 [pool drain];
16447 #endif
16448
16449 return result;
16450 }
16451
16452 #endif // __OBJC__
16453
16454 // end catch_default_main.hpp
16455 #endif
16456
16457 #if !defined(CATCH_CONFIG_IMPL_ONLY)
16458
16459 #ifdef CLARA_CONFIG_MAIN_NOT_DEFINED
16460 # undef CLARA_CONFIG_MAIN
16461 #endif
16462
16463 #if !defined(CATCH_CONFIG_DISABLE)
16464 //////
16465 // If this config identifier is defined then all CATCH macros are prefixed with CATCH_
16466 #ifdef CATCH_CONFIG_PREFIX_ALL
16467
16468 #define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ )
16469 #define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
16470
16471 #define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
16472 #define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
16473 #define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
16474 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16475 #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
16476 #endif// CATCH_CONFIG_DISABLE_MATCHERS
16477 #define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
16478
16479 #define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16480 #define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
16481 #define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16482 #define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16483 #define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
16484
16485 #define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16486 #define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
16487 #define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
16488 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16489 #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
16490 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16491 #define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16492
16493 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16494 #define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
16495
16496 #define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
16497 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16498
16499 #define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg )
16500 #define CATCH_UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "CATCH_UNSCOPED_INFO", msg )
16501 #define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
16502 #define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CATCH_CAPTURE",__VA_ARGS__ )
16503
16504 #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
16505 #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
16506 #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
16507 #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
16508 #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
16509 #define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )
16510 #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
16511 #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16512 #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16513
16514 #define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
16515
16516 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
16517 #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
16518 #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ )
16519 #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16520 #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )
16521 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
16522 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ )
16523 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )
16524 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )
16525 #else
16526 #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
16527 #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) )
16528 #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
16529 #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )
16530 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )
16531 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) )
16532 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
16533 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )
16534 #endif
16535
16536 #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
16537 #define CATCH_STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ )
16538 #define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ )
16539 #else
16540 #define CATCH_STATIC_REQUIRE( ... ) CATCH_REQUIRE( __VA_ARGS__ )
16541 #define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ )
16542 #endif
16543
16544 // "BDD-style" convenience wrappers
16545 #define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
16546 #define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
16547 #define CATCH_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc )
16548 #define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc )
16549 #define CATCH_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc )
16550 #define CATCH_AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc )
16551 #define CATCH_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc )
16552 #define CATCH_AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc )
16553
16554 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
16555 #define CATCH_BENCHMARK(...) \
16556 INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
16557 #define CATCH_BENCHMARK_ADVANCED(name) \
16558 INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name)
16559 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
16560
16561 // If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
16562 #else
16563
16564 #define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ )
16565 #define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
16566
16567 #define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
16568 #define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
16569 #define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
16570 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16571 #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
16572 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16573 #define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
16574
16575 #define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16576 #define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
16577 #define CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16578 #define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16579 #define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
16580
16581 #define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16582 #define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
16583 #define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
16584 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16585 #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
16586 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16587 #define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16588
16589 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16590 #define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
16591
16592 #define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
16593 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16594
16595 #define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg )
16596 #define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg )
16597 #define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
16598 #define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CAPTURE",__VA_ARGS__ )
16599
16600 #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
16601 #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
16602 #define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
16603 #define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
16604 #define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
16605 #define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )
16606 #define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
16607 #define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16608 #define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
16609 #define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
16610
16611 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
16612 #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
16613 #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ )
16614 #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16615 #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )
16616 #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
16617 #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ )
16618 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )
16619 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )
16620 #define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__)
16621 #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ )
16622 #else
16623 #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
16624 #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) )
16625 #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
16626 #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )
16627 #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )
16628 #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) )
16629 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
16630 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )
16631 #define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) )
16632 #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
16633 #endif
16634
16635 #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
16636 #define STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ )
16637 #define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" )
16638 #else
16639 #define STATIC_REQUIRE( ... ) REQUIRE( __VA_ARGS__ )
16640 #define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ )
16641 #endif
16642
16643 #endif
16644
16645 #define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
16646
16647 // "BDD-style" convenience wrappers
16648 #define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ )
16649 #define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
16650
16651 #define GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc )
16652 #define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc )
16653 #define WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc )
16654 #define AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc )
16655 #define THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc )
16656 #define AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc )
16657
16658 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
16659 #define BENCHMARK(...) \
16660 INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
16661 #define BENCHMARK_ADVANCED(name) \
16662 INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name)
16663 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
16664
16665 using Catch::Detail::Approx;
16666
16667 #else // CATCH_CONFIG_DISABLE
16668
16669 //////
16670 // If this config identifier is defined then all CATCH macros are prefixed with CATCH_
16671 #ifdef CATCH_CONFIG_PREFIX_ALL
16672
16673 #define CATCH_REQUIRE( ... ) (void)(0)
16674 #define CATCH_REQUIRE_FALSE( ... ) (void)(0)
16675
16676 #define CATCH_REQUIRE_THROWS( ... ) (void)(0)
16677 #define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
16678 #define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
16679 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16680 #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
16681 #endif// CATCH_CONFIG_DISABLE_MATCHERS
16682 #define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)
16683
16684 #define CATCH_CHECK( ... ) (void)(0)
16685 #define CATCH_CHECK_FALSE( ... ) (void)(0)
16686 #define CATCH_CHECKED_IF( ... ) if (__VA_ARGS__)
16687 #define CATCH_CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
16688 #define CATCH_CHECK_NOFAIL( ... ) (void)(0)
16689
16690 #define CATCH_CHECK_THROWS( ... ) (void)(0)
16691 #define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
16692 #define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0)
16693 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16694 #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
16695 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16696 #define CATCH_CHECK_NOTHROW( ... ) (void)(0)
16697
16698 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16699 #define CATCH_CHECK_THAT( arg, matcher ) (void)(0)
16700
16701 #define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)
16702 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16703
16704 #define CATCH_INFO( msg ) (void)(0)
16705 #define CATCH_UNSCOPED_INFO( msg ) (void)(0)
16706 #define CATCH_WARN( msg ) (void)(0)
16707 #define CATCH_CAPTURE( msg ) (void)(0)
16708
16709 #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
16710 #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
16711 #define CATCH_METHOD_AS_TEST_CASE( method, ... )
16712 #define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
16713 #define CATCH_SECTION( ... )
16714 #define CATCH_DYNAMIC_SECTION( ... )
16715 #define CATCH_FAIL( ... ) (void)(0)
16716 #define CATCH_FAIL_CHECK( ... ) (void)(0)
16717 #define CATCH_SUCCEED( ... ) (void)(0)
16718
16719 #define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
16720
16721 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
16722 #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)
16723 #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__)
16724 #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__)
16725 #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ )
16726 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
16727 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
16728 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16729 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16730 #else
16731 #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) )
16732 #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) )
16733 #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) )
16734 #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) )
16735 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
16736 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
16737 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16738 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16739 #endif
16740
16741 // "BDD-style" convenience wrappers
16742 #define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
16743 #define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
16744 #define CATCH_GIVEN( desc )
16745 #define CATCH_AND_GIVEN( desc )
16746 #define CATCH_WHEN( desc )
16747 #define CATCH_AND_WHEN( desc )
16748 #define CATCH_THEN( desc )
16749 #define CATCH_AND_THEN( desc )
16750
16751 #define CATCH_STATIC_REQUIRE( ... ) (void)(0)
16752 #define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0)
16753
16754 // If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
16755 #else
16756
16757 #define REQUIRE( ... ) (void)(0)
16758 #define REQUIRE_FALSE( ... ) (void)(0)
16759
16760 #define REQUIRE_THROWS( ... ) (void)(0)
16761 #define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
16762 #define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
16763 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16764 #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
16765 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16766 #define REQUIRE_NOTHROW( ... ) (void)(0)
16767
16768 #define CHECK( ... ) (void)(0)
16769 #define CHECK_FALSE( ... ) (void)(0)
16770 #define CHECKED_IF( ... ) if (__VA_ARGS__)
16771 #define CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
16772 #define CHECK_NOFAIL( ... ) (void)(0)
16773
16774 #define CHECK_THROWS( ... ) (void)(0)
16775 #define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
16776 #define CHECK_THROWS_WITH( expr, matcher ) (void)(0)
16777 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16778 #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
16779 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16780 #define CHECK_NOTHROW( ... ) (void)(0)
16781
16782 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
16783 #define CHECK_THAT( arg, matcher ) (void)(0)
16784
16785 #define REQUIRE_THAT( arg, matcher ) (void)(0)
16786 #endif // CATCH_CONFIG_DISABLE_MATCHERS
16787
16788 #define INFO( msg ) (void)(0)
16789 #define UNSCOPED_INFO( msg ) (void)(0)
16790 #define WARN( msg ) (void)(0)
16791 #define CAPTURE( msg ) (void)(0)
16792
16793 #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
16794 #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
16795 #define METHOD_AS_TEST_CASE( method, ... )
16796 #define REGISTER_TEST_CASE( Function, ... ) (void)(0)
16797 #define SECTION( ... )
16798 #define DYNAMIC_SECTION( ... )
16799 #define FAIL( ... ) (void)(0)
16800 #define FAIL_CHECK( ... ) (void)(0)
16801 #define SUCCEED( ... ) (void)(0)
16802 #define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
16803
16804 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
16805 #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)
16806 #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__)
16807 #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__)
16808 #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ )
16809 #define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
16810 #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
16811 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16812 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16813 #else
16814 #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) )
16815 #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) )
16816 #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) )
16817 #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) )
16818 #define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
16819 #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
16820 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16821 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
16822 #endif
16823
16824 #define STATIC_REQUIRE( ... ) (void)(0)
16825 #define STATIC_REQUIRE_FALSE( ... ) (void)(0)
16826
16827 #endif
16828
16829 #define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
16830
16831 // "BDD-style" convenience wrappers
16832 #define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) )
16833 #define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
16834
16835 #define GIVEN( desc )
16836 #define AND_GIVEN( desc )
16837 #define WHEN( desc )
16838 #define AND_WHEN( desc )
16839 #define THEN( desc )
16840 #define AND_THEN( desc )
16841
16842 using Catch::Detail::Approx;
16843
16844 #endif
16845
16846 #endif // ! CATCH_CONFIG_IMPL_ONLY
16847
16848 // start catch_reenable_warnings.h
16849
16850
16851 #ifdef __clang__
16852 # ifdef __ICC // icpc defines the __clang__ macro
16853 # pragma warning(pop)
16854 # else
16855 # pragma clang diagnostic pop
16856 # endif
16857 #elif defined __GNUC__
16858 # pragma GCC diagnostic pop
16859 #endif
16860
16861 // end catch_reenable_warnings.h
16862 // end catch.hpp
16863 #endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
16864
0 /*
1 libheif unit tests
2
3 MIT License
4
5 Copyright (c) 2019 struktur AG, Dirk Farin <farin@struktur.de>
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 */
25
26 #include "catch.hpp"
27 #include "libheif/heif_colorconversion.h"
28
29
30 using namespace heif;
31
32 TEST_CASE( "Color conversion", "[heif_image]" ) {
33
34 ColorConversionPipeline pipeline;
35 bool success;
36
37 printf("--- color conversions ---\n");
38
39 success = pipeline.construct_pipeline( { heif_colorspace_RGB, heif_chroma_444, false, 8 },
40 { heif_colorspace_RGB, heif_chroma_interleaved_RGB, false, 8 } );
41
42 REQUIRE( success );
43
44 printf("---\n");
45
46 success = pipeline.construct_pipeline( { heif_colorspace_YCbCr, heif_chroma_420, false, 8 },
47 { heif_colorspace_RGB, heif_chroma_interleaved_RGB, false, 8 } );
48
49 printf("---\n");
50
51 success = pipeline.construct_pipeline( { heif_colorspace_YCbCr, heif_chroma_420, false, 8 },
52 { heif_colorspace_RGB, heif_chroma_interleaved_RGBA, true, 8 } );
53
54 REQUIRE( success );
55
56 printf("---\n");
57
58 success = pipeline.construct_pipeline( { heif_colorspace_YCbCr, heif_chroma_420, false, 10 },
59 { heif_colorspace_RGB, heif_chroma_444, false, 10 } );
60
61 REQUIRE( success );
62
63 printf("---\n");
64
65 success = pipeline.construct_pipeline( { heif_colorspace_RGB, heif_chroma_444, false, 10 },
66 { heif_colorspace_RGB, heif_chroma_interleaved_RRGGBBAA_BE, true, 10 } );
67
68 REQUIRE( success );
69
70 printf("---\n");
71
72 success = pipeline.construct_pipeline( { heif_colorspace_RGB, heif_chroma_444, false, 10 },
73 { heif_colorspace_RGB, heif_chroma_interleaved_RRGGBBAA_LE, true, 10 } );
74
75 REQUIRE( success );
76
77 printf("---\n");
78
79 success = pipeline.construct_pipeline( { heif_colorspace_monochrome, heif_chroma_monochrome, false, 8 },
80 { heif_colorspace_RGB, heif_chroma_interleaved_RGB, false, 8 } );
81
82 REQUIRE( success );
83
84 printf("---\n");
85
86 success = pipeline.construct_pipeline( { heif_colorspace_monochrome, heif_chroma_monochrome, false, 8 },
87 { heif_colorspace_RGB, heif_chroma_interleaved_RGBA, true, 8 } );
88
89 printf("---\n");
90
91 success = pipeline.construct_pipeline( { heif_colorspace_RGB, heif_chroma_interleaved_RGBA, true, 8 },
92 { heif_colorspace_YCbCr, heif_chroma_420, false, 8 } );
93
94 REQUIRE( success );
95
96 printf("---\n");
97
98 success = pipeline.construct_pipeline( { heif_colorspace_RGB, heif_chroma_444, false, 10 },
99 { heif_colorspace_RGB, heif_chroma_interleaved_RRGGBB_LE, false, 10 } );
100
101 REQUIRE( success );
102
103 printf("---\n");
104
105 success = pipeline.construct_pipeline( { heif_colorspace_RGB, heif_chroma_interleaved_RRGGBB_LE, false, 12 },
106 { heif_colorspace_RGB, heif_chroma_444, false, 12 } );
107
108 REQUIRE( success );
109
110 printf("---\n");
111
112 success = pipeline.construct_pipeline( { heif_colorspace_RGB, heif_chroma_444, false, 12 },
113 { heif_colorspace_YCbCr, heif_chroma_420, false, 12 } );
114
115 REQUIRE( success );
116
117 printf("---\n");
118
119 success = pipeline.construct_pipeline( { heif_colorspace_RGB, heif_chroma_interleaved_RRGGBB_BE, false, 12 },
120 { heif_colorspace_YCbCr, heif_chroma_420, false, 12 } );
121
122 REQUIRE( success );
123
124 printf("---\n");
125
126 success = pipeline.construct_pipeline( { heif_colorspace_RGB, heif_chroma_interleaved_RRGGBB_LE, false, 12 },
127 { heif_colorspace_YCbCr, heif_chroma_420, false, 12 } );
128
129 REQUIRE( success );
130 }
0 /*
1 libheif unit tests
2
3 MIT License
4
5 Copyright (c) 2019 struktur AG, Dirk Farin <farin@struktur.de>
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 */
25
26 #include "catch.hpp"
27 #include "libheif/heif.h"
28
29
30 struct heif_image* createImage_RRGGBB_BE() {
31 struct heif_image* image;
32 struct heif_error err;
33 err = heif_image_create(256,256,
34 heif_colorspace_RGB,
35 heif_chroma_interleaved_RRGGBB_BE,
36 &image);
37 if (err.code) {
38 return nullptr;
39 }
40
41 err = heif_image_add_plane(image,
42 heif_channel_interleaved,
43 256,256, 10);
44 if (err.code) {
45 heif_image_release(image);
46 return nullptr;
47 }
48
49 return image;
50 }
51
52
53 struct heif_error encode_image(struct heif_image* img) {
54 struct heif_context* ctx = heif_context_alloc();
55
56 struct heif_encoder* enc;
57 struct heif_error err { heif_error_Ok };
58
59 err = heif_context_get_encoder_for_format(ctx,
60 heif_compression_HEVC,
61 &enc);
62 if (err.code) {
63 heif_context_free(ctx);
64 return err;
65 }
66
67
68 struct heif_image_handle* hdl;
69 err = heif_context_encode_image(ctx,
70 img,
71 enc,
72 nullptr,
73 &hdl);
74 if (err.code) {
75 heif_encoder_release(enc);
76 heif_context_free(ctx);
77 return err;
78 }
79
80 return err;
81 }
82
83
84 #if 0
85 TEST_CASE( "Create images", "[heif_image]" ) {
86 auto img = createImage_RRGGBB_BE();
87 REQUIRE( img != nullptr );
88
89 heif_image_release(img);
90 }
91
92
93
94 TEST_CASE( "Encode HDR", "[heif_encoder]" ) {
95 auto img = createImage_RRGGBB_BE();
96 REQUIRE( img != nullptr );
97
98 REQUIRE( encode_image(img).code == heif_error_Ok );
99
100 heif_image_release(img);
101 }
102 #endif
0 /*
1 libheif unit tests
2
3 MIT License
4
5 Copyright (c) 2019 struktur AG, Dirk Farin <farin@struktur.de>
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 */
25
26 #define CATCH_CONFIG_MAIN
27 #include "catch.hpp"