diff --git a/generate4.sh b/generate4.sh
index 745f385b..60a1870d 100755
--- a/generate4.sh
+++ b/generate4.sh
@@ -32,20 +32,15 @@ main()
# Generate property copiers and artifact generators.
msg_warn "${GSL} -script:gsl.copy_properties.sh generate4.xml"
eval ${GSL} -script:gsl.copy_properties.sh generate4.xml
- msg_warn "${GSL} -script:gsl.generate_artifacts.sh generate4.xml"
- eval ${GSL} -script:gsl.generate_artifacts.sh generate4.xml
# Make property copiers and artifact generators executable.
msg_verbose "Modifying properties of shell scripts."
eval chmod +x copy_properties.sh
- eval chmod +x generate_artifacts.sh
# Execute property copiers and artifact generators.
msg "Execute copy_properties.sh..."
eval ./copy_properties.sh
- msg "Execute generate_artifacts.sh..."
- eval ./generate_artifacts.sh
msg "Execute generate.sh..."
eval ./generate.sh version4.xml
msg "Execute copy_projects.sh..."
diff --git a/generate4.xml b/generate4.xml
index 8be0e51f..a58b5d5c 100644
--- a/generate4.xml
+++ b/generate4.xml
@@ -948,16 +948,6 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/filesystem.gsl b/lib/filesystem.gsl
index e431eccf..abb2d430 100644
--- a/lib/filesystem.gsl
+++ b/lib/filesystem.gsl
@@ -262,7 +262,7 @@ function global.populate_files(path_substitutions, files, filters, target, absol
endnew
endfunction
-function repository_absolute_path(repository, configuration)
+function global.repository_absolute_path(repository, configuration)
define my.repository = repository_absolute_path.repository
define my.configuration = repository_absolute_path.configuration
@@ -274,6 +274,17 @@ function repository_absolute_path(repository, configuration)
return my.directory.path
endfunction
+function global.matches_substitution(substitutions, path)
+ define my.substitutions = matches_substitution.substitutions
+ define my.path = matches_substitution.path
+
+ for my.substitutions.substitution as _sub
+ if starts_with(my.path, _sub.absolute_path)
+ return _sub
+ endif
+ endfor
+endfunction
+
.endtemplate
.template 1
.
diff --git a/lib/gnu-output.gsl b/lib/gnu-output.gsl
new file mode 100644
index 00000000..78ccca28
--- /dev/null
+++ b/lib/gnu-output.gsl
@@ -0,0 +1,47 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL libbitcoin gnu utilities in the 'global' scope.
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+###############################################################################
+# Functions
+###############################################################################
+
+.endtemplate
+.template 1
+.
+.##############################################################################
+.# Macros
+.##############################################################################
+.
+.macro global.copyleft(name)
+###############################################################################
+# Copyright (c) 2014-2026 $(my.name) developers (see COPYING).
+#
+# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
+#
+###############################################################################
+.endmacro
+.
+.macro global.heading1(text)
+
+# $(my.text)
+#==============================================================================
+.endmacro
+.
+.macro global.heading2(text)
+# $(my.text)
+#------------------------------------------------------------------------------
+.endmacro
+.
+.macro global.heading3(text)
+# $(my.text)
+.endmacro
+.
+.endtemplate
+
diff --git a/lib/xml.gsl b/lib/xml.gsl
index 0bed657b..c2e8ad95 100644
--- a/lib/xml.gsl
+++ b/lib/xml.gsl
@@ -39,24 +39,46 @@ function global.is_defined_positive(node, attribute)
((my.node.$(my.attribute) = "true") | (my.node.$(my.attribute) = "yes"))
endfunction
-function global.merge_child(destination, element, identifier)
+function global.linearize(result, host)
+ define my.result = linearize.result
+ define my.host = linearize.host
+
+ copy my.host to my.result
+
+ for my.host.$(name(my.host)) as _child
+ linearize(my.result, _child)
+ endfor
+endfunction
+
+function global.merge_child(destination, element, identifier, context)
define my.destination = merge_child.destination
define my.element = merge_child.element
define my.identifier = merge_child.identifier
+ define my.context = merge_child.context
if (count(my.destination.$(name(my.element)), count.$(my.identifier) = my.element.$(my.identifier)) = 0)
copy my.element to my.destination
endif
+
+ define my.match = my.destination->$(name(my.element))(this.$(my.identifier) = my.element.$(my.identifier), this)
+
+ if defined(my.match) & defined(my.context) & defined(my.context.name)
+ new my.match.context as _context
+ _context.name = my.context.name
+ _context.type = name(my.context)
+ endnew
+ endif
endfunction
-function global.merge_children_select(destination, source, name, identifier)
+function global.merge_children_select(destination, source, context, name, identifier)
define my.destination = merge_children_select.destination
define my.source = merge_children_select.source
+ define my.context = merge_children_select.context
define my.name = merge_children_select.name
define my.identifier = merge_children_select.identifier
for my.source.$(my.name) as _child
- merge_child(my.destination, _child, my.identifier)
+ merge_child(my.destination, _child, my.identifier, my.context)
endfor
endfunction
@@ -92,16 +114,38 @@ function global.canonicalize(result, host, registrar, name, identifier)
endfor
endfunction
-function global.merge_components(dependencies, element)
+function global.merge_components(dependencies, element, context)
define my.dependencies = merge_components.dependencies
define my.element = merge_components.element
+ define my.context = merge_components.context
+
+ define my.contextualize_children = 0
if (count(my.dependencies.dependency, dependency.name = my.element.name) > 0)
define my.destination = my.dependencies->dependency(dependency.name = my.element.name)
- merge_children_select(my.destination, my.element, "component", "name")
+ merge_children_select(my.destination, my.element, my.context, "component", "name")
else
copy my.element to my.dependencies
+ my.contextualize_children = 1
+ endif
+
+ define my.match = my.dependencies->dependency(dependency.name = my.element.name)
+
+ if defined(my.match) & defined(my.context) & defined(my.context.name)
+ new my.match.context as _context
+ _context.name = my.context.name
+ _context.type = name(my.context)
+ endnew
+
+ if my.contextualize_children
+ for my.match.component as _component
+ new _component.context as _context
+ _context.name = my.context.name
+ _context.type = name(my.context)
+ endnew
+ endfor
+ endif
endif
endfunction
@@ -189,10 +233,11 @@ function global.find_option_declaration(name, target, repository)
abort "Missing option matching name '$(my.name)'."
endfunction
-function global.get_option(reference, target, repository)
+function global.get_option(reference, target, repository, separator)
define my.reference = get_option.reference
define my.target = get_option.target
define my.repository = get_option.repository
+ define my.separator = get_option.separator ? "-"
define my.result = ""
if (defined(my.reference.option))
@@ -202,32 +247,35 @@ function global.get_option(reference, target, repository)
abort "Target '$(my.target.name)' missing option '$(my.reference.option)'."
endif
- my.result = "$(my.option.type:lower)-$(my.option.name:lower)"
+ my.result = "$(my.option.type:lower)$(my.separator)$(my.option.name:lower)"
endif
return my.result
endfunction
-function global.target_dependency_list(result, target, repository, configuration)
+function global.target_dependency_list(result, target, repository, configuration, recurse)
define my.result = target_dependency_list.result
define my.target = target_dependency_list.target
define my.repository = target_dependency_list.repository
define my.configuration = target_dependency_list.configuration
+ define my.recurse = target_dependency_list.recurse
define my.registrar = my.configuration->registrar(id = "dependency")
for my.target.dependency as _dep
- if (count_matches_name(my.configuration, "repository", _dep.name) > 0)
+ if ((my.recurse) & \
+ (count_matches_name(my.configuration, "repository", _dep.name) > 0))
+
define my.dep_repository = my.configuration->repository(name = _dep.name)
define my.dep_target = my.dep_repository->library(name = _dep.name)
target_dependency_list(my.result, my.dep_target, \
- my.dep_repository, my.configuration)
+ my.dep_repository, my.configuration, my.recurse)
else
canonicalize_element(my.result, _dep, my.registrar, "name")
endif
- merge_components(my.result, _dep)
+ merge_components(my.result, _dep, my.target)
endfor
endfunction
@@ -255,6 +303,85 @@ function global.canonical_dependency_list(result, repository, configuration)
endfor
endfunction
+function global.accumulate_repository_dependencies(result, repository)
+ define my.result = accumulate_repository_dependencies.result
+ define my.repository = accumulate_repository_dependencies.repository
+
+ for my.repository. as _target where is_target_element(_target)
+ for _target.dependency as _dep
+ merge_components(my.result, _dep, _target)
+
+ define my.match = my.result->dependency(this.name = _dep.name, this)
+
+ new my.match.context as _context
+ _context.type = name(_target)
+ _context.name = _target.name
+ endnew
+ endfor
+ endfor
+
+ for my.repository.library as _library
+ if (count(my.result.dependency, this.name = _library.name, this) > 0)
+ delete my.result->dependency(this.name = _library.name, this)
+ endif
+ endfor
+endfunction
+
+function accumulate_target_flags(result, target, repository, configuration, meta)
+ define my.result = accumulate_target_flags.result
+ define my.target = accumulate_target_flags.target
+ define my.repository = accumulate_target_flags.repository
+ define my.configuration = accumulate_target_flags.configuration
+ define my.meta = accumulate_target_flags.meta
+
+ for my.target->compiler.flag as _flag
+ new _flag.target as _flag_target
+ _flag_target.name = my.target.name
+ _flag_target.type = name(my.target)
+ endnew
+
+ if !defined(_flag.id)
+ copy _flag to my.result
+
+ elsif (count(my.result.flag, defined(this.id) & (this.id = _flag.id), this) = 0)
+ define my.canonical = my.configuration->canonical->compiler->flag( \
+ (this.id = _flag.id), this)?
+
+ if defined(my.canonical)
+ copy my.canonical to my.result
+ define my.copied = my.result->flag(\
+ defined(this.id) & (this.id = _flag.id), this)
+
+ new my.copied.target as _flag_target
+ _flag_target.name = my.target.name
+ _flag_target.type = name(my.target)
+ endnew
+ else
+ copy _flag to my.result
+ endif
+ else
+ define my.match = my.result->flag(defined(this.id) & \
+ (this.id = _flag.id), this)
+
+ new my.match.target as _flag_target
+ _flag_target.name = my.target.name
+ _flag_target.type = name(my.target)
+ endnew
+ endif
+ endfor
+endfunction
+
+function accumulate_flags(result, repository, configuration, meta)
+ define my.result = accumulate_flags.result
+ define my.repository = accumulate_flags.repository
+ define my.configuration = accumulate_flags.configuration
+ define my.meta = accumulate_flags.meta
+
+ for my.repository. as _target where is_target_element(_target)
+ accumulate_target_flags(my.result, _target, my.repository, my.configuration, my.meta)
+ endfor
+endfunction
+
function global.calculate_presets(result, configuration, repository)
define my.result = calculate_presets.result
define my.configuration = calculate_presets.configuration
@@ -310,6 +437,39 @@ function global.is_target_element(element)
| (name(my.element) = "binary")
endfunction
+function global.symbol_text(symbol)
+ define my.symbol = symbol_text.symbol
+
+ if defined(my.symbol.name)
+ return "$(my.symbol.name)=$(my.symbol.value)"
+ endif
+
+ return my.symbol.value
+endfunction
+
+function global.symbol(flag)
+ define my.flag = symbol.flag
+ define my.result = ""
+
+ if (count(my.flag.symbol) > 0)
+ for my.flag.symbol as _symbol
+ if !first()
+ my.result = "$(my.result) $(symbol_text(_symbol))"
+ else
+ my.result = "$(symbol_text(_symbol))"
+ endif
+ endfor
+ else
+ if !defined(my.flag.symbol)
+ abort "$(name(my.target)) | Flag requires 'symbol'."
+ endif
+
+ my.result = "$(my.flag.symbol)"
+ endif
+
+ return my.result
+endfunction
+
.endtemplate
.template 1
.
diff --git a/templates/cmake/CMakeLists.txt.gsl b/templates/cmake/CMakeLists.txt.gsl
index 3f6bfa01..2e1780ea 100644
--- a/templates/cmake/CMakeLists.txt.gsl
+++ b/templates/cmake/CMakeLists.txt.gsl
@@ -196,26 +196,7 @@ function render_dependencies(repository)
define my.repository = render_dependencies.repository
new unique_merged_dependencies as _dependencies
- for my.repository.library as _library
- for _library.dependency as _dep
- merge_components(_dependencies, _dep)
- endfor
- endfor
- for my.repository.test as _test
- for _test.dependency as _dep
- merge_components(_dependencies, _dep)
- endfor
- endfor
- for my.repository.binary as _binary
- for _binary.dependency as _dep
- merge_components(_dependencies, _dep)
- endfor
- endfor
- for my.repository.library as _library
- if (count(_dependencies.dependency, name = _library.name) > 0)
- delete _dependencies->dependency(name = _library.name)
- endif
- endfor
+ accumulate_repository_dependencies(_dependencies, my.repository)
emit_shared_static_detection(_dependencies)
@@ -307,28 +288,6 @@ function supported_language(element, default)
return cmake_language(my.default)
endfunction
-function symbol(flag)
- define my.flag = symbol.flag
- define my.result = ""
-
- if (count(my.flag.symbol) > 0)
- for my.flag.symbol as _symbol
- if (!first())
- my.result = "$(my.result) $(_symbol.value)"
- else
- my.result = "$(_symbol.value)"
- endif
- endfor
- else
- if !defined(my.flag.symbol)
- abort "$(name(my.target)) | Flag requires 'symbol'."
- endif
- my.result = "$(my.flag.symbol)"
- endif
-
- return my.result
-endfunction
-
function flag_name(flag)
define my.flag = flag_name.flag
@@ -389,26 +348,10 @@ function render_compiler_option_checks(repository)
emit_compiler_check_includes(my.repository)
new compiler as _compiler
- for my.repository.library as _library
- if !defined(_library->compiler)
- next
- endif
+ for my.repository. as _target where is_target_element(_target) &\
+ defined(_target->compiler)
- render_unique_flags(_compiler, _library, my.repository)
- endfor
- for my.repository.test as _test
- if !defined(_test->compiler)
- next
- endif
-
- render_unique_flags(_compiler, _test, my.repository)
- endfor
- for my.repository.binary as _binary
- if !defined(_binary->compiler)
- next
- endif
-
- render_unique_flags(_compiler, _binary, my.repository)
+ render_unique_flags(_compiler, _target, my.repository)
endfor
endnew
endfunction
@@ -564,9 +507,17 @@ endif()
. heading("Linker options.")
. render_link_option_checks(my.repository)
+.
+. define my.filecount = 0
+. for my.repository. as _target where is_target_element(_target)
+. my.filecount += count(_target.configurable)
+. endfor
+.
+. if (my.filecount > 0)
-. heading("Configurable file(s).")
-. render_configurable_files(my.repository, my.meta)
+. heading("Configurable file(s).")
+. render_configurable_files(my.repository, my.meta)
+. endif
.
. for my.repository.library as _library
@@ -586,7 +537,7 @@ endif()
. heading("$(target_name(_binary)) executable")
. emit_target(_binary, my.repository, my.meta)
. endfor
-.
+
. heading("Installation routine.")
. emit_installation(my.repository, my.meta)
.
@@ -731,8 +682,8 @@ $(my.indent)$(my.prefix)$(qualified_target_name(my.dependency))$(my.suffix)
.macro emit_options(context)
. define my.context = emit_options.context
.
-. if (defined(my.context.type))
-option( $(my.context.type:lower)-$(my.context.option:lower) "Build $(my.context.option)." $(option_default(my.context)) )
+. if (defined(my.context.option))
+option( $(my.context.type:lower)-$(my.context.option:lower) "$(my.context.comment)" $(option_default(my.context)) )
. endif
.
. for my.context.option as _option
@@ -746,7 +697,7 @@ option( $(_option.type:lower)-$(_option.name:lower) "$(_option.comment)" $(optio
. if (count(my.dependencies.dependency) = 0)
. return
. endif
-
+.
if ( BUILD_SHARED_LIBS )
. for my.dependencies.dependency as _depend
set( $(package_name(_depend, configuration))_USE_STATIC_LIBS "OFF" )
@@ -997,7 +948,6 @@ $(my.indent)$(my.symbol)
.macro emit_compiler_check_includes(repository)
. define my.repository = emit_compiler_check_includes.repository
.
-
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
@@ -1006,7 +956,6 @@ include(CheckCXXSourceCompiles)
.macro emit_link_option_check_includes(repository)
. define my.repository = emit_link_option_check_includes.repository
.
-
include(CheckLinkerFlag)
.endmacro # emit_link_option_check_includes
.
diff --git a/templates/gnu/Makefile.am.gsl b/templates/gnu/Makefile.am.gsl
new file mode 100644
index 00000000..f1c4d58a
--- /dev/null
+++ b/templates/gnu/Makefile.am.gsl
@@ -0,0 +1,642 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL generate libbitcoin Makefile.am
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+# Note: expected context root libbitcoin-build/process directory
+[gsl].ignorecase = 0
+[gsl].shuffle = 0
+
+gsl from "../library/math.gsl"
+gsl from "../library/string.gsl"
+gsl from "../lib/xml.gsl"
+gsl from "../lib/debug.gsl"
+gsl from "../lib/filesystem.gsl"
+gsl from "../lib/output.gsl"
+gsl from "../lib/gnu-output.gsl"
+
+###############################################################################
+# Generation
+###############################################################################
+function generate_Makefile_am(configuration)
+ define my.configuration = generate_Makefile_am.configuration
+ require(my.configuration->templates, "templates", "resultpath")
+
+ define my.resource_name = "Makefile.am"
+ define my.template = my.configuration->templates->template(.name = "$(script)")
+
+ if !defined(my.template)
+ abort "Generator configuration missing."
+ endif
+
+ require(my.template, "template", "outpath")
+
+ for my.configuration.repository as _repository
+ define my.output_path = path_append(my.configuration->templates.resultpath, \
+ path_append(_repository.name, my.template.outpath))
+
+ define my.filename = my.resource_name
+
+ create_directory(my.output_path)
+
+ define my.out_file = path_append(my.output_path, my.filename)
+
+ notify(my.out_file)
+ output(my.out_file)
+
+ emit_Makefile_am(_repository, my.configuration, my.template)
+ close
+ endfor
+endfunction
+
+###############################################################################
+# Functions
+###############################################################################
+function target_contribution_set(target)
+ define my.target = target_contribution_set.target
+
+ if (name(my.target) = "library")
+ return "lib_LTLIBRARIES"
+ elsif (name(my.target) = "test")
+ return "check_PROGRAMS"
+ elsif (name(my.target) = "binary")
+ if is_defined_positive(my.target, "install")
+ return "bin_PROGRAMS"
+ else
+ return "noinst_PROGRAMS"
+ endif
+ else
+. abort "Unrecognized target type '$(name(my.target))'."
+ endif
+endfunction
+
+function target_output(target)
+ define my.target = target_output.target
+ define my.target_path_prefix = my.target->sources.path
+
+ if (name(my.target) = "library")
+ return "$(my.target_path_prefix)/$(my.target.name).la"
+ elsif (name(my.target) = "test")
+ return "$(my.target_path_prefix)/$(my.target.name)"
+ elsif (name(my.target) = "binary")
+ define my.bin_name = defined(my.target.output) ?? \
+ my.target.output ? my.target.name
+ return "$(my.target_path_prefix)/$(my.bin_name)"
+ else
+ abort "Unrecognized target type '$(name(my.target))'."
+ endif
+endfunction
+
+function target_var_prefix(target)
+ define my.target = target_var_prefix.target
+ define my.output = target_output(my.target)
+ return "$(my.output:c)"
+endfunction
+
+function target_link_suffix(target)
+ define my.target = target_link_suffix.target
+
+ if (name(my.target) = "library")
+ return "LIBADD"
+ elsif (name(my.target) = "test")
+ return "LDADD"
+ elsif (name(my.target) = "binary")
+ return "LDADD"
+ else
+ abort "Unrecognized target type '$(name(my.target))'."
+ endif
+endfunction
+
+function emit_include_headers(target, repository, configuration, meta)
+ define my.target = emit_include_headers.target
+ define my.repository = emit_include_headers.repository
+ define my.configuration = emit_include_headers.configuration
+ define my.meta = emit_include_headers.meta
+
+ new filedata as _filedata
+ new _filedata.substitutions as _subs
+ new _filedata.files as _files
+
+ define my.absolute_root = repository_absolute_path(\
+ my.repository, my.configuration)
+
+ # populate files
+ for my.target.headers as _file_source
+ populate_files_from_path(_subs, _files, my.meta->headers,\
+ _file_source, my.absolute_root, my.meta->path.prefix)
+ endfor
+
+ # emit_dir_include_headers
+ emit_dir_include_headers(_subs, _files,\
+ my.target, my.repository, my.configuration, my.meta)
+
+ endnew
+ endnew
+ endnew
+endfunction
+
+function emit_target_sources(prefix, target, repository, configuration, meta)
+ define my.prefix = emit_target_sources.prefix
+ define my.target = emit_target_sources.target
+ define my.repository = emit_target_sources.repository
+ define my.configuration = emit_target_sources.configuration
+ define my.meta = emit_target_sources.meta
+
+ new filedata as _filedata
+ new _filedata.substitutions as _subs
+ new _filedata.files as _files
+
+ define my.absolute_root = repository_absolute_path(\
+ my.repository, my.configuration)
+
+ # populate files
+ for my.target.sources as _file_source
+ populate_files_from_path(_subs, _files, my.meta->sources,\
+ _file_source, my.absolute_root, my.meta->path.prefix)
+ endfor
+
+ # emit_dir_target_sources
+ emit_dir_target_sources(_subs, _files, my.prefix,\
+ my.target, my.repository, my.configuration, my.meta)
+
+ endnew
+ endnew
+ endnew
+endfunction
+
+function best_path_match(host, childname, path)
+ define my.host = best_path_match.host
+ define my.childname = best_path_match.childname
+ define my.path = best_path_match.path
+
+ define my.result = my.host
+
+ if defined(my.host.path) & !starts_with(my.path, my.host.path)
+ return
+ endif
+
+ for my.host.$(my.childname) as _child
+ define my.child_result = best_path_match(_child, my.childname, my.path)?
+
+ if defined(my.child_result)
+ if defined(my.result.path)
+ if (string.length(my.child_result.path) > string.length(my.result.path))
+ my.result = my.child_result
+ endif
+ else
+ my.result = my.child_result
+ endif
+ endif
+ endfor
+
+ return my.result
+endfunction
+
+function linearize_annotate_sources(result, substitutions, files,\
+ target, repository, configuration, meta)
+ define my.result = linearize_annotate_sources.result
+ define my.substitutions = linearize_annotate_sources.substitutions
+ define my.files = linearize_annotate_sources.files
+ define my.target = linearize_annotate_sources.target
+ define my.repository = linearize_annotate_sources.repository
+ define my.configuration = linearize_annotate_sources.configuration
+ define my.meta = linearize_annotate_sources.meta
+
+ if !defined(my.files.path) & (count(my.files.file) > 0)
+ abort "Unexpected - container not a directory but contains files."
+ endif
+
+ if defined(my.files.path)
+ define my.sub = matches_substitution(my.substitutions, my.files.path)
+
+ define my.root_relative_path = string.substr(my.files.path, \
+ string.length(my.sub.absolute_path), \
+ string.length(my.files.path) - 1)
+
+ my.root_relative_path = left(my.root_relative_path, \
+ string.length(my.root_relative_path) - 1)
+
+ define my.relative_path = "$(my.sub.unprefixed_path)$(my.root_relative_path)"
+ define my.matchable_path = "$(my.sub.unprefixed_path)$(my.root_relative_path)"
+ define my.matching_declare = best_path_match(my.target, "sources", \
+ my.matchable_path)
+
+ if defined(my.matching_declare.option)
+ if !defined(my.result->option(this.option = my.matching_declare.option, this))
+ new my.result.option as _option
+ _option.option = my.matching_declare.option
+ endnew
+ endif
+ endif
+
+ for my.files.file as _file
+ copy _file to my.result
+ define my.copied = my.result->file((this.name = _file.name) &\
+ (this.path = _file.path), this)
+
+ my.copied.path = my.relative_path
+
+ if defined(my.matching_declare.option)
+ my.copied.option = my.matching_declare.option
+ endif
+ endfor
+ endif
+
+ for my.files.directory as _dir
+ linearize_annotate_sources(my.result, my.substitutions, \
+ _dir, my.target, my.repository, my.configuration, my.meta)
+ endfor
+endfunction
+
+###############################################################################
+# Generation
+###############################################################################
+.endtemplate
+.template 1
+.
+.macro emit_Makefile_am(repository, configuration, meta)
+. define my.repository = emit_Makefile_am.repository
+. define my.configuration = emit_Makefile_am.configuration
+. define my.meta = emit_Makefile_am.meta
+.
+. copyleft(my.repository.name)
+.
+. heading1("Automake settings.")
+. emit_automake_settings(my.meta)
+.
+. heading1("Distribute data.")
+. emit_pkgconfig_data(my.repository, my.configuration, my.meta)
+.
+. emit_doc_data(my.repository, my.configuration, my.meta)
+.
+. heading1("Libraries.")
+. for my.repository.library as _target
+. if !first()
+
+. endif
+.
+. emit_target(_target, my.repository, my.configuration, my.meta, !first())
+. endfor
+.
+. heading1("Tests.")
+. for my.repository.test as _target
+. if !first()
+
+. endif
+.
+. emit_target(_target, my.repository, my.configuration, my.meta, !first())
+. endfor
+.
+. if (count(my.repository.binary, !is_defined_positive(this, "install"), this) > 0)
+. heading1("Binaries.")
+. for my.repository.binary as _target where !is_defined_positive(_target, "install")
+. if !first()
+
+. endif
+.
+. emit_target(_target, my.repository, my.configuration, my.meta, !first())
+. endfor
+. endif
+.
+. if (count(my.repository.binary, is_defined_positive(this, "install"), this) > 0)
+. heading1("Installed Binaries.")
+. for my.repository.binary as _target where is_defined_positive(_target, "install")
+. if !first()
+
+. endif
+.
+. emit_target(_target, my.repository, my.configuration, my.meta, !first())
+. endfor
+. endif
+.endmacro # emit_Makefile_am
+.
+.macro emit_automake_settings(meta)
+. define my.meta = emit_automake_settings.meta
+.
+. if defined(my.meta->m4) & defined(my.meta->m4.path)
+. heading2("Look for macros in the '$(my.meta->m4.path)' subdirectory.")
+ACLOCAL_AMFLAGS = -I $(my.meta->m4.path)
+. endif
+.endmacro # emit_automake_settings
+.
+.macro emit_pkgconfig_data(repository, configuration, meta)
+. define my.repository = emit_pkgconfig_data.repository
+. define my.configuration = emit_pkgconfig_data.configuration
+. define my.meta = emit_pkgconfig_data.meta
+.
+. if (count(my.repository.library) > 0)
+. heading2("files => ${pkgconfigdir}")
+pkgconfig_DATA = \\
+.
+. for my.repository.library as _library
+. define my.suffix = last() ?? "" ? " \\"
+ $(_library.name).pc$(my.suffix)
+. endfor
+. endif
+.endmacro # emit_pkgconfig_data
+.
+.macro emit_doc_data(repository, configuration, meta)
+. define my.repository = emit_doc_data.repository
+. define my.configuration = emit_doc_data.configuration
+. define my.meta = emit_doc_data.meta
+.
+. if (count(my.meta.doc) > 0)
+
+. heading2("files => ${docdir}")
+doc_DATA = \\
+.
+. for my.meta.doc as _doc
+. define my.suffix = last() ?? "" ? " \\"
+ $(_doc.name)$(my.suffix)
+. endfor
+. endif
+.endmacro # emit_doc_data
+.
+.macro emit_target(target, repository, configuration, meta, append)
+. define my.target = emit_target.target
+. define my.repository = emit_target.repository
+. define my.configuration = emit_target.configuration
+. define my.meta = emit_target.meta
+. define my.append = emit_target.append
+.
+. define my.operator = my.append ?? "+=" ? "="
+.
+. define my.output = target_output(my.target)
+. define my.var_prefix = target_var_prefix(my.target)
+.
+. heading2("Target $(name(my.target)) '$(my.output)'")
+.
+. if defined(my.target.option)
+if $(my.target.type:c,upper)_$(my.target.option:c,upper)
+
+. endif
+.
+$(target_contribution_set(my.target)) $(my.operator) $(my.output)
+.
+. if (name(my.target) = "library")
+
+$(my.var_prefix)_LIBS = $(my.output)
+. endif
+.
+. emit_target_flags(my.var_prefix, my.target, \
+ my.repository, my.configuration, my.meta)
+.
+. emit_target_link_libraries(my.var_prefix, my.target, \
+ my.repository, my.configuration, my.meta)
+.
+. emit_target_sources(my.var_prefix, my.target, my.repository, my.configuration, my.meta)
+.
+. if (name(my.target) = "library")
+. if !first()
+
+. endif
+. emit_include_headers(my.target, my.repository, my.configuration, my.meta)
+. endif
+.
+. if ((name(my.target) = "test") & defined(my.target.runner))
+
+TESTS $(my.operator) $(my.target.runner)
+. endif
+.
+. if defined(my.target.option)
+. if (name(my.target) = "binary")
+
+target_$(my.target.option) = $(my.output)
+
+$(my.target.option): ${target_$(my.target.option)}
+. endif
+.
+
+endif $(my.target.type:c,upper)_$(my.target.option:c,upper)
+. endif
+.
+.endmacro # emit_target
+.
+.macro emit_target_flags(prefix, target, repository, configuration, meta)
+. define my.prefix = emit_target_flags.prefix
+. define my.target = emit_target_flags.target
+. define my.repository = emit_target_flags.repository
+. define my.configuration = emit_target_flags.configuration
+. define my.meta = emit_target_flags.meta
+.
+. new flattened_headers as _flattened_headers
+. for my.target.headers as _headers where is_defined_positive(_headers, "root")
+. linearize(_flattened_headers, _headers)
+. endfor
+
+$(my.prefix)_CPPFLAGS = \\
+.
+. define my.has_depend_entries = (count(my.target.dependency) > 0)
+.
+. for _flattened_headers.headers as _headers
+. define my.suffix = (my.has_depend_entries | !last()) ?? " \\" ? ""
+.
+ -I$(my.meta->path.prefix)/$(_headers.path)$(my.suffix)
+. endfor
+.
+. for my.target.dependency as _depend
+. define my.is_last_depend = last()
+. define my.suffix_depend = (my.is_last_depend &\
+ !(count(_depend.component) > 0)) ?? "" ? " \\"
+.
+. define my.repolib = my.repository->library(this.name = _depend.name, this)?
+.
+. if defined(my.repolib)
+ ${$(target_var_prefix(my.repolib))_CPPFLAGS}$(my.suffix_depend)
+. else
+ ${$(_depend.name:c)_BUILD_CPPFLAGS}$(my.suffix_depend)
+. endif
+.
+. for _depend.component as _component
+. define my.suffix_component = (my.is_last_depend & last()) ??\
+ "" ? " \\"
+.
+ ${$(_depend.name:c)_$(_component.name:c)_BUILD_CPPFLAGS}$(my.suffix_component)
+. endfor
+. endfor
+
+$(my.prefix)_LDFLAGS = \\
+.
+. for my.target.dependency as _depend
+. define my.is_last_depend = last()
+. define my.suffix_depend = (my.is_last_depend &\
+ !(count(_depend.component) > 0)) ?? "" ? " \\"
+.
+. define my.repolib = my.repository->library(this.name = _depend.name, this)?
+.
+. if defined(my.repolib)
+ ${$(target_var_prefix(my.repolib))_LDFLAGS}$(my.suffix_depend)
+. else
+ ${$(_depend.name:c)_LDFLAGS}$(my.suffix_depend)
+. endif
+.
+. for _depend.component as _component
+. define my.suffix_component = (my.is_last_depend & last()) ??\
+ "" ? " \\"
+.
+ ${$(_depend.name:c)_$(_component.name:c)_LDFLAGS}$(my.suffix_component)
+. endfor
+. endfor
+. endnew
+.endmacro # emit_target_link_libraries
+.
+.macro emit_target_link_libraries(prefix, target, repository, configuration, meta)
+. define my.prefix = emit_target_link_libraries.prefix
+. define my.target = emit_target_link_libraries.target
+. define my.repository = emit_target_link_libraries.repository
+. define my.configuration = emit_target_link_libraries.configuration
+. define my.meta = emit_target_link_libraries.meta
+.
+. if (count(my.target.dependency) > 0)
+
+$(my.prefix)_$(target_link_suffix(my.target)) = \\
+. for my.target.dependency as _depend
+. define my.is_last_depend = last()
+. define my.suffix_depend = (my.is_last_depend & !(count(_depend.component) > 0)) ??\
+ "" ? " \\"
+.
+. define my.repolib = my.repository->library(this.name = _depend.name, this)?
+.
+. if defined(my.repolib)
+ ${$(target_var_prefix(my.repolib))_LIBS} \\
+ ${$(target_var_prefix(my.repolib))_LIBADD}$(my.suffix_depend)
+. else
+ ${$(_depend.name:c)_LIBS}$(my.suffix_depend)
+. endif
+.
+. for _depend.component as _component
+. define my.suffix_component = (my.is_last_depend & last()) ??\
+ "" ? " \\"
+.
+ ${$(_depend.name:c)_$(_component.name:c)_LIBS}$(my.suffix_component)
+. endfor
+. endfor
+. endif
+.endmacro # emit_target_link_libraries
+.
+.macro emit_dir_target_sources(substitutions, files, prefix,\
+ target, repository, configuration, meta)
+.
+. define my.substitutions = emit_dir_target_sources.substitutions
+. define my.files = emit_dir_target_sources.files
+. define my.prefix = emit_dir_target_sources.prefix
+. define my.target = emit_dir_target_sources.target
+. define my.repository = emit_dir_target_sources.repository
+. define my.configuration = emit_dir_target_sources.configuration
+. define my.meta = emit_dir_target_sources.meta
+.
+. new linearized as _linearized
+. linearize_annotate_sources(_linearized, \
+ my.substitutions, my.files, my.target, my.repository, \
+ my.configuration, my.meta)
+.
+. if (count(_linearized.file) > 0)
+
+$(my.prefix)_SOURCES = \\
+.
+. for _linearized.file as _file where !defined(_file.option)
+. define my.suffix = last() ?? "" ? " \\"
+ $(my.meta->path.prefix)/$(_file.path)/$(_file.name)$(my.suffix)
+. endfor
+.
+. for _linearized.option as _option
+. define my.optionflag = get_option(_option, \
+ my.target, my.repository, "_")
+.
+
+if $(my.optionflag:upper)
+
+$(my.prefix)_SOURCES += \\
+. for _linearized.file as _file where defined(_file.option) &\
+ (_file.option = _option.option)
+.
+. define my.suffix = last() ?? "" ? " \\"
+ $(my.meta->path.prefix)/$(_file.path)/$(_file.name)$(my.suffix)
+. endfor
+
+endif $(my.optionflag:upper)
+. endfor
+. endif
+. endnew
+.endmacro # emit_dir_target_sources
+.
+.macro emit_dir_include_headers(substitutions, files,\
+ target, repository, configuration, meta)
+.
+. define my.substitutions = emit_dir_include_headers.substitutions
+. define my.files = emit_dir_include_headers.files
+. define my.target = emit_dir_include_headers.target
+. define my.repository = emit_dir_include_headers.repository
+. define my.configuration = emit_dir_include_headers.configuration
+. define my.meta = emit_dir_include_headers.meta
+.
+. define my.optionflag = ""
+.
+. if defined(my.files.path)
+. define my.applicable_sub = matches_substitution(my.substitutions, my.files.path)
+.
+. define my.root_relative_path = string.substr(my.files.path, \
+ string.length(my.applicable_sub.absolute_path), \
+ string.length(my.files.path) - 1)
+.
+. my.root_relative_path = left(my.root_relative_path, \
+ string.length(my.root_relative_path) - 1)
+.
+. define my.matchable_path = "$(my.applicable_sub.unprefixed_path)$(my.root_relative_path)"
+. define my.matching_declare = best_path_match(my.target, "headers", \
+ my.matchable_path)
+.
+. if defined(my.matching_declare.option) &\
+ (my.matching_declare.path = my.matchable_path)
+.
+. my.optionflag = get_option(my.matching_declare, my.target, my.repository, "_")
+.
+
+if $(my.optionflag:upper)
+. endif
+.
+. if (count(my.files.file) > 0)
+.
+. define my.prefix = "include$(my.root_relative_path:c)"
+. define my.destination_path = "${includedir}$(my.root_relative_path)"
+. define my.make_relative_path = "$(my.meta->path.prefix)/$(my.applicable_sub.unprefixed_path)$(my.root_relative_path)"
+.
+.# leading blank space
+
+$(my.prefix)dir = \\
+ $(my.destination_path)
+
+$(my.prefix)_HEADERS = \\
+. for my.files.file as _file
+. define my.suffix = last() ?? "" ? " \\"
+ $(my.make_relative_path)/$(_file.name)$(my.suffix)
+. endfor
+. endif
+. endif
+.
+. for my.files.directory as _directory
+. emit_dir_include_headers(my.substitutions, _directory,\
+ my.target, my.repository, my.configuration, my.meta)
+. endfor
+.
+. if !(my.optionflag = "")
+
+endif $(my.optionflag:upper)
+. endif
+.
+.endmacro # emit_include_headers
+.
+.endtemplate
+.template 0
+###############################################################################
+# Execution
+###############################################################################
+
+generate_Makefile_am(configuration)
+
+.endtemplate
diff --git a/templates/gnu/configure.ac.gsl b/templates/gnu/configure.ac.gsl
new file mode 100644
index 00000000..b9f9aa52
--- /dev/null
+++ b/templates/gnu/configure.ac.gsl
@@ -0,0 +1,706 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL generate libbitcoin configure.ac
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+# Note: expected context root libbitcoin-build/process directory
+[gsl].ignorecase = 0
+[gsl].shuffle = 0
+
+gsl from "../library/math.gsl"
+gsl from "../library/string.gsl"
+gsl from "../lib/xml.gsl"
+gsl from "../lib/debug.gsl"
+gsl from "../lib/filesystem.gsl"
+gsl from "../lib/output.gsl"
+gsl from "../lib/gnu-output.gsl"
+
+###############################################################################
+# Generation
+###############################################################################
+function generate_configure_ac(configuration)
+ define my.configuration = generate_configure_ac.configuration
+ require(my.configuration->templates, "templates", "resultpath")
+
+ define my.resource_name = "configure.ac"
+ define my.template = my.configuration->templates->template(.name = "$(script)")
+
+ if !defined(my.template)
+ abort "Generator configuration missing."
+ endif
+
+ require(my.template, "template", "outpath")
+
+ for my.configuration.repository as _repository
+ define my.output_path = path_append(my.configuration->templates.resultpath, \
+ path_append(_repository.name, my.template.outpath))
+
+ define my.filename = my.resource_name
+
+ create_directory(my.output_path)
+
+ define my.out_file = path_append(my.output_path, my.filename)
+
+ notify(my.out_file)
+ output(my.out_file)
+
+ emit_configure_ac(_repository, my.configuration, my.template)
+ close
+ endfor
+endfunction
+
+###############################################################################
+# Functions
+###############################################################################
+
+function has_options(repository)
+ define my.repository = has_options.repository
+ define my.count = 0
+
+ for my.repository. as _target where is_target_element(_target)
+ my.count += count(_target.option)
+ endfor
+
+ return (my.count > 0)
+endfunction
+
+function has_compiler_defines(repository)
+ define my.repository = has_compiler_defines.repository
+ define my.count = 0
+
+ for my.repository. as _target where is_target_element(_target)
+ my.count += count(_target->compiler.define)
+ endfor
+
+ return (my.count > 0)
+endfunction
+
+function indent_add(indent, step)
+ define my.indent = indent_add.indent
+ define my.step = indent_add.step
+ return "$(my.indent)$(my.step)"
+endfunction
+
+function indent_remove(indent, step)
+ define my.indent = indent_remove.indent
+ define my.step = indent_remove.step
+ return right(my.indent, string.length(my.indent) - string.length(my.step))
+endfunction
+
+function emit_conditional_includes(repository, configuration, meta)
+ define my.repository = emit_conditional_includes.repository
+ define my.configuration = emit_conditional_includes.configuration
+ define my.meta = emit_conditional_includes.meta
+
+ for my.repository. as _target where is_target_element(_target)
+ for _target.headers as _headers where is_defined_positive(_headers, "root")
+
+ emit_conditional_includes_recursive(_headers, _target, \
+ my.repository, my.configuration, my.meta)
+ endfor
+ endfor
+endfunction
+
+###############################################################################
+# Generation
+###############################################################################
+.endtemplate
+.template 1
+.
+.macro emit_configure_ac(repository, configuration, meta)
+. define my.repository = emit_configure_ac.repository
+. define my.configuration = emit_configure_ac.configuration
+. define my.meta = emit_configure_ac.meta
+.
+. copyleft(my.repository.name)
+
+# Standard declarations.
+#==============================================================================
+# Requires Automake 1.14 or newer.
+
+# Declare the required version of Autoconf.
+AC_PREREQ([$(my.meta->autoconf.version)])
+
+# Process command-line arguments and perform initialization and verification.
+. define my.version = my.repository->version
+AC_INIT([$(my.repository.name)], [$(my.version.major).$(my.version.minor).0], [$(my.repository.email)])
+
+# Do compilation tests.
+AC_LANG($(my.meta->autoconf.language))
+
+# Specify the temporary directory for build tools.
+AC_CONFIG_AUX_DIR([build-aux])
+
+# Specify the directory of additional local Autoconf macros.
+AC_CONFIG_MACRO_DIR([m4])
+
+# Run macros for operation of generated Makefiles, enable non-recursive make.
+# Unless [foreign] is specified standard GNU files will be required,
+# specifically: AUTHORS, COPYING, INSTALL, NEWS, README and ChangeLog.
+AM_INIT_AUTOMAKE([subdir-objects])
+
+# Enable C and POSIX extensions that may be disabled on certain platforms.
+AC_USE_SYSTEM_EXTENSIONS
+
+# Enable the archiver.
+AM_PROG_AR
+
+# Initialize libtool.
+LT_PREREQ($(my.meta->libtool.version))
+
+# Enable shared libraries if available, and static if they don't conflict.
+LT_INIT
+AC_SUBST([LIBTOOL_DEPS])
+
+# Determine $(my.meta->autoconf.language) compiler to use.
+. if (my.meta->autoconf.language = "C++")
+AC_PROG_CXX
+. elsif (my.meta->autoconf.languge = "C")
+AC_PROG_CC
+. else
+. abort "Unsupported language '$(my.meta->autoconf.language)'."
+. endif
+
+# Enable sed for substitution.
+AC_PROG_SED
+
+# Compute the canonical host-system type variable host, including host_os.
+AC_CANONICAL_HOST
+
+# Enable silent rules option.
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+# Check for pkg-config.
+PKG_PROG_PKG_CONFIG
+AS_IF([test -n "${PKG_CONFIG}"], [],
+ [AC_MSG_ERROR([pkg-config is required but was not found.])])
+
+AS_IF([test "x${enable_static}" != "xno"],
+ [AC_SUBST([PKG_CONFIG], ["${PKG_CONFIG} --static"])])
+
+.heading2("Declare environment variables that affect the build.")
+AC_ARG_VAR([CC], "C compiler to use, such as gcc or clang")
+AC_ARG_VAR([CXX], "C++ compiler to use, such as g++ or clang++")
+AC_ARG_VAR([PKG_CONFIG_PATH], "Additional directories for package discovery.")
+
+repository_root_dir="@abs_top_srcdir@/../.."
+.
+. if (my.meta->autoconf.language = "C++")
+. require_stdcxx(my.repository, my.configuration, my.meta)
+. endif
+.
+. heading1("Process options.")
+. define my.encountered_option = 0
+. for my.meta.option as _option
+. if (my.encountered_option > 0)
+
+. endif
+. emit_option(_option, my.repository->library, my.configuration, my.meta)
+. my.encountered_option += 1
+. endfor
+.
+. for my.repository. as _target where is_target_element(_target) & defined(_target.option)
+. if (my.encountered_option > 0)
+
+. endif
+. emit_option(_target, _target, my.configuration, my.meta)
+. my.encountered_option += 1
+. endfor
+. for my.repository. as _target where is_target_element(_target)
+. for _target.option as _option
+. if (my.encountered_option > 0)
+
+. endif
+. emit_option(_option, _target, my.configuration, my.meta)
+. my.encountered_option += 1
+. endfor
+. endfor
+.
+. if has_compiler_defines(my.repository)
+. heading1("Set preprocessor defines.")
+. define my.encountered_define = 0
+. for my.repository. as _target where is_target_element(_target)
+. for _target->compiler.define as _define
+. if (my.encountered_define > 0)
+
+. endif
+. emit_define(_define, _target, my.repository, my.configuration, my.meta)
+. my.encountered_define += 1
+. endfor
+. endfor
+. endif
+.
+. new unique_flags as _flags
+. accumulate_flags(_flags, my.repository, my.configuration, my.meta)
+.
+. if (count(_flags.flag) > 0)
+. define my.encountered_flags = 0
+.
+. heading1("Set flags.")
+. for _flags.flag as _flag
+. if (my.encountered_flags > 0)
+
+. endif
+.
+. emit_flag(_flag, my.repository, my.configuration, my.meta)
+. my.encountered_flags += 1
+. endfor
+. endif
+. endnew
+.
+. new unique_dependencies as _dependencies
+. accumulate_repository_dependencies(_dependencies, my.repository)
+.
+. if (count(_dependencies.dependency) > 0)
+. heading1("Check dependencies.")
+. for _dependencies.dependency as _depend
+. if !first()
+
+. endif
+.
+. emit_dependency(_depend, my.repository, my.configuration, my.meta)
+. endfor
+. endif
+. endnew
+.
+. emit_conditional_includes(my.repository, my.configuration, my.meta)
+
+AC_CONFIG_FILES([
+ Makefile
+ $(my.repository.name).pc
+. for my.repository.configurable as _configurable
+ @repository_root_dir@/$(_configurable.path)$(_configurable.output)
+. endfor
+ ])
+
+AC_OUTPUT
+.endmacro # emit_configure_ac
+.
+.macro require_stdcxx(repository, configuration, meta)
+. define my.repository = require_stdcxx.repository
+. define my.configuration = require_stdcxx.configuration
+. define my.meta = require_stdcxx.meta
+.
+. define my.standard = ""
+.
+. for my.repository. as _target where is_target_element(_target)
+. if first()
+. my.standard = _target->compiler.standard
+. endif
+.
+. if !(my.standard = _target->compiler.standard)
+. abort "Inconsistent compiler standard '$(my.standard)' vs '$(_target->compiler.standard)'."
+. endif
+. endfor
+
+. heading2("Check for baseline language coverage in the compiler for the C++$(my.standard) standard.")
+AX_CXX_COMPILE_STDCXX([$(my.standard)], [noext], [mandatory])
+.endmacro # require_stdcxx
+.
+.macro emit_option(option, target, configuration, meta)
+. define my.option = emit_option.option
+. define my.target = emit_option.target
+. define my.configuration = emit_option.configuration
+. define my.meta = emit_option.meta
+.
+. require(my.option, "option", "name")
+. require(my.option, "option", "type")
+. require(my.option, "option", "comment")
+.
+. define my.name = defined(my.option.option) ?? my.option.option ? my.option.name
+. define my.datatype = defined(my.option.data_type) ?? my.option.data_type ? "boolean"
+. define my.optiontext = "--$(my.option.type)-$(my.name)"
+. define my.option_var = "$(my.option.type)_$(my.name)"
+.
+. define my.helpuse = defined(my.option.example) ?? my.option.example ? ""
+.
+. define my.treatment = defined(my.option.treatment) ?? my.option.treatment ? "none"
+.
+. define my.comment_default = defined(my.option.default) ?? \
+ " @<:@default=$(my.option.default)@:>@" ? ""
+.
+. if !is_defined_positive(my.option, "standard")
+AC_MSG_CHECKING([$(my.optiontext) option])
+. if (my.option.type = "enable")
+AC_ARG_ENABLE([$(my.name)],
+. elsif (my.option.type = "with")
+AC_ARG_WITH([$(my.name)],
+. else
+. abort "Unsupported option type '$(my.option.type)' in '$(my.option.string())'"
+. endif
+ AS_HELP_STRING([$(my.optiontext)$(my.helpuse)],
+ [$(my.option.comment)$(my.comment_default)]),
+ [$(my.option_var)=$$(my.option.type)val],
+ [$(my.option_var)=$(my.option.default)])
+AC_MSG_RESULT([$$(my.option_var)])
+.
+. if (my.datatype = "boolean")
+AM_CONDITIONAL([$(my.option_var:upper)], [test "x${$(my.option_var)}" != "xno"])
+. endif
+. endif
+.
+. if (my.treatment = "define")
+. define my.operation = (my.datatype = "boolean") ?? "AS_IF" ? "AS_CASE"
+. define my.consequence =
+. for my.option.on as _on
+. define my.test = is_defined_positive(_on, "value") ?? \
+ "!=" ? "=="
+.
+. define my.predicate = (my.datatype = "boolean") ?? \
+ "[test \"x${$(my.option_var)}\" $(my.test) \"xno\"]" ? \
+ "[${$(my.option_var)}], [$(_on.value)]"
+.
+$(my.operation)($(my.predicate), [AC_DEFINE([$(_on.define)])])
+.
+. for _on.substitute as _sub
+$(my.operation)($(my.predicate), [AC_SUBST([$(_sub.symbol)], [-D$(_sub.value)]))
+. endfor
+. endfor
+.
+. elsif (my.treatment = "substitute")
+.
+. if !(my.name = my.option_var)
+AC_SUBST([$(my.name)],[${$(my.option_var)}])
+. else
+AC_SUBST([$(my.name)])
+. endif
+.
+. elsif !(my.treatment = "none")
+. abort "Unrecognized treatment mode '$(my.treatment)'."
+. endif
+.
+.endmacro # emit_option
+.
+.macro emit_define(define, target, repository, configuration, meta)
+. define my.define = emit_define.define
+. define my.target = emit_define.target
+. define my.repository = emit_define.repository
+. define my.configuration = emit_define.configuration
+. define my.meta = emit_define.meta
+.
+. define my.indent = defined(my.define.option) ?? " " ? ""
+.
+. if defined(my.define.option)
+. define my.option = get_option(my.define, my.target, my.repository, "_")
+.
+AS_IF([test "x${$(my.option)}" != "xno"], [
+. endif
+.
+. for my.define.symbol as _symbol
+.
+. if defined(_symbol.name)
+$(my.indent)AC_DEFINE([$(_symbol.name)], [$(_symbol.value)])
+. else
+$(my.indent)AC_DEFINE([$(_symbol.value)])
+. endif
+.
+. for _symbol.substitute as _substitute
+. if defined(_substitute.name)
+$(my.indent)AC_SUBST([$(_substitute.name)], [-D$(_symbol.value)])
+. else
+$(my.indent)AC_SUBST([$(_symbol.value)])
+. endif
+. endfor
+. endfor
+.
+. if defined(my.define.option)
+ ])
+. endif
+.
+.endmacro # emit_define
+.
+.macro emit_flag(flag, repository, configuration, meta)
+. define my.flag = emit_flag.flag
+. define my.repository = emit_flag.repository
+. define my.configuration = emit_flag.configuration
+.
+. define my.step = " "
+. define my.indent = ""
+. define my.indent_as_if = ""
+. define my.indent_as_case = ""
+. define my.indent_check_compile = ""
+.
+. define my.count_targets = \
+ count(my.repository.library) + \
+ count(my.repository.test) + \
+ count(my.repository.binary)
+.
+. if defined(my.flag.option)
+. define my.target = my.repository->$(my.flag->target.type)(\
+ is_target_element(this) & (this.name = my.flag->target.name), this)
+.
+. define my.option = get_option(my.flag, my.target, my.repository, "_")
+.
+$(my.indent)AS_IF([test "x${$(my.option)}" != "xno"],
+. my.indent_as_if = indent_add(my.indent, my.step)
+. my.indent = indent_add(my.indent_as_if, my.step)
+$(my.indent_as_if)[
+. endif
+.
+. if defined(my.flag.compiler)
+$(my.indent)AS_CASE([${CC}], [*$(my.flag.compiler)*],
+. my.indent_as_case = indent_add(my.indent, my.step)
+$(my.indent_as_case)[
+. my.indent = indent_add(my.indent_as_case, my.step)
+. endif
+.
+. define my.symbol = symbol(my.flag)
+$(my.indent)AX_CHECK_COMPILE_FLAG([$(my.symbol)],
+. my.indent_check_compile = indent_add(my.indent, my.step)
+. my.indent = indent_add(my.indent_check_compile, my.step)
+$(my.indent_check_compile)[
+.
+. for my.flag.context as _context
+. define my.flagvar = ""
+. if (_context.language = "c")
+. my.flagvar = "CFLAGS"
+. elsif (_context.language = "c++")
+. my.flagvar = "CXXFLAGS"
+. else
+. abort "Unrecognized language '$(_context.language)'."
+. endif
+.
+. if defined(my.flag->program)
+$(my.indent)$(my.flagvar)="${$(my.flagvar)} $(my.symbol)";
+. else
+. if (count(my.flag.target) = my.count_targets)
+$(my.indent)$(my.flagvar)="${$(my.flagvar)} $(my.symbol)";
+. else
+. for my.flag.target as _target
+$(my.indent)$(_target.name:lower,c)_$(my.flagvar)="${$(_target.name:lower,c)_$(my.flagvar)} $(my.symbol)";
+. endfor
+. endif
+. endif
+. endfor
+.
+. if defined(my.flag.substitute)
+$(my.indent)AC_SUBST([$(my.flag.substitute)], ["$(my.symbol)"])
+. endif
+.
+. if defined(my.flag->program)
+$(my.indent_check_compile)],[
+$(my.indent)AC_MSG_ERROR([$(my.symbol) not supported.])
+$(my.indent_check_compile)],
+$(my.indent_check_compile)[],
+$(my.indent_check_compile)[
+$(my.indent)AC_LANG_PROGRAM(
+.
+. define my.indent_program = indent_add(my.indent, my.step)
+. define my.indent = indent_add(my.indent_program, my.step)
+.
+$(my.indent_program)[[
+. for my.flag->program.include as _include
+$(my.indent)#include <$(_include.header)>
+. endfor
+$(my.indent_program)]],
+$(my.indent_program)[[
+. for my.flag->program.loc as _loc
+$(my.indent)$(_loc)
+. endfor
+$(my.indent_program)]])
+. my.indent = indent_remove(my.indent, my.step)
+. my.indent = indent_remove(my.indent, my.step)
+. endif
+$(my.indent_check_compile)])
+. my.indent = indent_remove(my.indent, my.step)
+. my.indent = indent_remove(my.indent, my.step)
+.
+. if defined(my.flag.compiler)
+. my.indent = indent_remove(my.indent, my.step)
+$(my.indent)])
+. my.indent = indent_remove(my.indent, my.step)
+. endif
+.
+. if defined(my.flag.option)
+. my.indent = indent_remove(my.indent, my.step)
+$(my.indent_as_if)])
+. my.indent = indent_remove(my.indent, my.step)
+. endif
+.
+.endmacro # emit_flag
+.
+.macro emit_dependency(dependency, repository, configuration, meta)
+. define my.dependency = emit_dependency.dependency
+. define my.repository = emit_dependency.repository
+. define my.configuration = emit_dependency.configuration
+. define my.meta = emit_dependency.meta
+.
+. define my.registrar = my.configuration->registrar(this.id = "dependency", this)
+. new my.dependency.canonical as _canonical
+. canonicalize_element(_canonical, my.dependency, my.registrar, "name")
+. endnew
+.
+. define my.indent = ""
+. define my.step = " "
+.
+. if defined(my.dependency.option)
+. define my.target = my.repository->$(my.dependency->context.type)(this.name = my.dependency->context.name, this)
+. define my.optiontext = get_option(my.dependency, my.target, my.repository, "_")
+.
+AS_IF([test "x${$(my.optiontext)}" != "xno"],
+ [
+. my.indent = indent_add(my.indent, my.step)
+. endif
+.
+. if (my.dependency.name = "boost")
+. emit_dependency_boost(my.dependency, my.repository, \
+ my.configuration, my.meta, my.indent, my.step)
+. elsif defined(my.dependency->canonical->dependency->pkg)
+. emit_dependency_pkg_check_modules(my.dependency, \
+ my.repository, my.configuration, my.meta,\
+ my.indent, my.step)
+. else
+. abort "Unsupported dependency '$(my.dependency.name)'."
+. endif
+.
+. if defined(my.dependency.option)
+ ])
+. endif
+.
+.endmacro # emit_dependency
+.
+.macro emit_dependency_pkg_check_modules(dependency,\
+ repository, configuration, meta, indent, step)
+.
+. define my.dependency = emit_dependency_pkg_check_modules.dependency
+. define my.repository = emit_dependency_pkg_check_modules.repository
+. define my.configuration = emit_dependency_pkg_check_modules.configuration
+. define my.meta = emit_dependency_pkg_check_modules.meta
+. define my.indent = emit_dependency_pkg_check_modules.indent
+. define my.step = emit_dependency_pkg_check_modules.step
+.
+. define my.prefix = "$(my.dependency.name:c)"
+. define my.pkg = my.dependency->canonical->dependency->pkg
+.
+. define my.pkg_name = defined(my.pkg.name) ?? \
+ my.pkg.name ? my.dependency.name
+.
+. define my.condition = "$(my.pkg_name) >= $(my.dependency.version)"
+.
+$(my.indent)PKG_CHECK_MODULES(
+ $(my.indent)[$(my.prefix)],
+ $(my.indent)[$(my.condition)],
+ $(my.indent)[],
+ $(my.indent)[
+ $(my.indent)AC_MSG_ERROR([$(my.condition) is required but was not found.])
+ $(my.indent)])
+$(my.indent)AC_SUBST([$(my.prefix)_PKG], ['$(my.condition)'])
+$(my.indent)AC_SUBST([$(my.prefix)_CPPFLAGS], [${$(my.prefix)_CFLAGS}])
+$(my.indent)AC_SUBST([$(my.prefix)_ISYS_CPPFLAGS], [`echo ${$(my.prefix)_CPPFLAGS} | ${SED} s/^-I/-isystem/g | ${SED} s/' -I'/' -isystem'/g`])
+$(my.indent)AC_MSG_NOTICE([$(my.prefix)_CPPFLAGS : ${$(my.prefix)_CPPFLAGS}])
+$(my.indent)AC_MSG_NOTICE([$(my.prefix)_ISYS_CPPFLAGS : ${$(my.prefix)_ISYS_CPPFLAGS}])
+$(my.indent)AC_MSG_NOTICE([$(my.prefix)_OTHER_CFLAGS : ${$(my.prefix)_OTHER_CFLAGS}])
+$(my.indent)AC_MSG_NOTICE([$(my.prefix)_INCLUDEDIR : ${$(my.prefix)_INCLUDEDIR}])
+$(my.indent)AC_MSG_NOTICE([$(my.prefix)_LIBS : ${$(my.prefix)_LIBS}])
+$(my.indent)AS_IF([test "x${enable_isystem}" != "xno"],
+ $(my.indent)[AC_SUBST([$(my.prefix)_BUILD_CPPFLAGS], [${$(my.prefix)_ISYS_CPPFLAGS}])],
+ $(my.indent)[AC_SUBST([$(my.prefix)_BUILD_CPPFLAGS], [${$(my.prefix)_CPPFLAGS}])])
+$(my.indent)AC_MSG_NOTICE([$(my.prefix)_BUILD_CPPFLAGS : ${$(my.prefix)_BUILD_CPPFLAGS}])
+.
+.endmacro # emit_dependency_pkg_check_modules
+.
+.macro emit_dependency_boost(dependency, repository, configuration, meta, indent, step)
+. define my.dependency = emit_dependency_boost.dependency
+. define my.repository = emit_dependency_boost.repository
+. define my.configuration = emit_dependency_boost.configuration
+. define my.meta = emit_dependency_boost.meta
+. define my.indent = emit_dependency_boost.indent
+. define my.step = emit_dependency_boost.step
+.
+$(my.indent)AX_BOOST_BASE([$(my.dependency.version)],
+ $(my.indent)[
+ $(my.indent)AC_SUBST([boost_CPPFLAGS], [${BOOST_CPPFLAGS}])
+ $(my.indent)AC_SUBST([boost_ISYSTEM_CPPFLAGS], [`echo ${boost_CPPFLAGS} | ${SED} s/^-I/-isystem/g | ${SED} s/' -I'/' -isystem'/g`])
+ $(my.indent)AC_SUBST([boost_LDFLAGS], [${BOOST_LDFLAGS}])
+ $(my.indent)AC_MSG_NOTICE([boost_CPPFLAGS : ${boost_CPPFLAGS}])
+ $(my.indent)AC_MSG_NOTICE([boost_ISYS_CPPFLAGS : ${boost_ISYS_CPPFLAGS}])
+ $(my.indent)AC_MSG_NOTICE([boost_LDFLAGS : ${boost_LDFLAGS}])
+ $(my.indent)],
+ $(my.indent)[
+ $(my.indent)AC_MSG_ERROR([Boost $(my.dependency.version) or later is required but was not found.])
+ $(my.indent)])
+
+$(my.indent)AS_IF([test "x${enable_isystem}" != "xno"],
+ $(my.indent)[ AC_SUBST([boost_BUILD_CPPFLAGS], [${boost_ISYSTEM_CPPFLAGS}]) ],
+ $(my.indent)[ AC_SUBST([boost_BUILD_CPPFLAGS], [${boost_CPPFLAGS}]) ])
+
+$(my.indent)AC_MSG_NOTICE([boost_BUILD_CPPFLAGS : ${boost_BUILD_CPPFLAGS}])
+.
+. for my.dependency.component as _component
+. define my.cname = "$(my.dependency.name:c)_$(_component.name:c)"
+. define my.uname = "$(my.cname:upper)"
+. define my.indent = ""
+
+. define my.clause = ""
+. for _component.context as _context
+. define my.separator = (my.clause = "") ?? "" ? " | "
+.
+. define my.target = my.repository->$(_context.type)\
+ (this.name = _context.name, this)
+.
+. if !defined(my.target.option)
+. next
+. endif
+.
+. my.clause = "$(my.clause)$(my.separator)(test \"x${$(my.target.type)_$(my.target.option)}\" != \"xno\")"
+. endfor
+.
+. if (string.length(my.clause) > 0)
+.
+$(my.indent)AS_IF([$(my.clause)],
+ $(my.indent)[
+.
+. my.indent = indent_add(my.indent, my.step)
+. endif
+.
+$(my.indent)AX_$(my.uname)
+$(my.indent)AC_SUBST([$(my.cname)_LIBS], [${$(my.uname)_LIB}])
+$(my.indent)AC_MSG_NOTICE([$(my.cname)_LIBS : ${$(my.cname)_LIBS}])
+.
+. if (string.length(my.clause) > 0)
+. my.indent = indent_remove(my.indent, my.step)
+ $(my.indent)])
+. endif
+. endfor
+.
+.endmacro # emit_dependency_boost
+.
+.macro emit_conditional_includes_recursive(headers, target, \
+ repository, configuration, meta)
+.
+. define my.headers = emit_conditional_includes_recursive.headers
+. define my.target = emit_conditional_includes_recursive.target
+. define my.repository = emit_conditional_includes_recursive.repository
+. define my.configuration = emit_conditional_includes_recursive.configuration
+. define my.meta = emit_conditional_includes_recursive.meta
+.
+. if defined(my.headers.substitute) & defined(my.headers.option) &\
+ is_defined_positive(my.headers, "root")
+.
+. define my.option_var = get_option(my.headers, my.target, my.repository, "_")
+. define my.path = string.replace(my.headers.path, "include|-I${includedir}")
+
+AS_IF([test "x${$(my.option_var)}" != "xno"],
+ [ AC_SUBST([$(my.headers.substitute)], [$(my.path)]) ])
+. endif
+.
+. for my.headers.headers as _headers
+. emit_conditional_includes_recursive(_headers, my.target, \
+ my.repository, my.configuration, my.meta)
+. endfor
+.endmacro # emit_conditional_includes_recursive
+.
+.endtemplate
+.template 0
+###############################################################################
+# Execution
+###############################################################################
+
+generate_configure_ac(configuration)
+
+.endtemplate
diff --git a/templates/gnu/pc.in.gsl b/templates/gnu/pc.in.gsl
new file mode 100644
index 00000000..f2cff933
--- /dev/null
+++ b/templates/gnu/pc.in.gsl
@@ -0,0 +1,254 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL generate libbitcoin .pc.in
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+# Note: expected context root libbitcoin-build/process directory
+[gsl].ignorecase = 0
+[gsl].shuffle = 0
+
+gsl from "../library/math.gsl"
+gsl from "../library/string.gsl"
+gsl from "../lib/xml.gsl"
+gsl from "../lib/debug.gsl"
+gsl from "../lib/filesystem.gsl"
+gsl from "../lib/output.gsl"
+gsl from "../lib/gnu-output.gsl"
+
+###############################################################################
+# Generation
+###############################################################################
+function generate_pc_in(configuration)
+ define my.configuration = generate_pc_in.configuration
+ require(my.configuration->templates, "templates", "resultpath")
+
+ define my.template = my.configuration->templates->template(.name = "$(script)")
+
+ if !defined(my.template)
+ abort "Generator configuration missing."
+ endif
+
+ require(my.template, "template", "outpath")
+
+ for my.configuration.repository as _repository
+ define my.output_path = path_append(my.configuration->templates.resultpath, \
+ path_append(_repository.name, my.template.outpath))
+
+ create_directory(my.output_path)
+
+ for _repository.library as _library
+ define my.filename = "$(_repository.name).pc.in"
+ define my.out_file = path_append(my.output_path, my.filename)
+
+ notify(my.out_file)
+ output(my.out_file)
+
+ emit_pc_in(_library, _repository, my.configuration, my.template)
+ close
+ endfor
+ endfor
+endfunction
+
+###############################################################################
+# Functions
+###############################################################################
+function accumulate_flag_components(result, target, dependencies, repository,\
+ configuration, meta)
+
+ define my.result = accumulate_flag_components.result
+ define my.target = accumulate_flag_components.target
+ define my.dependencies = accumulate_flag_components.dependencies
+ define my.repository = accumulate_flag_components.repository
+ define my.configuration = accumulate_flag_components.configuration
+ define my.meta = accumulate_flag_components.meta
+
+ new cumulative_headers as _cumulative
+ linearize(_cumulative, my.target->headers)
+
+ for _cumulative.headers as _headers where is_defined_positive(_headers, "root")
+ copy _headers to my.result
+ endfor
+ endnew
+
+ for my.target->compiler.define as _define
+ copy _define to my.result
+ endfor
+
+ new accumulated_flags as _flags
+ accumulate_target_flags(_flags, my.target, my.repository, my.configuration, my.meta)
+
+ for _flags.flag as _flag where defined(_flag.substitute)
+ copy _flag to my.result
+ endfor
+ endnew
+
+ for my.dependencies.dependency as _depend where !defined(_depend->pkg)
+ copy _depend to my.result
+ endfor
+endfunction
+
+function components_to_cppflags(result, components, iprefix, ireplacement)
+ define my.result = components_to_cppflags.result
+ define my.components = components_to_cppflags.components
+ define my.iprefix = components_to_cppflags.iprefix
+ define my.ireplacement = components_to_cppflags.ireplacement
+
+ for my.components.headers as _headers
+ new my.result.entry as _entry
+ if defined(_headers.option)
+ _entry.value = "@$(_headers.option)_include@"
+ else
+ define my.modified_path = string.replace(_headers.path, \
+ "$(my.iprefix)|$(my.ireplacement)")
+ _entry.value = "-I$(my.modified_path)"
+ endif
+ endnew
+ endfor
+
+ for my.components.define as _define
+ for _define.symbol as _symbol where defined(_symbol->substitute)
+ new my.result.entry as _entry
+ _entry.value = "@$(_symbol->substitute.name)@"
+ endnew
+ endfor
+ endfor
+
+ for my.components.flag as _flag where defined(_flag.substitute)
+ new my.result.entry as _entry
+ _entry.value = "@$(_flag.substitute)@"
+ endnew
+ endfor
+
+ for my.components.dependency as _depend where !defined(_depend->pkg)
+ new my.result.entry as _entry
+ _entry.value = "@$(_depend.name)_CPPFLAGS@"
+ endnew
+ endfor
+endfunction
+
+function components_to_libs(result, components)
+ define my.result = components_to_libs.result
+ define my.components = components_to_libs.components
+
+ for my.components.dependency as _depend where !defined(_depend->pkg)
+ new my.result.entry as _entry
+ _entry.value = "@$(_depend.name)_LDFLAGS@"
+ endnew
+
+ for _depend.component as _component
+ new my.result.entry as _entry
+ _entry.value = "@$(_depend.name)_$(_component.name)_LIBS@"
+ endnew
+ endfor
+ endfor
+endfunction
+
+function library_name(name)
+ define my.name = library_name.name
+ define my.prefix = "lib"
+
+ if starts_with(my.name, my.prefix)
+ return string.substr(my.name, string.length(my.prefix), \
+ string.length(my.name))
+ endif
+
+ return my.name
+endfunction
+
+###############################################################################
+# Generation
+###############################################################################
+.endtemplate
+.template 1
+.
+.macro emit_pc_in(library, repository, configuration, meta)
+. define my.library = emit_pc_in.library
+. define my.repository = emit_pc_in.repository
+. define my.configuration = emit_pc_in.configuration
+. define my.meta = emit_pc_in.meta
+.
+. copyleft(my.library.name)
+
+. heading1("Substitutions")
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+. heading1("Metadata")
+Name: $(my.library.name)
+Description: $(my.repository.description)
+.
+. define my.canonical = my.configuration->registrar(this.id = "dependency", this)\
+ ->dependency(this.name = my.repository.name, this)
+.
+URL: https://github.com/$(my.canonical->github.owner)/$(my.canonical.name)
+Version: @PACKAGE_VERSION@
+.
+. new canonical_dependencies as _dependencies
+. target_dependency_list(_dependencies,\
+ my.library, my.repository, my.configuration, 0)
+.
+. if (count(_dependencies.dependency, defined(this->pkg), this) > 0)
+
+. heading1("Variables")
+Requires: \\
+. for _dependencies.dependency as _depend where defined(_depend->pkg)
+. define my.suffix = last() ?? "" ? " \\"
+ @$(_depend.name:c)_PKG@$(my.suffix)
+. endfor
+. endif
+.
+. new flag_components as _components
+. accumulate_flag_components(_components, my.library, _dependencies, \
+ my.repository, my.configuration, my.meta)
+.
+. new flattened_cppflags as _cppflags
+. components_to_cppflags(_cppflags, _components, "include", "${includedir}")
+.
+. if (count(_cppflags.entry) > 0)
+
+Cflags: \\
+.
+. for _cppflags.entry as _entry
+. my.suffix = last() ?? "" ? " \\"
+ $(_entry.value)$(my.suffix)
+. endfor
+. endif
+. endnew
+.
+. new flattened_libs as _libs
+. components_to_libs(_libs, _components)
+.
+
+Libs: \\
+ -L${libdir} \\
+ -l$(library_name(my.library.name))$((count(_libs.entry) > 0) ?? " \\" ? "")
+.
+. if (count(_libs.entry) > 0)
+.
+. for _libs.entry as _entry
+. my.suffix = last() ?? "" ? " \\"
+ $(_entry.value)$(my.suffix)
+. endfor
+. endif
+. endnew
+. endnew
+. endnew
+.
+.endmacro # emit_pc_in
+.
+.endtemplate
+.template 0
+###############################################################################
+# Execution
+###############################################################################
+
+generate_pc_in(configuration)
+
+.endtemplate
diff --git a/templates/gsl.Makefile.am b/templates/gsl.Makefile.am
deleted file mode 100644
index 2182e1f3..00000000
--- a/templates/gsl.Makefile.am
+++ /dev/null
@@ -1,796 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin Makefile.am.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-#------------------------------------------------------------------------------
-# Get Automake Variable
-#------------------------------------------------------------------------------
-
-# Map the prefix to the primary symbol (this is a simplified mapping).
-function get_primary(product)
- define my.product = get_primary.product
- if (is_data(my.product))
- return "DATA"
- elsif (is_headers(my.product))
- return "HEADERS"
- elsif (is_java(my.product))
- return "JAVA"
- elsif (is_info(my.product))
- return "TEXINFOS"
- elsif (is_library(my.product))
- return "LTLIBRARIES"
- elsif (is_manual(my.product))
- return "MANS"
- elsif (is_program(my.product))
- return "PROGRAMS"
- elsif (is_python(my.product))
- return "PYTHON"
- elsif (is_script(my.product))
- return "SCRIPTS"
- endif
- abort "Unknown automake primary for prefix: '$(my.product.prefix)'"
-endfunction
-
-function get_qualified_prefix(product)
- define my.product = get_qualified_prefix.product
- require(my.product, "product", "prefix")
- define my.prefix = my.product.prefix
- define my.install = ""
- define my.distribute = ""
-
- # dist and nodist qualifications are mutually-exclusive and allow no check.
- if (!is_check(my.product))
- if (is_no_distribute(my.product))
- my.distribute = "nodist"
- elsif (is_distribute(my.product))
- my.distribute = "dist"
- endif
- endif
-
- # check and noinst qualifications are mutually-exclusive and use no prefix.
- if (is_check(my.product) | is_no_install(my.product))
- my.prefix = ""
- if (is_check(my.product))
- my.install = "check"
- elsif (is_no_install(my.product))
- my.install = "noinst"
- endif
- endif
-
- # join and return the non-empty parts
- return join(join(my.distribute, my.install, "_"), my.prefix, "_")
-endfunction
-
-# Get automake tag of the form: qualified-prefix[_container]
-function get_tag(product, container)
- define my.product = get_tag.product
- if (is_empty(my.container))
- my.container = my.product.container ? ""
- endif
- if (!is_empty(my.container))
- my.container = "_$(my.container:c)"
- endif
- define my.qualified_prefix = get_qualified_prefix(my.product)
- return "$(my.qualified_prefix)$(my.container)"
-endfunction
-
-function get_automake_variable(product, segment)
- define my.product = get_automake_variable.product
- define my.tag = get_tag(my.product, my.segment)
- return join(my.tag, get_primary(my.product), "_")
-endfunction
-
-#------------------------------------------------------------------------------
-# Get Automake Install
-#------------------------------------------------------------------------------
-
-# Get the target attribute, defaulting to [prefix]dir, bracketed as ${target}.
-function get_target(product)
- require(my.product, "product", "prefix")
- define my.prefix = my.product.prefix
-
- # Workaround for failure of automake to properly handle noinst_JAVA.
- if (is_java(my.product) & is_no_install(my.product))
- my.prefix = "build"
- endif
- define my.target = "$(my.prefix)dir"
- return "${$(my.target)}"
-endfunction
-
-# Get the full install location.
-function get_install(product, container)
- define my.product = get_install.product
- if (is_empty(my.container))
- my.container = my.product.container ?
- endif
- if (is_empty(my.container))
- return ""
- else
- my.container = "$(my.container)"
- endif
- define my.target = get_target(my.product)
- return "$(my.target)/$(my.container)"
-endfunction
-
-#------------------------------------------------------------------------------
-# Get Product/Runner Path
-#------------------------------------------------------------------------------
-
-# Normalize the library name (as "name[.la]").
-function get_archive_name(library, repository)
- define my.library = get_archive_name.library
- define my.repository = get_archive_name.repository
- return "$(target_name(my.library, my.repository)).la"
-endfunction
-
-# Normalize the product name.
-function get_product_name(product, repository)
- define my.product = get_product_name.product
- define my.repository = get_product_name.repository
- if (is_program(my.product))
- return target_name(my.product, my.repository)
- elsif (is_library(my.product))
- return get_archive_name(my.product, my.repository)
- endif
- return ""
-endfunction
-
-# Create the product path.
-function get_product_path(product, repository)
- define my.product = get_product_path.product
- define my.repository = get_product_path.repository
- return join(my.product.path, get_product_name(my.product, my.repository))
-endfunction
-
-# Get the command to execute the test runner. If there is a runner element the
-# test runner is a generated script ${sourcedir}/[product.name]_runner.sh.
-# Otherwise the runner is ${sourcedir}/[product.path]/[product.name].
-function get_runner_path(product, repository)
- define my.product = get_runner_path.product
- define my.repository = get_runner_path.repository
- define my.name = get_product_name(my.product, my.repository)
- if (defined(my.product->runner))
- return "$(my.name)_runner.sh"
- endif
- return join(my.product.path, my.name)
-endfunction
-
-#------------------------------------------------------------------------------
-# Render Files Variables
-#------------------------------------------------------------------------------
-
-function serialize_sources(files)
- define my.files = serialize_sources.files
- define my.buffer = ""
- for my.files.row as _row
- my.buffer += " \\\n $(_row.name)"
- endfor
- return my.buffer
-endfunction
-
-function get_all_sources(folder, trim, product)
- define my.product = get_all_sources.product
- new files as _files
- get_all_product_files(_files, my.folder, my.trim, my.product)
- return serialize_sources(_files)
- endnew
-endfunction
-
-function render_sources(files, folder, base_trim, path_trim, product, mapper)
- define my.files = render_sources.files
- define my.product = render_sources.product
- define my.mapper = render_sources.mapper
- get_product_files(my.files, my.folder, my.base_trim, my.product, 1)
- if (!table_empty(my.files))
- # Don't write a tautology, such as: installdir = ${installdir}
- define my.trim = my.base_trim + my.path_trim + 1
- define my.relative = difference(my.folder, my.trim)
- define my.segment = join(my.product.container, my.relative)
- define my.install = get_install(my.product, my.segment)
- if (!is_empty(my.install))
- define my.tag = get_tag(my.product, my.segment)
- write_line("$(my.tag)dir = $(my.install)")
- endif
- define my.paths = serialize_sources(my.files)
- define my.op = get_assignment_operator(my.mapper, my.variable)
- define my.variable = get_automake_variable(my.product, my.segment)
- write_line("$(my.variable) $(my.op)$(my.paths)\n")
- table_clear(my.files)
- endif
-
- # Recurse the directory tree, rendering all files.
- define my.directory = open_directory(my.folder)
- for my.directory.directory as _directory by _directory.name
- define my.subfolder = "$(_directory.path)$(_directory.name)"
- render_sources(my.files, my.subfolder, my.base_trim, my.path_trim,\
- my.product, my.mapper)
- endfor
-endfunction
-
-#
-# Recurse directory tree, rendering outputs with files for each folder.
-function render_files_variables(folder, base_trim, path_trim, product, mapper)
- define my.product = render_files_variables.product
- define my.mapper = render_files_variables.mapper
- new files as _files
- render_sources(_files, my.folder, my.base_trim, my.path_trim,\
- my.product, my.mapper)
- endnew
-endfunction
-
-#------------------------------------------------------------------------------
-# Render CPP Variables
-#------------------------------------------------------------------------------
-
-function get_tests_variable(mapper, product, repository)
- define my.mapper = get_tests_variable.mapper
- define my.product = get_tests_variable.product
- define my.repository = get_tests_variable.repository
- define my.path = get_runner_path(my.product, my.repository)
- define my.variable = "TESTS"
- define my.operator = get_assignment_operator(my.mapper, my.variable)
- return "$(my.variable) $(my.operator) $(my.path)"
-endfunction
-
-function get_binaries_variable(mapper, product, repository)
- define my.mapper = get_binaries_variable.mapper
- define my.product = get_binaries_variable.product
- define my.repository = get_binaries_variable.repository
- define my.path = get_product_path(my.product, my.repository)
- define my.variable = get_automake_variable(my.product)
- define my.operator = get_assignment_operator(my.mapper, my.variable)
- return "$(my.variable) $(my.operator) $(my.path)"
-endfunction
-
-function initialize_cpp_variables(variables)
- define my.variables = initialize_cpp_variables.variables
- my.variables.libs = ""
- my.variables.ld_flags = ""
- my.variables.ccc_flags = ""
- my.variables.cxx_flags = ""
- my.variables.cpp_flags = ""
- my.variables.sources = ""
-endfunction
-
-# For each library of this product that references another product,
-# copy the other product's library elements into this product element.
-# This function is not idempotent, call only once for a given product.
-function chase_libraries(product, make, repository)
- define my.product = chase_libraries.product
- define my.make = chase_libraries.make
- define my.repository = chase_libraries.repository
- define my.cursor = set_cursor_end(my.product)
- for my.product.library as _library
- define my.chase_product = find_library_product(_library.name,\
- my.make, my.repository)?
- if (defined(my.chase_product))
- for my.chase_product.library as _chase_library
- copy _chase_library before my.cursor
- endfor
- endif
- endfor
- clear_cursor(my.cursor)
-endfunction
-
-# Format the flag either as a literal flag or a dereferenced variable.
-function get_flag(flag)
- define my.flag = get_flag.flag
- if (defined(my.flag.value))
- return "-$(my.flag.value)"
- elsif (defined(my.flag.define))
- return "-D$(my.flag.define:upper)=\\\"${$(my.flag.define)}\\\""
- elsif (defined(my.flag.substitute))
- return "${$(my.flag.substitute)}"
- endif
- abort "Required attribute missing: flag.value|define|substitute"
-endfunction
-
-function define_cpp_flag_variable(variables, flag)
- define my.variables = define_cpp_flag_variable.variables
- define my.flag = define_cpp_flag_variable.flag
- define my.flag_value = " $(get_flag(my.flag))"
- if (is_ccc_flag(my.flag))
- my.variables.ccc_flags += my.flag_value
- elsif (is_cxx_flag(my.flag))
- my.variables.cxx_flags += my.flag_value
- elsif (is_cpp_flag(my.flag))
- my.variables.cpp_flags += my.flag_value
- else
- define my.context = my.flag.context ? ""
- abort "Invalid flag context: '$(my.context)'."
- endif
-endfunction
-
-function define_cpp_lib_variables(variables, library, make, configure, repository)
- define my.variables = define_cpp_lib_variables.variables
- define my.library = define_cpp_lib_variables.library
- define my.make = define_cpp_lib_variables.make
- define my.configure = define_cpp_lib_variables.configure
- define my.repository = define_cpp_lib_variables.repository
- require(my.library, "library", "name")
- define my.product = find_library_product(my.library.name, my.make,\
- my.repository)?
- if (defined(my.product))
- define my.archive_name = get_archive_name(my.product, my.repository)
- my.archive_path = join(my.product.path, my.archive_name)
- my.variables.libs += " $(my.archive_path)"
- else
- define my.cname = "$(my.library.name:c)"
- define my.dependency = find_dependency_by_name(my.library.name,\
- my.configure)?
- if (!defined(my.dependency))
- abort "The product library has no dependency: $(my.library.name)"
- endif
- define my.is_package = is_package_dependency(my.dependency)
- define my.is_function = is_function_dependency(my.dependency)
- define my.is_boost = is_boost_dependency(my.dependency)
- define my.is_boost_lib = is_boost_lib_dependency(my.dependency)
- define my.is_language = is_java_dependency(my.dependency) |\
- is_python_dependency(my.dependency)
- define my.is_common = is_pthread_dependency(my.dependency) |\
- is_iconv_dependency(my.dependency)
-
- if (my.is_boost)
- my.variables.ld_flags += " ${$(my.cname)_LDFLAGS}"
- endif
- if (my.is_boost_lib | my.is_common | my.is_function | my.is_package)
- my.variables.libs += " ${$(my.cname)_LIBS}"
- endif
- if (my.is_boost | my.is_common | my.is_language | my.is_package)
- my.variables.cpp_flags += " ${$(my.cname)_BUILD_CPPFLAGS}"
- endif
- if (0)
- my.variables.ccc_flags += " ${$(my.cname)_CFLAGS}"
- endif
- if (0)
- my.variables.cxx_flags += " ${$(my.cname)_CXXFLAGS}"
- endif
- endif
-endfunction
-
-# Get the automake library add output variable type.
-function get_library_add(product)
- define my.product = get_library_add.product
- if (is_library(my.product))
- return "LIBADD"
- elsif (is_program(my.product))
- return "LDADD"
- endif
- abort "Unknown library type: '$(my.product.prefix)'"
-endfunction
-
-function write_cpp_variables(variables, product, repository)
- define my.variables = write_cpp_variables.variables
- define my.product = write_cpp_variables.product
- define my.repository = write_cpp_variables.repository
- define my.cpath = "$(get_product_path(my.product, my.repository):c)"
- if (defined(my.variables.tests))
- write_line("$(my.variables.tests)\n")
- endif
- if (defined(my.variables.binaries))
- write_line("$(my.variables.binaries)")
- endif
- if (!is_empty(my.variables.ccc_flags))
- write_line("$(my.cpath)_CFLAGS =$(my.variables.ccc_flags)")
- endif
- if (!is_empty(my.variables.cxx_flags))
- write_line("$(my.cpath)_CXXFLAGS =$(my.variables.cxx_flags)")
- endif
- if (!is_empty(my.variables.cpp_flags))
- write_line("$(my.cpath)_CPPFLAGS =$(my.variables.cpp_flags)")
- endif
- if (!is_empty(my.variables.ld_flags))
- write_line("$(my.cpath)_LDFLAGS =$(my.variables.ld_flags)")
- endif
- if (!is_empty(my.variables.libs))
- define my.add = get_library_add(my.product)
- write_line("$(my.cpath)_$(my.add) =$(my.variables.libs)")
- endif
- if (!is_empty(my.variables.sources))
- write_line("$(my.cpath)_SOURCES =$(my.variables.sources)")
- endif
- write_line()
-endfunction
-
-# Render c/c++ specific option variables.
-function render_cpp_variables(product, root, repository, mapper)
- define my.product = render_cpp_variables.product
- define my.repository = render_cpp_variables.repository
-
- if (is_cpp(my.product))
- define my.make = my.repository->make
- define my.configure = my.repository->configure
- define my.root_length = string.length(my.root)
- new variables as _variables
- initialize_cpp_variables(_variables)
- chase_libraries(my.product, my.make, my.repository)
-
- # Define _PROGRAMS|_[LT]LIBRARIES variables.
- _variables.binaries = get_binaries_variable(my.mapper, my.product,\
- my.repository)
-
- # Define TESTS variable.
- if (is_test(my.product))
- _variables.tests = get_tests_variable(my.mapper, my.product,\
- my.repository)
- endif
-
- # Define _LDFLAGS from an override of Libtool default naming.
- if (is_true(my.product.unprefixed))
- _variables.ld_flags += " -module"
- endif
-
- # Define _CPPFLAGS values from input.
- for my.product.headers as _headers
- require(_headers, "headers", "path")
- _variables.cpp_flags += " -I${srcdir}/$(_headers.path)"
- endfor
-
- # Define _C??FLAGS values from input.
- for my.product.flag as _flag
- define_cpp_flag_variable(_variables, _flag)
- endfor
-
- # Define _LIBS|_LDFLAGS|C??FLAGS variables from libraries.
- for my.product.library as _library
- define_cpp_lib_variables(_variables, _library, my.make,\
- my.configure, my.repository)
- endfor
-
- #
- # Define _SOURCES variable from sources elements.
- for my.product.sources as _sources
- require(_sources, "sources", "path")
- define my.folder = "$(my.root)$(_sources.path)"
- _variables.sources += get_all_sources(my.folder, my.root_length,\
- my.product)
- endfor
-
- write_cpp_variables(_variables, my.product, my.repository)
- endnew
- endif
-endfunction
-
-#------------------------------------------------------------------------------
-# Render Java Variables
-#------------------------------------------------------------------------------
-
-# Render java specific variables: JAVA.
-function render_java_variables(product, root, repository, mapper)
- define my.product = render_java_variables.product
- define my.repository = render_java_variables.repository
- if (is_java(my.product))
- define my.operator = get_assignment_operator(my.mapper, "CLEANFILES")
- write_line("CLEANFILES $(my.operator) ${java_builddir}/*.class\n")
- write_line("distclean-local:")
- write_line("\t-rm -rf ${java_builddir} ${jar_builddir}\n")
- endif
-endfunction
-
-#------------------------------------------------------------------------------
-# Render Jar Variables
-#------------------------------------------------------------------------------
-
-function get_java_stamp_variable(product)
- define my.product = get_java_stamp_variable.product
- define my.container = my.product.container?
- define my.prefix = is_empty(my.container) ?? "javaexec" ? ""
- define my.install = is_no_install(my.product) ?? "noinst" ? my.prefix
- return join(my.install, "$(my.container:c)", "_")
-endfunction
-
-function get_java_stamp(repository)
- define my.repository = get_java_stamp.repository
- define my.make = my.repository->make?
- if (defined(my.make))
- define my.java_product = my.make->product(prefix = "javaexec")?
- if (defined(my.java_product))
- define my.prefix = get_java_stamp_variable(my.java_product)
- return "class$(my.prefix).stamp"
- endif
- endif
- abort "The make is missing a required java product."
-endfunction
-
-# Render jar specific variables: jar_DATA.
-function render_jar_variables(product, root, repository, mapper)
- define my.product = render_jar_variables.product
- define my.repository = render_jar_variables.repository
- if (is_jar(my.product))
- define my.stamp = get_java_stamp(my.repository)
- define my.variable = get_automake_variable(my.product)
- define my.operator = get_assignment_operator(my.mapper, "CLEANFILES")
- write_line("${$(my.variable)}: $(my.stamp)")
- write_line("\t${JAR} cf ${JARFLAGS} ${$(my.variable)} -C ${java_builddir} .\n")
- write_line("CLEANFILES $(my.operator) ${jar_builddir}/*.jar\n")
- endif
-endfunction
-
-#------------------------------------------------------------------------------
-# Render Python Variables
-#------------------------------------------------------------------------------
-
-# Render python specific variables: PYTHON.
-function render_python_variables(product, root, repository, mapper)
- define my.product = render_python_variables.product
- define my.repository = render_python_variables.repository
- if (is_python(my.product))
- # TODO: add python features.
- endif
-endfunction
-
-#------------------------------------------------------------------------------
-# Render File Variables
-#------------------------------------------------------------------------------
-
-function get_source_directory(product)
- define my.product = get_source_directory.product
- if (is_jar(my.product))
- return "${jar_builddir}"
- endif
- return ""
-endfunction
-
-#
-function render_file_variables(product, mapper)
- define my.product = render_file_variables.product
- define my.file = ""
- define my.source = get_source_directory(my.product)
- for my.product.file as _file where !is_empty(_file.path) by _file.path
- define my.path = join(my.source, _file.path)
- my.file += " \\\n $(my.path)"
- endfor
- if (!is_empty(my.file))
- # Don't write a tautology, such as: installdir = ${installdir}.
- define my.install = get_install(my.product, my.container)
- if (!is_empty(my.install))
- define my.tag = get_tag(my.product)
- write_line("$(my.tag)dir = $(my.install)")
- endif
- define my.variable = get_automake_variable(my.product)
- define my.operator = get_assignment_operator(my.mapper, my.variable)
- write_line("$(my.variable) $(my.operator)$(my.file)\n")
- endif
-endfunction
-
-#------------------------------------------------------------------------------
-# Render Product
-#------------------------------------------------------------------------------
-
-# Get a product description for comments.
-function get_product_description(repository, product, container)
- define my.product = get_product_description.product
- define my.repository = get_product_description.repository
- define my.target = get_target(my.product)
- if (is_cpp(my.product))
- define my.path = get_product_path(my.product, my.repository)
- if (is_check(my.product) | is_no_install(my.product))
- return "local: $(my.path)"
- endif
- return "$(my.path) => $(my.target)"
- elsif (is_jar(my.product))
- if (is_no_install(my.product))
- return "*.class => *.jar (local), requires ax_java_devel.m4"
- endif
- return "*.class => *.jar => $(my.target), requires ax_java_devel.m4"
- elsif (is_java(my.product))
- if (is_no_install(my.product))
- return "*.java => *.class (local), requires ax_java_devel.m4"
- endif
- return "*.java => *.class => $(my.target), requires ax_java_devel.m4"
- endif
- define my.install = get_install(my.product)
- if (is_empty(my.install))
- my.install = my.target
- endif
- return "files => $(my.install)"
-endfunction
-
-function render_product_variables(product, root, repository, mapper)
- define my.product = render_product_variables.product
- define my.repository = render_product_variables.repository
-
- # are enumerated in metadata, just render them.
- render_file_variables(my.product, my.mapper)
-
- for my.product.files as _files
- require(_files, "files", "path")
- define my.folder = "$(my.root)$(_files.path)"
- define my.root_length = string.length(my.root)
- define my.path_length = string.length(_files.path)
-
- # are enumerated by directory and mapped to targets.
- render_files_variables(my.folder, my.root_length, my.path_length,\
- my.product, my.mapper)
- endfor
-
- render_cpp_variables(my.product, my.root, my.repository, my.mapper)
- render_java_variables(my.product, my.root, my.repository, my.mapper)
- render_jar_variables(my.product, my.root, my.repository, my.mapper)
- render_python_variables(my.product, my.root, my.repository, my.mapper)
-endfunction
-
-#
-function render_product(product, root, repository, mapper)
- define my.product = render_product.product
- define my.repository = render_product.repository
- define my.configure = my.repository->configure
- define my.option = find_option_symbol(my.product, my.configure)?
- if (defined(my.option))
- write_line("if $(my.option:upper)\n")
- endif
- render_product_variables(my.product, my.root, my.repository, my.mapper)
- if (defined(my.option))
- write_line("endif $(my.option:upper)\n")
- endif
-endfunction
-
-#------------------------------------------------------------------------------
-# Make Targets
-#------------------------------------------------------------------------------
-
-# For each option, write all paths to the option-named target.
-function render_make_targets(targets)
- define my.targets = render_make_targets.targets
- define my.last_row_name = ""
- for my.targets.row as _outer by _outer.name
- if (_outer.name = my.last_row_name)
- next _outer
- endif
- define my.target = ""
- my.last_row_name = _outer.name
- for my.targets.row as _inner where (_inner.name = _outer.name)
- my.target += " \\\n $(_inner.value)"
- endfor
- heading2("make target: $(_outer.name)")
- write_line("target_$(_outer.name) =$(my.target)\n")
- write_line("$(_outer.name): ${target_$(_outer.name)}\n")
- endfor
-endfunction
-
-# For each non-test product that is not a test, accumulate the product's
-# option (name) and path (value) in the targets table.
-function define_make_targets(repository, make, targets)
- define my.repository = define_make_targets.repository
- define my.make = define_make_targets.make
- define my.targets = define_make_targets.targets
- for my.make.product as _product where is_custom_target(_product)
- define my.path = get_product_path(_product, my.repository)
- if (!is_empty(my.path))
- table_add(my.targets, _product.option, my.path)
- endif
- endfor
-endfunction
-
-#------------------------------------------------------------------------------
-# Automake Variables
-#------------------------------------------------------------------------------
-
-function initialize_automake()
- heading2("Look for macros in the m4 subdirectory.")
- write_line("ACLOCAL_AMFLAGS = -I m4\n")
-endfunction
-
-function render_make_variables(table)
- define my.table = render_make_variables.table
- for my.table.row as _row
- write_line("$(_row.name) =")
- endfor
-endfunction
-
-function is_multiple_first_optional(table, row)
- define my.table = is_multiple_first_optional.table
- define my.row = is_multiple_first_optional.row
- define my.name = my.row.name
- define my.value = my.row.value
- return !is_empty(my.value) &\
- (table_ordinal(my.table, my.name, 0) = my.value) &\
- (table_count(my.table, my.name) > 1)
-endfunction
-
-function get_make_variables(make, variables, mapper)
- define my.make = get_make_variables.make
- define my.variables = get_make_variables.variables
- define my.mapper = get_make_variables.mapper
- new table as _table
- for my.make.product as _product
- define my.option = _product.option ? ""
- define my.variable = get_automake_variable(_product)
- table_add(_table, my.variable, my.option)
- if (is_test(_product))
- table_add(_table, "TESTS", my.option)
- endif
- if (is_clean_files(_product))
- table_add(_table, "CLEANFILES", my.option)
- endif
- endfor
- for _table.row as _row where is_multiple_first_optional(_table, _row)
- map_add(my.mapper, _row.name)
- table_add(my.variables, _row.name, "")
- endfor
- endnew _table
-endfunction
-
-# Get an = or += depending on whether it's the first or later use.
-function get_assignment_operator(mapper, variable)
- define my.found = map_exists(my.mapper, my.variable)
- map_add(my.mapper, my.variable)
- return my.found ?? "+=" ? "="
-endfunction
-
-###############################################################################
-# Generation
-###############################################################################
-
-function generate_automake(path_prefix)
-for generate.repository as _repository by _repository.name\
- where (defined(_repository->make))
-
- require(_repository, "repository", "name")
- my.output_path = join(my.path_prefix, canonical_path_name(_repository))
- create_directory(my.output_path)
- define my.out_file = "$(my.output_path)/Makefile.am"
- notify(my.out_file)
- output(my.out_file)
-
- copyleft(_repository.name)
- define my.make = _repository->make
- define my.absolute = "$(global.root)/$(canonical_path_name(_repository))"
- define my.base = normalize_directory(my.absolute)
-
- heading1("Automake settings.")
- initialize_automake()
-
- new mapper as _mapper
- new variables as _variables
- get_make_variables(my.make, _variables, _mapper)
- if (!table_empty(_variables))
- heading1("Conditional variables.")
- render_make_variables(_variables)
- endif
- endnew _variables
-
- heading1("Distribute, make and install products.")
- for my.make.product as _product
- heading2(get_product_description(_repository, _product))
- render_product(_product, my.base, _repository, _mapper)
- endfor
- endnew _mapper
-
- new targets as _targets
- define_make_targets(_repository, my.make, _targets)
- if (!table_empty(_targets))
- heading1("Custom make targets.")
- render_make_targets(_targets)
- endif
- endnew _targets
-
- close
-endfor _repository
-endfunction # generate_automake
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_automake("output")
-
-.endtemplate
diff --git a/templates/gsl.configure.ac b/templates/gsl.configure.ac
deleted file mode 100644
index 37f2b0ef..00000000
--- a/templates/gsl.configure.ac
+++ /dev/null
@@ -1,1165 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin configure.ac.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-function substitute_system_include(variable_name)
- return "`echo ${$(my.variable_name)} | $SED s/^-I/-isystem/g | $SED s/' -I'/' -isystem'/g`"
-endfunction
-
-function format_template_files(configure)
- define my.configure = format_template_files.configure
- define my.template_files = ""
- for my.configure.template as _template
- require(_template, "template", "name")
- my.template_files += " $(_template.name)"
- endfor _template
- return trim_left(my.template_files)
-endfunction
-
-function is_flag_prefixed(configure, prefix)
- define my.configure = is_flag_prefixed.configure
- define my.found = my.configure->flag(starts_with(flag.name, my.prefix))?
- return defined(my.found)
-endfunction
-
-function find_flag_prefixed(configure, prefix)
- define my.configure = find_flag_prefixed.configure
- return my.configure->flag(starts_with(flag.name, my.prefix))
-endfunction
-
-# Return PREPROC|COMPILE|LINK
-function get_flags_check(flag)
- define my.flag = get_flags_check.flag
- if (is_cpp_flag(my.flag))
- return "PREPROC"
- elsif (is_ccc_flag(my.flag) | is_cxx_flag(my.flag))
- # Is this intended to be both C and C++?
- return "COMPILE"
- elsif (is_link_flag(my.flag))
- return "LINK"
- endif
- define my.context = my.flag.context ? ""
- abort "Invalid flag context: '$(my.context)'."
-endfunction
-
-function get_option_type(option)
- define my.option = get_option_type.option
- require(my.option, "option", "type")
- if (my.option.type = "enable" | my.option.type = "with")
- return my.option.type
- endif
- abort "Invalid repository.option.type: $(my.option.type)."
-endfunction
-
-function get_option_default(option)
- define my.option = get_option_default.option
- return defined(my.option.default) ??\
- " @<:@default=$(my.option.default)@:>@" ? ""
-endfunction
-
-# For some reason all-am requires we make the pc file, so for now we always
-# define at least an empty package element.
-function get_package_files(repository)
- define my.repository = get_package_files.repository
- define my.make = my.repository->make
- define my.packages = ""
- for my.repository.package as _package where defined(_package.library)
- define my.product = find_library_product(_package.library, my.make,\
- my.repository)?
- #if (defined(my.product))
- # TODO: define package name conditionally in configure.ac.
- #if (is_optional_element(my.product))
- # abort "Conditional pkg-config not yet supported: $(_package.library)"
- #endif
- define my.package = get_package_name(_package)
- my.packages += " $(my.package).pc"
- #endif
- endfor
- return my.packages
-endfunction
-
-function render_define_item(item, configure)
- define my.define = render_define_item.item
- define my.configure = render_define_item.configure
- if defined(my.define.name)
- render_define(my.define, my.configure)
- elsif (defined(my.define.export))
- render_define_export(my.define)
- else
- render_define_header(my.define)
- endif
-endfunction
-
-function matches_element_name(collection, name)
- define my.collection = matches_element_name.collection
- return (count(my.collection.element, (count.name = my.name)) > 0)
-endfunction
-
-function discover_systems(repository, systems)
- define my.repository = discover_systems.repository
- define my.root = discover_systems.systems
-
- for my.repository->configure.dependency as _dependency\
- where defined(_dependency.system)
-
- define my.name = _dependency.system
- if (!matches_element_name(my.root, my.name))
- new my.root.element as _element
- _element.name = my.name
- endnew
- endif
- endfor
-
- for my.repository->configure.dependency as _dependency\
- where defined(_dependency.system_exclude)
-
- define my.name = _dependency.system_exclude
- if (!matches_element_name(my.root, my.name))
- new my.root.element as _element
- _element.name = my.name
- endnew
- endif
- endfor
-endfunction
-
-function initialize_systems_flags(repository)
- define my.repository = initialize_systems_flags.repository
- define my.sentinel = "*"
-
- new systems as _systems
- discover_systems(my.repository, _systems)
-
- if (count(_systems.element, 1) > 0)
- emit_initialize_platforms_declaration(_systems, my.sentinel)
- emit_initialize_platforms_case(_systems, my.sentinel)
- endif
- endnew
-endfunction
-
-function get_platform_test(dependency)
- define my.dependency = get_platform_test.dependency
- return is_empty(my.dependency.system)\
- ?? ""\
- ? "test \"\$platform_$(my.dependency.system:c)\" = \"yes\""
-endfunction
-
-function get_platform_exclude_test(dependency)
- define my.dependency = get_platform_exclude_test.dependency
- return is_empty(my.dependency.system_exclude)\
- ?? ""\
- ? "test \"\$platform_$(my.dependency.system_exclude:c)\" = \"no\""
-endfunction
-
-function get_case_platform(dependency, sentinel)
- define my.dependency = get_case_platform.dependency
- return is_empty(my.dependency.system)\
- ?? my.sentinel ? "*$(my.dependency.system:c)*"
-endfunction
-
-function get_case_platform_exclude(dependency, sentinel)
- define my.dependency = get_case_platform_exclude.dependency
- return is_empty(my.dependency.system_exclude)\
- ?? my.sentinel ? "*$(my.dependency.system_exclude:c)*"
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.#-----------------------------------------------------------------------------
-.# AC_LANG_PROGRAM tests
-.#-----------------------------------------------------------------------------
-.macro render_test_program(program, indent, prefix, suffix)
-. my.program = render_test_program.program
-. my.indent = render_test_program.indent
-. my.prefix = render_test_program.prefix
-. my.suffix = render_test_program.suffix
-.
-$(my.prefix)AC_LANG_PROGRAM(
- $(my.indent)[[
-. for my.program.include as _include
- $(my.indent)#include <$(_include.header)>
-. endfor
- $(my.indent)]],
- $(my.indent)[[
-. for my.program.loc as _loc
- $(my.indent)$(_loc)
-. endfor
- $(my.indent)]])$(my.suffix)
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# Initialize
-.#-----------------------------------------------------------------------------
-.macro initialize_configure(repository)
-. define my.repository = initialize_configure.repository
-. require(my.repository, "repository", "email")
-. require(my.repository, "repository", "name")
-. require(my.repository, "repository", "version")
-.
-# Requires Automake 1.14 or newer.
-
-# Declare the required version of Autoconf.
-AC_PREREQ([2.65])
-
-# Process command-line arguments and perform initialization and verification.
-AC_INIT([$(my.repository.name)], [$(my.repository.version)], [$(my.repository.email)])
-
-# Do compilation tests.
-AC_LANG(C++)
-
-# Specify the temporary directory for build tools.
-AC_CONFIG_AUX_DIR([build-aux])
-
-# Specify the directory of additional local Autoconf macros.
-AC_CONFIG_MACRO_DIR([m4])
-
-# Run macros for operation of generated Makefiles, enable non-recursive make.
-# Unless [foreign] is specified standard GNU files will be required,
-# specifically: AUTHORS, COPYING, INSTALL, NEWS, README and ChangeLog.
-AM_INIT_AUTOMAKE([subdir-objects])
-
-# Enable C and POSIX extensions that may be disabled on certain platforms.
-AC_USE_SYSTEM_EXTENSIONS
-
-# Enable the archiver.
-AM_PROG_AR
-
-# Initialize libtool.
-LT_PREREQ(2.4.2)
-
-# Enable shared libraries if available, and static if they don't conflict.
-LT_INIT
-AC_SUBST([LIBTOOL_DEPS])
-
-# Determine C++ compiler to use.
-AC_PROG_CXX
-
-# Enable sed for substitution.
-AC_PROG_SED
-
-# Compute the canonical host-system type variable host, including host_os.
-AC_CANONICAL_HOST
-
-# Enable silent rules option.
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
-# Check for pkg-config.
-PKG_PROG_PKG_CONFIG
-AS_IF([test -n "$PKG_CONFIG"], [],
- [AC_MSG_ERROR([pkg-config is required but was not found.])])
-
-AS_CASE([${enable_static}],
- [yes], [AC_SUBST([PKG_CONFIG], ["$PKG_CONFIG --static"])],
- [])
-
-.heading2("Declare environment variables that affect the build.")
-AC_ARG_VAR([CC], "C compiler to use, such as gcc or clang")
-AC_ARG_VAR([CXX], "C++ compiler to use, such as g++ or clang++")
-AC_ARG_VAR([PKG_CONFIG_PATH], "Additional directories for package discovery.")
-
-.endmacro
-.
-.macro emit_initialize_platforms_declaration(systems, sentinel)
-. define my.systems = emit_initialize_platforms_declaration.systems
-# Platform indicators
-. for my.systems.element as _element
-. if (!(_element.name = my.sentinel))
-platform_$(_element.name:c)="no"
-. endif
-. endfor
-
-.endmacro
-.
-.macro emit_initialize_platforms_case(systems, sentinel)
-. define my.systems = emit_initialize_platforms_case.systems
-.
-AS_CASE([${host_os}],
-. for my.systems.element as _element
-. if (!(_element.name = my.sentinel))
- [*$(_element.name)*],
- [platform_$(_element.name:c)="yes"],
-. endif
-. endfor
- [])
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AX_CXX_COMPILE_STDCXX
-.#-----------------------------------------------------------------------------
-.macro require_stdcxx(repository)
-. define std_prefix = "std=c++"
-. define my.repository = require_stdcxx.repository
-. if (is_flag_prefixed(my.repository->configure, std_prefix))
-. define my.flag = find_flag_prefixed(my.repository->configure, std_prefix)
-. define my.standard = right(my.flag.name,\
- string.length(my.flag.name) - string.length(std_prefix))
-.heading2("Check for baseline language coverage in the compiler for the C++$(my.standard) standard.")
-AX_CXX_COMPILE_STDCXX([$(my.standard)], [noext], [mandatory])
-
-. endif
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AC_ARG_ENABLE | AC_ARG_WITH
-.#-----------------------------------------------------------------------------
-.macro render_option(option)
-. define my.option = render_option.option
-. require(my.option, "option", "description")
-. require(my.option, "option", "name")
-. require(my.option, "option", "type")
-.
-. define my.example = my.option.example ? ""
-. define my.type = get_option_type(my.option)
-. define my.symbol = get_option_symbol(my.option)
-. define my.default = get_option_default(my.option)
-.
-. define my.implement = is_true(inherited) ?? "Inherit" ? "Implement"
-. define my.output = is_true(my.option.substitute) ?? " and output ${$(my.option.name:c)}" ? ""
-. define my.defines = defined(my.option.define) ?? " and define $(my.option.define:upper,c)" ? ""
-. define my.conditional = is_true(my.option.conditional) ?? " and declare $(my.symbol:upper)" ? ""
-. heading2("$(my.implement) --$(my.type)-$(my.option.name)$(my.defines)$(my.output)$(my.conditional).")
-.
-. if (!is_true(my.option.inherited))
-AC_MSG_CHECKING([--$(my.type)-$(my.option.name) option])
-AC_ARG_$(my.type:upper)([$(my.option.name)],
- AS_HELP_STRING([--$(my.type)-$(my.option.name)$(my.example)],
- [$(my.option.description)$(my.default)]),
- [$(my.symbol)=$$(my.type)val],
- [$(my.symbol)=$(my.option.default)])
-AC_MSG_RESULT([$$(my.symbol)])
-. endif
-.
-. if (!is_empty(my.option.define))
-AS_CASE([${$(my.symbol)}], [yes], AC_DEFINE([$(my.option.define:upper,c)]))
-. endif
-.
-. if (is_true(my.option.substitute) & defined(my.option.value))
-AS_CASE([${$(my.symbol)}], [yes], AC_SUBST([$(my.option.name:c)], [$(my.option.value)]))
-. elsif (is_true(my.option.substitute))
-AC_SUBST([$(my.symbol)])
-. endif
-.
-. for my.option.include as _include where defined(_include.symbol) & defined(_include.value)
-AS_CASE([${$(my.symbol)}], [yes], AC_SUBST([$(_include.symbol:c)], [$(_include.value)]))
-. endfor
-.
-. if (is_true(my.option.conditional))
-AM_CONDITIONAL([$(my.symbol:upper)], [test x$$(my.symbol) != xno])
-. endif
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AC_DEFINE
-.#-----------------------------------------------------------------------------
-.macro render_define(item, configure)
-. define my.define = render_define.item
-. define my.configure = render_define.configure
-. require(my.define, "define", "name")
-. define my.uname = "$(my.define.name:upper,c)"
-. define my.heading = defined(my.define.option) ?? \
- "Conditionally define the preprocessor symbol $(my.uname)." ? \
- "Unconditionally define the preprocessor symbol $(my.uname)."
-.
-. define my.define_prefix = defined(my.define.option) ?? " " ? ""
-.
-. heading2(my.heading)
-
-. if (!is_empty(my.define.comment))
-. heading3(my.define.comment)
-. endif
-.
-. if (defined(my.define.option))
-. define my.option = my.configure->option(option.name = my.define.option)
-. if (!defined(my.option))
-. endif
-. define my.symbol = get_option_symbol(my.option)
-. define my.type = get_option_type(my.option)
-.
-AS_IF([test x${$(my.symbol)} != "xno"], [
-. endif
-.
-. if (defined(my.define.value))
-$(my.define_prefix)AC_DEFINE([$(my.uname)], [$(my.define.value)])
-. else
-$(my.define_prefix)AC_DEFINE([$(my.uname)])
-. endif
-.
-. if (defined(my.define.substitute))
-. define my.subvalue = defined(my.define.value) ?? my.define.value ? "-D$(my.uname)"
-$(my.define_prefix)AC_SUBST([$(my.define.substitute)], $(my.subvalue)])
-. endif
-.
-. if (defined(my.define.option))
- ])
-. endif
-.
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AC_CHECK_HEADERS
-.#-----------------------------------------------------------------------------
-.macro render_define_header(item)
-. define my.define = render_define_header.item
-. require(my.define, "define", "header")
-. define my.symbol = "HAVE_$(my.define.header:upper,c)"
-. heading2("Conditionally define the preprocessor symbol $(my.symbol).")
-AC_CHECK_HEADERS([$(my.define.header)])
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AC_CHECK_DECLS
-.#-----------------------------------------------------------------------------
-.macro render_define_export(item)
-. define my.define = render_define_export.item
-. require(my.define, "define", "header")
-. require(my.define, "define", "export")
-. define my.header_symbol = "HAVE_$(my.define.header:upper,c)"
-. define my.export_symbol = "HAVE_DECL_$(my.define.export:upper,c)"
-. heading2("Conditionally define the preprocessor symbol $(my.export_symbol).")
-AC_CHECK_HEADERS([$(my.define.header)],
- [AC_CHECK_DECLS([$(my.define.export)], [], [],
- [#if $(my.header_symbol)
- #include <$(my.define.header)>
- #endif])])
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AX_JAVA_DEVEL
-.#-----------------------------------------------------------------------------
-.macro check_java(dependency, configure)
-. define my.dependency = check_java.dependency
-. define my.configure = check_java.configure
-. require(my.dependency, "dependency", "name")
-.
-. define my.name = my.dependency.name
-. define my.cname = "$(my.name:c)"
-. define my.symbol = find_option_symbol(my.dependency, my.configure)?
-. define my.show_option = !is_empty(my.symbol) ?? " if --$(my.symbol)" ? ""
-. heading2("Require $(my.name)$(my.show_option) and output ${JAR/JAVAC/javadir} and ${$(my.cname)_CPPFLAGS}.")
-. if (!is_empty(my.dependency.comment))
-. heading3("$(my.dependency.comment)")
-. endif
-. if (is_empty(my.symbol))
-AX_JAVA_DEVEL
-AC_SUBST([$(my.cname)_CPPFLAGS], [${JAVA_CPPFLAGS}])
-AC_SUBST([$(my.cname)_ISYS_CPPFLAGS], [$(substitute_system_include("JAVA_CPPFLAGS"))])
-AC_MSG_NOTICE([$(my.cname)_CPPFLAGS : ${$(my.cname)_CPPFLAGS}])
-AC_MSG_NOTICE([$(my.cname)_ISYS_CPPFLAGS : ${$(my.cname)_ISYS_CPPFLAGS}])
-. else
-AS_CASE([${$(my.symbol)}], [yes],
- [AX_JAVA_DEVEL
- AC_SUBST([$(my.cname)_CPPFLAGS], [${JAVA_CPPFLAGS}])
- AC_SUBST([$(my.cname)_ISYS_CPPFLAGS], [$(substitute_system_include("JAVA_CPPFLAGS"))])
- AC_MSG_NOTICE([$(my.cname)_CPPFLAGS : ${$(my.cname)_CPPFLAGS}])
- AC_MSG_NOTICE([$(my.cname)_ISYS_CPPFLAGS : ${$(my.cname)_ISYS_CPPFLAGS}])])
-. endif
-
-AS_CASE([${enable_isystem}],[yes],
- [AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_ISYS_CPPFLAGS}])],
- [AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_CPPFLAGS}])])
-
-AC_MSG_NOTICE([$(my.cname)_BUILD_CPPFLAGS : ${$(my.cname)_BUILD_CPPFLAGS}])
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AX_PYTHON_DEVEL
-.#-----------------------------------------------------------------------------
-.macro check_python(dependency, configure)
-. define my.dependency = check_python.dependency
-. define my.configure = check_python.configure
-. require(my.dependency, "dependency", "name")
-.
-. define my.name = my.dependency.name
-. define my.cname = "$(my.name:c)"
-. define my.version = my.dependency.version
-. define my.symbol = find_option_symbol(my.dependency, my.configure)?
-. define my.show_option = !is_empty(my.symbol) ?? " if --$(my.symbol)" ? ""
-. heading2("Require $(my.name) of at least version $(my.version)$(my.show_option) and output ${$(my.cname)_CPPFLAGS}.")
-. if (!is_empty(my.dependency.comment))
-. heading3("$(my.dependency.comment)")
-. endif
-. if (is_empty(my.symbol))
-AM_PATH_PYTHON([$(my.version)],
- [AX_PYTHON_DEVEL
- AC_SUBST([$(my.cname)_CPPFLAGS], [${PYTHON_CPPFLAGS}])
- AC_SUBST([$(my.cname)_ISYS_CPPFLAGS], [$(substitute_system_include("PYTHON_CPPFLAGS"))])
- AC_MSG_NOTICE([$(my.cname)_CPPFLAGS : ${$(my.cname)_CPPFLAGS}])
- AC_MSG_NOTICE([$(my.cname)_ISYS_CPPFLAGS : ${$(my.cname)_ISYS_CPPFLAGS}])])
-. else
-AS_CASE([${$(my.symbol)}], [yes],
- [AM_PATH_PYTHON([$(my.version)],
- [AX_PYTHON_DEVEL
- AC_SUBST([$(my.cname)_CPPFLAGS], [${PYTHON_CPPFLAGS}])
- AC_SUBST([$(my.cname)_ISYS_CPPFLAGS], [$(substitute_system_include("PYTHON_CPPFLAGS"))])
- AC_MSG_NOTICE([$(my.cname)_CPPFLAGS : ${$(my.cname)_CPPFLAGS}])])
- AC_MSG_NOTICE([$(my.cname)_ISYS_CPPFLAGS : ${$(my.cname)_ISYS_CPPFLAGS}])])
-. endif
-
-AS_CASE([${enable_isystem}],[yes],
- [AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_ISYS_CPPFLAGS}])],
- [AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_CPPFLAGS}])])
-
-AC_MSG_NOTICE([$(my.cname)_BUILD_CPPFLAGS : ${$(my.cname)_BUILD_CPPFLAGS}])
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AM_ICONV
-.#-----------------------------------------------------------------------------
-.macro check_iconv(dependency, configure)
-. define my.dependency = check_iconv.dependency
-. define my.configure = check_iconv.configure
-. require(my.dependency, "dependency", "name")
-.
-. define my.name = my.dependency.name
-. define my.cname = "$(my.name:c)"
-. define my.symbol = find_option_symbol(my.dependency, my.configure)?
-. define my.show_option = !is_empty(my.symbol) ?? " if --$(my.symbol)" ? ""
-. heading2("Require $(my.name)$(my.show_option) and output ${$(my.cname)_CPPFLAGS/LIBS}.")
-. if (!is_empty(my.dependency.comment))
-. heading3("$(my.dependency.comment)")
-. endif
-. if (is_empty(my.symbol))
-AM_ICONV
-AC_SUBST([iconv_CPPFLAGS], [${INCICONV}])
-AC_SUBST([iconv_ISYS_CPPFLAGS], [$(substitute_system_include("INCICONV"))])
-AC_SUBST([iconv_LIBS], [${LIBICONV}])
-AC_MSG_NOTICE([$(my.cname)_CPPFLAGS : ${$(my.cname)_CPPFLAGS}])
-AC_MSG_NOTICE([$(my.cname)_ISYS_CPPFLAGS : ${$(my.cname)_ISYS_CPPFLAGS}])
-AC_MSG_NOTICE([$(my.cname)_LIBS : ${$(my.cname)_LIBS}])
-. else
-AS_CASE([${$(my.symbol)}], [yes],
- AM_ICONV
- AC_SUBST([iconv_CPPFLAGS], [${INCICONV}])
- AC_SUBST([iconv_ISYS_CPPFLAGS], [$(substitute_system_include("INCICONV"))])
- AC_SUBST([iconv_LIBS], [${LIBICONV}])
- AC_MSG_NOTICE([$(my.cname)_CPPFLAGS : ${$(my.cname)_CPPFLAGS}])
- AC_MSG_NOTICE([$(my.cname)_ISYS_CPPFLAGS : ${$(my.cname)_ISYS_CPPFLAGS}])
- AC_MSG_NOTICE([$(my.cname)_LIBS : ${$(my.cname)_LIBS}]))
-. endif
-
-AS_CASE([${enable_isystem}],[yes],
- [AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_ISYS_CPPFLAGS}])],
- [AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_CPPFLAGS}])])
-
-AC_MSG_NOTICE([$(my.cname)_BUILD_CPPFLAGS : ${$(my.cname)_BUILD_CPPFLAGS}])
-
-.endmacro # check_iconv
-.
-.#-----------------------------------------------------------------------------
-.# AX_PTHREAD
-.#-----------------------------------------------------------------------------
-.macro emit_m4_ax_cpp_libs_macro(dependency, indent_length, trailing_indicator,\
- wrap)
-.
-. define my.dependency = emit_m4_ax_cpp_libs_macro.dependency
-. require(my.dependency, "dependency", "name")
-.
-. define my.cname = "$(my.dependency.name:c)"
-. define my.uname = "$(my.cname:upper)"
-. define my.prefix_bracket = is_true(my.wrap) ?? "[" ? ""
-. define my.suffix_bracket = is_true(my.wrap) ?? "]" ? ""
-. define my.indent_prefix = ""
-. while (my.indent_length > string.length(my.indent_prefix))
-. my.indent_prefix = " $(my.indent_prefix)"
-. endwhile
-.
-$(my.indent_prefix)$(my.prefix_bracket)AX_$(my.uname)(
- $(my.indent_prefix)[AC_SUBST([$(my.cname)_CPPFLAGS], [${$(my.uname)_CPPFLAGS}])
- $(my.indent_prefix)AC_SUBST([$(my.cname)_ISYS_CPPFLAGS], [$(substitute_system_include("$(my.uname)_CPPFLAGS"))])
-. if (my.cname = "pthread")
- $(my.indent_prefix)AC_SUBST([$(my.cname)_LIBS], [-lpthread])
-. else
- $(my.indent_prefix)AC_SUBST([$(my.cname)_LIBS], [${$(my.uname)_LIBS}])
-. endif
- $(my.indent_prefix)AC_MSG_NOTICE([$(my.cname)_CPPFLAGS : ${$(my.cname)_CPPFLAGS}])
- $(my.indent_prefix)AC_MSG_NOTICE([$(my.cname)_ISYS_CPPFLAGS : ${$(my.cname)_ISYS_CPPFLAGS}])],
- $(my.indent_prefix)[AC_MSG_ERROR([$(my.cname) library is required but was not found.])])
-
-$(my.indent_prefix)AS_CASE([${enable_isystem}],[yes],
- $(my.indent_prefix)[AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_ISYS_CPPFLAGS}])],
- $(my.indent_prefix)[AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_CPPFLAGS}])])
-
-$(my.indent_prefix)AC_MSG_NOTICE([$(my.cname)_BUILD_CPPFLAGS : ${$(my.cname)_BUILD_CPPFLAGS}])$(my.suffix_bracket)$(my.trailing_indicator)
-.endmacro # emit_m4_ax_cpp_libs_macro
-.
-.macro emit_m4_ax_cpp_libs_conditional_platform(dependency, indent_length,\
- trailing_indicator, wrap)
-.
-. define my.dependency = emit_m4_ax_cpp_libs_conditional_platform.dependency
-. require(my.dependency, "dependency", "name")
-.
-. define my.name = "$(my.dependency.name)"
-. define my.platform = get_case_platform(my.dependency, "")
-. define my.platform_exclude = get_case_platform_exclude(my.dependency, "")
-.
-. define my.prefix_bracket = is_true(my.wrap) ?? "[" ? ""
-. define my.suffix_bracket = is_true(my.wrap) ?? "]" ? ""
-. define my.indent_prefix = ""
-. while (my.indent_length > string.length(my.indent_prefix))
-. my.indent_prefix = " $(my.indent_prefix)"
-. endwhile
-.
-. if (is_empty(my.platform) & is_empty(my.platform_exclude))
-. emit_m4_ax_cpp_libs_macro(my.dependency, my.indent_length,\
- my.trailing_indicator, my.wrap)
-. else
-$(my.indent_prefix)$(my.prefix_bracket)AS_CASE([${host_os}],
-. if (!is_empty(my.platform_exclude))
- $(my.indent_prefix)[$(my.platform_exclude)],
- $(my.indent_prefix)[AC_SUBST([$(my.name:c)_LIBS], [])],
-. endif
-. if (!is_empty(my.platform))
- $(my.indent_prefix)[$(my.platform)],
-. emit_m4_ax_cpp_libs_macro(my.dependency, my.indent_length + 4,\
- ",", "true")
- $(my.indent_prefix)[AC_SUBST([$(my.name:c)_LIBS], [])])$(my.suffix_bracket)$(my.trailing_indicator)
-. else
-. emit_m4_ax_cpp_libs_macro(my.dependency, my.indent_length + 4,\
- ")$(my.suffix_bracket)$(my.trailing_indicator)", "true")
-. endif
-. endif
-.endmacro # emit_m4_ax_cpp_libs_conditional_platform
-.
-.macro emit_m4_ax_cpp_libs_conditional_option(dependency, configure,\
- indent_length, trailing_indicator, wrap)
-.
-. define my.dependency = emit_m4_ax_cpp_libs_conditional_option.dependency
-. define my.configure = emit_m4_ax_cpp_libs_conditional_option.configure
-. require(my.dependency, "dependency", "name")
-.
-. define my.name = "$(my.dependency.name)"
-. define my.symbol = find_option_symbol(my.dependency, my.configure)?
-.
-. define my.prefix_bracket = is_true(my.wrap) ?? "[" ? ""
-. define my.suffix_bracket = is_true(my.wrap) ?? "]" ? ""
-. define my.indent_prefix = ""
-. while (my.indent_length > string.length(my.indent_prefix))
-. my.indent_prefix = " $(my.indent_prefix)"
-. endwhile
-.
-. if (is_empty(my.symbol))
-. emit_m4_ax_cpp_libs_conditional_platform(\
- my.dependency, my.indent_length, my.trailing_indicator, my.wrap)
-. else
-$(my.indent_prefix)$(my.prefix_bracket)AS_CASE([${$(my.symbol)}], [yes],
-. emit_m4_ax_cpp_libs_conditional_platform(\
- my.dependency, my.indent_length + 4, ",", "true")
- $(my.indent_prefix)[AC_MSG_NOTICE([$(my.symbol) value excludes $(my.name)])
- $(my.indent_prefix)[AC_SUBST([$(my.name:c)_LIBS], [])])$(my.suffix_bracket)$(my.trailing_indicator)
-. endif
-.endmacro # emit_m4_ax_cpp_libs_conditional_option
-.
-.macro check_m4_cpp_libs_conditional(dependency, configure)
-. define my.dependency = check_m4_cpp_libs_conditional.dependency
-. define my.configure = check_m4_cpp_libs_conditional.configure
-. require(my.dependency, "dependency", "name")
-.
-. define my.cname = "$(my.dependency.name:c)"
-. define my.uname = "$(my.cname:upper)"
-. define my.symbol = find_option_symbol(my.dependency, my.configure)?
-. define my.platform_test = get_platform_test(my.dependency)
-.
-. define my.show_option = !is_empty(my.symbol) ?? " if --$(my.symbol)" ? ""
-. define my.show_system = is_empty(my.dependency.system) ?? "" ?\
- " if on $(my.dependency.system)"
-.
-. define my.show_system_exclude = is_empty(my.dependency.system_exclude)\
- ?? "" ? " if not on $(my.dependency.system_exclude)"
-.
-. heading2("Require $(my.cname)$(my.show_option)$(my.show_system)$(my.show_system_exclude) and output ${$(my.cname)_CPPFLAGS/LIBS}.")
-.
-. if (!is_empty(my.dependency.comment))
-. heading3("$(my.dependency.comment)")
-. endif
-.
-. if (my.cname = "pthread")
-. heading3("Hard wired -lpthread because AX_PTHREAD does not do it.")
-. endif
-.
-. emit_m4_ax_cpp_libs_conditional_option(\
- my.dependency, my.configure, 0, "", "false")
-
-AC_MSG_NOTICE([$(my.cname)_LIBS : ${$(my.cname)_LIBS}])
-
-.endmacro # check_m4_cpp_libs_conditional
-.
-.#-----------------------------------------------------------------------------
-.# AC_CHECK_LIB
-.#-----------------------------------------------------------------------------
-.macro emit_check_libs_macro(dependency, indent_length,\
- trailing_indicator, wrap)
-.
-. define my.dependency = emit_check_libs_macro.dependency
-. require(my.dependency, "dependency", "name")
-.
-. define my.cname = "$(my.dependency.name:c)"
-. define my.uname = "$(my.cname:upper)"
-. define my.prefix_bracket = is_true(my.wrap) ?? "[" ? ""
-. define my.suffix_bracket = is_true(my.wrap) ?? "]" ? ""
-. define my.indent_prefix = ""
-. while (my.indent_length > string.length(my.indent_prefix))
-. my.indent_prefix = " $(my.indent_prefix)"
-. endwhile
-.
-. if (!is_empty(my.dependency.function))
-$(my.indent_prefix)$(my.prefix_bracket)AC_CHECK_LIB([$(my.cname)], [$(my.dependency.function)],
- $(my.indent_prefix)[AC_SUBST([$(my.cname)_LIBS], [-l$(my.cname)])],
- $(my.indent_prefix)[AC_MSG_ERROR([$(my.cname) library is required but was not found.])])$(my.suffix_bracket)$(my.trailing_indicator)
-. endif
-.endmacro # emit_check_libs_macro
-.
-.macro emit_check_libs_conditional_platform(dependency, indent_length,\
- trailing_indicator, wrap)
-.
-. define my.dependency = emit_check_libs_conditional_platform.dependency
-. require(my.dependency, "dependency", "name")
-.
-. define my.name = "$(my.dependency.name)"
-. define my.platform = get_case_platform(my.dependency, "")
-. define my.platform_exclude = get_case_platform_exclude(my.dependency, "")
-.
-. define my.prefix_bracket = is_true(my.wrap) ?? "[" ? ""
-. define my.suffix_bracket = is_true(my.wrap) ?? "]" ? ""
-. define my.indent_prefix = ""
-. while (my.indent_length > string.length(my.indent_prefix))
-. my.indent_prefix = " $(my.indent_prefix)"
-. endwhile
-.
-. if (is_empty(my.platform) & is_empty(my.platform_exclude))
-. emit_check_libs_macro(my.dependency, my.indent_length,\
- my.trailing_indicator, my.wrap)
-. else
-$(my.indent_prefix)$(my.prefix_bracket)AS_CASE([${host_os}],
-. if (!is_empty(my.platform_exclude))
- $(my.indent_prefix)[$(my.platform_exclude)],
- $(my.indent_prefix)[AC_SUBST([$(my.name:c)_LIBS], [])],
-. endif
-. if (!is_empty(my.platform))
- $(my.indent_prefix)[$(my.platform)],
-. emit_check_libs_macro(my.dependency, my.indent_length + 4,\
- ",", "true")
- $(my.indent_prefix)[AC_SUBST([$(my.name:c)_LIBS], [])])$(my.suffix_bracket)$(my.trailing_indicator)
-. else
-. emit_check_libs_macro(my.dependency, my.indent_length + 4,\
- ")$(my.suffix_bracket)$(my.trailing_indicator)", "true")
-. endif
-. endif
-.endmacro # emit_check_libs_conditional_platform
-.
-.macro emit_check_libs_conditional_option(dependency, configure,\
- indent_length, trailing_indicator, wrap)
-.
-. define my.dependency = emit_check_libs_conditional_option.dependency
-. define my.configure = emit_check_libs_conditional_option.configure
-. require(my.dependency, "dependency", "name")
-.
-. define my.name = "$(my.dependency.name)"
-. define my.symbol = find_option_symbol(my.dependency, my.configure)?
-
-.
-. define my.prefix_bracket = is_true(my.wrap) ?? "[" ? ""
-. define my.suffix_bracket = is_true(my.wrap) ?? "]" ? ""
-. define my.indent_prefix = ""
-. while (my.indent_length > string.length(my.indent_prefix))
-. my.indent_prefix = " $(my.indent_prefix)"
-. endwhile
-.
-. if (is_empty(my.symbol))
-. emit_check_libs_conditional_platform(\
- my.dependency, my.indent_length, my.trailing_indicator, my.wrap)
-. else
-$(my.indent_prefix)$(my.prefix_bracket)AS_CASE([${$(my.symbol)}], [yes],
-. emit_check_libs_conditional_platform(\
- my.dependency, my.indent_length + 4, ",", "true")
- $(my.indent_prefix)[AC_MSG_NOTICE([$(my.symbol) value excludes $(my.name)])
- $(my.indent_prefix)[AC_SUBST([$(my.name:c)_LIBS], [])])$(my.suffix_bracket)$(my.trailing_indicator)
-. endif
-.endmacro # emit_check_libs_conditional_option
-.
-.macro check_lib_dependency_conditional(dependency, configure)
-. define my.dependency = check_lib_dependency_conditional.dependency
-. define my.configure = check_lib_dependency_conditional.configure
-. require(my.dependency, "dependency", "name")
-.
-. define my.cname = "$(my.dependency.name:c)"
-. define my.uname = "$(my.cname:upper)"
-. define my.symbol = find_option_symbol(my.dependency, my.configure)?
-. define my.platform_test = get_platform_test(my.dependency)
-.
-. define my.show_option = !is_empty(my.symbol) ?? " if --$(my.symbol)" ? ""
-. define my.show_system = is_empty(my.dependency.system) ?? "" ?\
- " if on $(my.dependency.system)"
-.
-. define my.show_system_exclude = is_empty(my.dependency.system_exclude)\
- ?? "" ? " if not on $(my.dependency.system_exclude)"
-.
-. define my.output = is_empty(my.dependency.function) ?? "" ?\
- " and output ${$(my.cname)_LIBS}"
-.
-. heading2("Require $(my.cname)$(my.show_option)$(my.show_system)$(my.show_system_exclude)$(my.output).")
-.
-. if (!is_empty(my.dependency.comment))
-. heading3("$(my.dependency.comment)")
-. endif
-.
-. emit_check_libs_conditional_option(\
- my.dependency, my.configure, 0, "", "false")
-
-AC_MSG_NOTICE([$(my.cname)_LIBS : ${$(my.cname)_LIBS}])
-
-.endmacro # check_lib_dependency_conditional
-.
-.#-----------------------------------------------------------------------------
-.# AX_BOOST_BASE
-.#-----------------------------------------------------------------------------
-.macro check_boost(dependency)
-. define my.dependency = check_boost.dependency
-. require(my.dependency, "dependency", "version")
-.
-. define my.version = my.dependency.version
-. define my.compiler = my.dependency.compiler?
-. define my.show_compiler = is_empty(my.compiler) ?? "" ? " if in $(my.compiler)"
-. define my.compiler_pattern = is_empty(my.compiler) ?? "*" ? "*$(my.compiler)*"
-. heading2("Require Boost of at least version $(my.version)$(my.show_compiler) and output ${boost_CPPFLAGS/LDFLAGS}.")
-. if (!is_empty(my.dependency.comment))
-. heading3("$(my.dependency.comment)")
-. endif
-AS_CASE([${CC}], [$(my.compiler_pattern)],
- [AX_BOOST_BASE([$(my.version)],
- [AC_SUBST([boost_CPPFLAGS], [${BOOST_CPPFLAGS}])
- AC_SUBST([boost_ISYS_CPPFLAGS], [$(substitute_system_include("BOOST_CPPFLAGS"))])
- AC_SUBST([boost_LDFLAGS], [${BOOST_LDFLAGS}])
- AC_MSG_NOTICE([boost_CPPFLAGS : ${boost_CPPFLAGS}])
- AC_MSG_NOTICE([boost_ISYS_CPPFLAGS : ${boost_ISYS_CPPFLAGS}])
- AC_MSG_NOTICE([boost_LDFLAGS : ${boost_LDFLAGS}])],
- [AC_MSG_ERROR([Boost $(my.version) or later is required but was not found.])])])
-
-AS_CASE([${enable_isystem}],[yes],
- [AC_SUBST([boost_BUILD_CPPFLAGS], [${boost_ISYS_CPPFLAGS}])],
- [AC_SUBST([boost_BUILD_CPPFLAGS], [${boost_CPPFLAGS}])])
-
-AC_MSG_NOTICE([boost_BUILD_CPPFLAGS : ${boost_BUILD_CPPFLAGS}])
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AX_BOOST_XXX
-.#-----------------------------------------------------------------------------
-.macro check_boost_lib(dependency, configure)
-. define my.dependency = check_boost_lib.dependency
-. define my.configure = check_boost_lib.configure
-. require(my.dependency, "dependency", "name")
-.
-. define my.symbol = find_option_symbol(my.dependency, my.configure)?
-. define my.cname = "$(my.dependency.name:c)"
-. define my.uname = "$(my.cname:upper)"
-. if (!is_empty(my.dependency.comment))
-. heading3("$(my.dependency.comment)")
-. endif
-.
-. if (is_empty(my.symbol))
-AX_$(my.uname)
-AC_SUBST([$(my.cname)_LIBS], [${$(my.uname)_LIB}])
-AC_MSG_NOTICE([$(my.cname)_LIBS : ${$(my.cname)_LIBS}])
-. else
-AS_CASE([${$(my.symbol)}], [yes],
- [AX_$(my.uname)
- AC_SUBST([$(my.cname)_LIBS], [${$(my.uname)_LIB}])
- AC_MSG_NOTICE([$(my.cname)_LIBS : ${$(my.cname)_LIBS}])],
- [AC_SUBST([$(my.cname)_LIBS], [])])
-. endif
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# PKG_CHECK_MODULES
-.#-----------------------------------------------------------------------------
-.macro check_package(dependency, configure)
-. define my.dependency = check_package.dependency
-. define my.configure = check_package.configure
-. require(my.dependency, "dependency", "name")
-. require(my.dependency, "dependency", "version")
-.
-. define my.name = my.dependency.name
-. define my.cname = "$(my.dependency.name:c)"
-. define my.version = my.dependency.version
-. define my.default = my.dependency.default ? ""
-. define my.prefix = is_true(my.dependency.unprefixed) ?? "" ? "lib"
-. define my.symbol = find_option_symbol(my.dependency, my.configure)?
-. define my.check = "$(my.prefix)$(my.name) >= $(my.version)"
-.
-. if (defined(my.symbol))
-. define my.option = my.configure->option(option.name = my.dependency.option)
-. define my.option.type = get_option_type(my.option)
-. endif
-.
-. heading2("Require $(my.name) of at least version $(my.version) and output ${$(my.cname)_CPPFLAGS/LIBS/PKG}.")
-. if (!is_empty(my.dependency.comment))
-. heading3("$(my.dependency.comment)")
-. endif
-.
-. define my.indent = is_empty(my.symbol) ?? "" ? " "
-. define my.indent_wrapped = is_empty(my.symbol) ?? "" ? " "
-. define my.wrap_lead = is_empty(my.symbol) ?? "" ? "["
-. define my.wrap_trail = is_empty(my.symbol) ?? "" ? "],"
-. define my.end_section = "],"
-. if (!is_empty(my.symbol))
-AS_CASE([${$(my.symbol)}], [yes],
-. endif
-.
-$(my.indent)$(my.wrap_lead)PKG_CHECK_MODULES([$(my.cname)], [$(my.check)], [],
- $(my.indent)[
-. if (is_empty(my.symbol))
- $(my.indent)AC_MSG_ERROR([$(my.check) is required but was not found.])
-. elsif (is_empty(my.dependency.extract))
- $(my.indent)AC_MSG_ERROR([--$(my.option.type)-$(my.option.name) specified but $(my.check) was not found.])
-. else
- $(my.indent)$(my.cname)_INCLUDEDIR=""
- $(my.indent)$(my.cname)_OTHER_CFLAGS=""
- $(my.indent)$(my.symbol)="$(my.default)"
-. endif
- $(my.indent)])
-$(my.indent_wrapped)AC_SUBST([$(my.cname)_PKG], ['$(my.check)'])
-$(my.indent_wrapped)AC_SUBST([$(my.cname)_CPPFLAGS], [${$(my.cname)_CFLAGS}])
-$(my.indent_wrapped)AC_SUBST([$(my.cname)_ISYS_CPPFLAGS], [$(substitute_system_include("$(my.cname)_CPPFLAGS"))]])
-$(my.indent_wrapped)AC_MSG_NOTICE([$(my.cname)_CPPFLAGS : ${$(my.cname)_CPPFLAGS}])
-$(my.indent_wrapped)AC_MSG_NOTICE([$(my.cname)_ISYS_CPPFLAGS : ${$(my.cname)_ISYS_CPPFLAGS}])
-$(my.indent_wrapped)AC_MSG_NOTICE([$(my.cname)_OTHER_CFLAGS : ${$(my.cname)_OTHER_CFLAGS}])
-$(my.indent_wrapped)AC_MSG_NOTICE([$(my.cname)_INCLUDEDIR : ${$(my.cname)_INCLUDEDIR}])
-$(my.indent_wrapped)AC_MSG_NOTICE([$(my.cname)_LIBS : ${$(my.cname)_LIBS}])$(my.wrap_trail)
-.
-. if (!is_empty(my.symbol))
- [AC_SUBST([$(my.cname)_PKG], [])])
-. endif
-
-AS_CASE([${enable_isystem}],[yes],
- [AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_ISYS_CPPFLAGS}])],
- [AC_SUBST([$(my.cname)_BUILD_CPPFLAGS], [${$(my.cname)_CPPFLAGS}])])
-
-AC_MSG_NOTICE([$(my.cname)_BUILD_CPPFLAGS : ${$(my.cname)_BUILD_CPPFLAGS}])
-
-.endmacro # check_package
-.
-.#-----------------------------------------------------------------------------
-.# Compound flags AX_CHECK_COMPILE_FLAG
-.#-----------------------------------------------------------------------------
-.macro render_compound_flags(compound, repository)
-. define my.compound = render_compound_flags.compound
-. require(my.compound, "compound", "name")
-. require(my.compound, "compound", "comment")
-. define my.repository = render_compound_flags.repository
-.
-. if defined(my.compound.option)
-. define my.option = my.repository->configure->option(name = my.compound.option)
-. if !defined(my.option)
-. abort("Matching option '$(my.compound.option)' not found for '$(my.compound.name)'.")
-. endif
-. endif
-.
-. define my.indent = defined(my.option) ?? " " ? ""
-. define my.flags = join_flags_name(my.compound)
-. define my.terminator = "])"
-.
-. if defined(my.option)
-. my.terminator = "])])"
-AS_IF([test x${$(get_option_symbol(my.option))} != "xno"],
- [AX_CHECK_COMPILE_FLAG([$(my.flags)],
-. else
-AX_CHECK_COMPILE_FLAG([$(my.flags)],
-. endif
- $(my.indent)[AC_DEFINE([$(my.compound.type:upper)_$(my.compound.name:upper)])
- $(my.indent) CXXFLAGS="$CXXFLAGS $(my.flags)";
- $(my.indent) AC_SUBST([$(my.compound.name:lower)], ["$(my.flags)"])],
- $(my.indent)[AC_MSG_ERROR([$(my.flags) not supported.])],
-. if defined(my.compound->program)
-. define my.prog_indent = " $(my.indent)"
-. define my.prog_prefix = " $(my.indent)["
- $(my.indent)[],
-. render_test_program(my.compound->program, my.prog_indent, my.prog_prefix, my.terminator)
-. else
- $(my.indent)[$(my.terminator)
-. endif
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AX_CHECK_XXX_FLAG
-.#-----------------------------------------------------------------------------
-.macro render_flag(flag)
-. define my.flag = render_flag.flag
-. require(my.flag, "flag", "name")
-. require(my.flag, "flag", "comment")
-.
-. define my.flags_variable = get_flags_variable(my.flag)
-. define my.flags_check = get_flags_check(my.flag)
-. define my.show_disabled = is_empty(my.flag.compiler) | (my.flag.compiler = "disabled")
-. define my.show_compiler = my.show_disabled ?? "" ? " Enabled in $(my.flag.compiler) only."
-. define my.compiler_pattern = is_empty(my.flag.compiler) ?? "*" ? "*$(my.flag.compiler)*"
-. heading2("$(my.flag.comment)$(my.show_compiler)")
-.
-. define my.check_terminator = defined(my.flag.alternate) ?? "," ? ")])"
-.
-AS_CASE([${CC}], [$(my.compiler_pattern)],
- [AX_CHECK_$(my.flags_check)_FLAG([-$(my.flag.name)],
- [$(my.flags_variable)="$$(my.flags_variable) -$(my.flag.name)"]$(my.check_terminator)
-. if (defined(my.flag.alternate))
- [AX_CHECK_$(my.flags_check)_FLAG([-$(my.flag.alternate)],
- [$(my.flags_variable)="$$(my.flags_variable) -$(my.flag.alternate)"])])])
-. endif
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AC_SUBST
-.#-----------------------------------------------------------------------------
-.macro output_value(name, value)
-. if (defined(my.value))
-. heading2("Output ${$(my.name)}")
-AC_SUBST([$(my.name)], [$(my.value)])
-. endif
-
-.endmacro
-.
-.#-----------------------------------------------------------------------------
-.# AC_OUTPUT
-.#-----------------------------------------------------------------------------
-.macro compile(files)
-AC_CONFIG_FILES([$(my.files)])
-AC_OUTPUT
-.endmacro
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-function generate_configure(path_prefix)
-for generate.repository by name as _repository
-
- require(_repository, "repository", "name")
- define my.output_path = join(my.path_prefix,\
- canonical_path_name(_repository))
-
- create_directory(my.output_path)
- define my.out_file = "$(my.output_path)/configure.ac"
- notify(my.out_file)
- output(my.out_file)
-
- copyleft(_repository.name)
- define my.configure = _repository->configure
-
- heading1("Standard declarations.")
- initialize_configure(_repository)
- require_stdcxx(_repository)
-
- if (defined(my.configure->option))
- heading1("Process options.")
- for my.configure.option as _option
- render_option(_option)
- endfor
- endif
-
- new isystem_option as _isystem
- _isystem.type = "enable"
- _isystem.name = "isystem"
- _isystem.default = "no"
- _isystem.description = "Substitute -isystem for -I in dependencies."
- render_option(_isystem)
- endnew
-
- if (defined(my.configure->define))
- heading1("Set preprocessor defines.")
- for my.configure.define as _define
- render_define_item(_define, my.configure)
- endfor
- endif
-
- if (defined(my.configure->flag))
- heading1("Set flags.")
- for my.configure.flag as _flag
- render_flag(_flag)
- endfor
- endif
-
- if (defined(my.configure->compound))
- heading1("Set flags for compound flags.")
- for my.configure.compound as _compound
- render_compound_flags(_compound, _repository)
- endfor
- endif
-
- if (defined(my.configure->dependency))
- heading1("Check dependencies.")
- for my.configure.dependency as _dependency where has_m4(_dependency)
- if (is_boost_dependency(_dependency))
- check_boost(_dependency)
- elsif (is_boost_lib_dependency(_dependency))
- check_boost_lib(_dependency, my.configure)
- elsif (is_java_dependency(_dependency))
- check_java(_dependency, my.configure)
- elsif (is_python_dependency(_dependency))
- check_python(_dependency, my.configure)
- elsif (is_package_dependency(_dependency))
- check_package(_dependency, my.configure)
- elsif (is_pthread_dependency(_dependency))
- check_m4_cpp_libs_conditional(_dependency, my.configure)
- elsif (is_iconv_dependency(_dependency))
- check_iconv(_dependency, my.configure)
- else
- check_lib_dependency_conditional(_dependency, my.configure)
- endif
- endfor
- endif
-
- heading1("Process outputs into templates.")
- define my.packages = get_package_files(_repository)
- define my.templates = format_template_files(my.configure)
- compile("Makefile$(my.packages)$(my.templates)")
-
- close
-endfor _repository
-endfunction # generate_configure
-###############################################################################
-# NOTES on: -all-static
-# Always choose static libraries where possible, and try to create a completely
-# statically linked executable.
-# -static is interpreted by libtool, where it has a different meaning.
-# In libtool-speak, it's -all-static.
-# AX_CHECK_LINK_FLAG([[-static]],[LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"])
-# AC_SUBST(LIBTOOL_APP_LDFLAGS)
-###############################################################################
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_configure("output")
-
-.endtemplate
diff --git a/templates/gsl.debug.natvis b/templates/gsl.debug.natvis
deleted file mode 100644
index 70ac51ef..00000000
--- a/templates/gsl.debug.natvis
+++ /dev/null
@@ -1,55 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate debug.natvis.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Generation
-###############################################################################
-.macro generate_natvis(path_prefix)
-. for generate.repository by name as _repository
-. require(_repository, "repository", "name")
-. my.output_path = join(my.path_prefix, canonical_path_name(_repository))
-. create_directory(my.output_path)
-. define my.out_file = "$(my.output_path)/builds/msvc/debug.natvis"
-. notify(my.out_file)
-. output(my.out_file)
-.
-
-. xml_copyleft(_repository.name)
-
-
-
-
- { m_backend }
-
-
-
-
- { m_data }
-
-
-
-. endfor _repository
-.endmacro # generate_natvis
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_natvis("output")
-
-.endtemplate
\ No newline at end of file
diff --git a/templates/gsl.package.pc.in b/templates/gsl.package.pc.in
deleted file mode 100644
index 4fddb399..00000000
--- a/templates/gsl.package.pc.in
+++ /dev/null
@@ -1,255 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin.pc.in.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-# Cflags is a conflation of CFLAGS and CPPFLAGS, but not for CXXFLAGS.
-function format_cflags(variables, package)
- define my.variables = format_cflags.variables
- define my.package = format_cflags.package
- for my.package.flag as _flag
- my.variables.cflags += " $(_flag.value)"
- endfor
-endfunction
-
-# Libs is a conflation of LDFLAGS and LDADD|LIBADD values.
-function format_libs(variables, package)
- define my.variables = format_libs.variables
- define my.package = format_libs.package
- for my.package.library as _library
- define my.private = is_private_element(_library) ?? "_private" ? ""
- my.variables.libs$(my.private) += " $(_library.name)"
- endfor
-endfunction
-
-# Unconditional package dependencies are generated as literal inequalities.
-function format_conditional_pkg(dependency)
- define my.dependency = format_conditional_pkg.dependency
- define my.name = "$(my.dependency.name)"
- if (is_optional_element(my.dependency))
- return "@$(my.name:c)_PKG@"
- endif
- define my.prefix = is_true(my.dependency.unprefixed) ?? "" ? "lib"
- define my.package = "$(my.prefix)$(my.name)"
- return "$(my.package) >= $(my.dependency.version)"
-endfunction
-
-function initialize_package_variables(variables, package)
- define my.variables = initialize_package_variables.variables
- define my.package = initialize_package_variables.package
- my.variables.cflags = " -I${includedir}"
-
- for my.package.includedir as _include
- my.variables.cflags = "$(my.variables.cflags) @$(_include.name)@"
- endfor
-
- my.variables.libs = " -L${libdir}"
- my.variables.libs_private = ""
- my.variables.requires = ""
- my.variables.requires_private = ""
-endfunction
-
-function define_library_variables(variables, library, make, configure, repository)
- define my.variables = define_library_variables.variables
- define my.library = define_library_variables.library
- define my.make = define_library_variables.make
- define my.configure = define_library_variables.configure
- define my.repository = define_library_variables.repository
- require(my.library, "library", "name")
- define my.name = my.library.name
- define my.cname = "$(my.name:c)"
-
- define my.product = find_library_product(my.name, my.make, my.repository)?
- if (defined(my.product))
- if (is_no_install(my.product))
- abort "Package-referenced library is not installed: $(my.name)"
- endif
- my.variables.libs = "-l$(my.name)"
- else
- define my.dependency = find_dependency_by_name(my.name, my.configure)?
- if (!defined(my.dependency))
- abort "The packaged library has no dependency: $(my.name)"
- endif
- define my.is_package = is_package_dependency(my.dependency)
- define my.is_function = is_function_dependency(my.dependency)
- define my.is_boost = is_boost_dependency(my.dependency)
- define my.is_boost_lib = is_boost_lib_dependency(my.dependency)
- define my.is_language = is_java_dependency(my.dependency) |\
- is_python_dependency(my.dependency)
- define my.is_common = is_pthread_dependency(my.dependency) |\
- is_iconv_dependency(my.dependency)
-
- define my.private = is_private_element(my.dependency)\
- ?? "_private" ? ""
-
- if (my.is_boost)
- my.variables.libs$(my.private) += " @$(my.cname)_LDFLAGS@"
- endif
- if (my.is_boost_lib | my.is_common | my.is_function)
- my.variables.libs$(my.private) += " @$(my.cname)_LIBS@"
- endif
- if (my.is_package)
- define my.package = format_conditional_pkg(my.dependency)
- my.variables.requires$(my.private) += " $(my.package)"
- endif
- if (my.is_boost | my.is_common | my.is_language)
- my.variables.cflags += " @$(my.cname)_CPPFLAGS@"
- endif
- endif
-endfunction
-
-# Define Cflags, Libs|Libs.private and Requires|Requires.private variables.
-function define_package_variables(variables, package, make, configure, repository)
- define my.variables = define_package_variables.variables
- define my.package = define_package_variables.package
- define my.make = define_package_variables.make
- define my.configure = define_package_variables.configure
- define my.repository = define_package_variables.repository
- require(my.package, "package", "library")
- initialize_package_variables(_variables, my.package)
-
- # Add explicit package.flag declarations.
- format_cflags(my.variables, my.package)
-
- # Add explicit package.library declarations.
- format_libs(my.variables, my.package)
-
- # Get the lib product that corresponds to the package.
- define my.product = find_library_product(my.package.library, my.make,\
- my.repository)?
-
- if (!defined(my.product))
- #abort "Packaged library is not a product: $(my.name)"
- return
- elsif (is_no_install(my.product))
- abort "Packaged library is not installed: $(my.name)"
- endif
- my.variables.libs += " -l$(my.package.library)"
-
- # Get the dependency libs of the product and their flags.
- for my.product.library as _library
- define_library_variables(my.variables, _library, my.make,\
- my.configure, my.repository)
- endfor
-endfunction
-
-function write_package_variable(name, value)
- if (!is_empty(my.value))
- write_line("$(my.name):$(my.value)")
- endif
-endfunction
-
-function write_public_variable(name, value)
- return write_package_variable(my.name, my.value)
-endfunction
-
-function write_private_variable(name, value)
- return write_package_variable("$(my.name).private", my.value)
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro initialize_package_substitutions(package)
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-.for my.package.include as _include
-. if (defined(_include.name) & defined(_include.suffix))
-$(_include.name)_includedir=@includedir@/$(_include.suffix)
-. endif
-.endfor
-.
-.endmacro # initialize_package_substitutions
-.
-.macro initialize_package_metadata(package)
-. require(my.package, "package", "description")
-. require(my.package, "package", "url")
-Name: $(get_package_name(my.package))
-Description: $(my.package.description)
-URL: $(my.package.url)
-Version: @PACKAGE_VERSION@
-
-.
-.endmacro # initialize_package_metadata
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-function generate_pkgconfig(path_prefix)
-for generate.repository by name as _repository\
- where defined(_repository->package)
-
- define my.make = _repository->make
- define my.configure = _repository->configure
-
- for _repository.package as _package
- require(_repository, "repository", "name")
- my.output_path = join(my.path_prefix, canonical_path_name(_repository))
- create_directory(my.output_path)
- define my.package_name = get_package_name(_package)
- define my.out_file = "$(my.output_path)/$(my.package_name).pc.in"
- notify(my.out_file)
- output(my.out_file)
-
- copyleft(_repository.name)
-
- heading1("Substitutions")
- initialize_package_substitutions(_package)
-
- heading1("Metadata")
- initialize_package_metadata(_package)
-
- heading1("Variables")
- new variables as _variables
- define_package_variables(_variables, _package, my.make,\
- my.configure, _repository)
-
- heading2("Dependencies that publish package configuration.")
- write_public_variable("Requires", _variables.requires)
- write_private_variable("Requires", _variables.requires_private)
- write_line()
-
- heading2("Include directory and any other required compiler flags.")
- write_public_variable("Cflags", _variables.cflags)
- write_line()
-
- heading2("Lib directory, lib and any required that do not publish pkg-config.")
- write_public_variable("Libs", _variables.libs)
- write_private_variable("Libs", _variables.libs_private)
- write_line()
- endnew
-
- close
- endfor _package
-endfor _repository
-endfunction # generate_pkgconfig
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_pkgconfig("output")
-
-.endtemplate
diff --git a/templates/gsl.packages.config b/templates/gsl.packages.config
deleted file mode 100644
index 7f3ac89a..00000000
--- a/templates/gsl.packages.config
+++ /dev/null
@@ -1,167 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin packages.config.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-###
-### packages.config related string generators
-###
-function project_build_dir_relative_path(repository, product, path_prefix,\
- vs_version)
-
- define my.repository = project_build_dir_relative_path.repository
- require(my.repository, "repository", "name")
- define my.product = project_build_dir_relative_path.product
- define my.proj_name = project_name(my.product, my.repository)
- define my.subpath = "builds/msvc/$(my.vs_version)"
- return append_path(append_path(append_path(my.path_prefix,\
- canonical_path_name(my.repository)), my.subpath), my.proj_name)
-endfunction
-
-function packages_config_file(repository, product, path_prefix, vs_version)
- define my.repository = packages_config_file.repository
- define my.product = packages_config_file.product
- define my.proj_relative_path = project_build_dir_relative_path(\
- my.repository, my.product, my.path_prefix, my.vs_version)
-
- return append_path(my.proj_relative_path, "packages.config")
-endfunction
-
-###
-### functional artifact emission
-###
-function emit_packages(toolset, repository, product)
- define my.toolset = emit_packages.toolset
- define my.repository = emit_packages.repository
- require(my.repository, "repository", "name")
- define my.product = emit_packages.product
- require(my.product, "product", "path")
- require(my.product, "product", "prefix")
- require(my.product, "product", "uuid")
-
- new nuget_dependencies as _nuget
- get_dependencies_nuget(_nuget, generate->nuget, generate,\
- my.repository->configure, my.toolset->nuget.version)
-
- get_dependencies_nuget(_nuget, generate->nuget, generate,\
- my.repository->configure, my.toolset->nuget.version,\
- my.product.option)
-
- if (!defined(my.product.option))
- get_dependencies_nuget(_nuget, generate->nuget, generate,\
- my.repository->configure, my.toolset->nuget.version,\
- "consensus")
- endif
-
- for _nuget.element as _element by _element.name
- require(_element, "element", "name")
- require(_element, "element", "version")
-
- emit_package_item(_element)
- endfor
- endnew
-endfunction
-
-function emit_packages_config(toolset, repository, product)
- define my.toolset = emit_packages_config.toolset
- define my.repository = emit_packages_config.repository
- require(my.repository, "repository", "name")
- define my.product = emit_packages_config.product
- require(my.product, "product", "path")
- require(my.product, "product", "prefix")
- require(my.product, "product", "uuid")
-
- emit_xml_declaration()
- xml_copyleft(my.repository.name)
- emit_packages_open()
- emit_packages(my.toolset, my.repository, my.product)
- emit_packages_close()
-endfunction # emit_packages_config
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro emit_xml_declaration()
-
-.endmacro emit_xml_declaration
-.
-.macro emit_packages_open()
-
-.endmacro emit_packages_open
-.
-.macro emit_packages_close()
-
-.endmacro emit_packages_close
-.
-.macro emit_package_item(package)
-. define my.package = emit_package_item.package
-. require(my.package, "package", "name")
-. require(my.package, "package", "version")
-
-.endmacro emit_package_item
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-function generate_packages_config(path_prefix, generate)
- define my.generate = generate_packages_config.generate
-
- for my.generate->vs.version as _version by _version.value
- define my.toolset = my.generate->msvc->toolset(\
- _toolset.name = _version.value, _toolset)
-
- for my.generate.repository as _repository by _repository.name
- require(_repository, "repsoitory", "name")
-
- define my.absolute_path = join(join(global.root, my.path_prefix, \
- _repository.name))
-
- for _repository->make.product as _product where \
- has_uuid(_product) & defined(_product.path)
-
- define my.dirname = project_build_dir_relative_path(\
- _repository, _product, my.path_prefix, _version.value)
-
- define my.filename = packages_config_file(_repository, \
- _product, my.path_prefix, _version.value)
-
- create_directory(my.dirname)
- notify(my.filename)
- output(my.filename)
-
- emit_packages_config(my.toolset, _repository, _product)
- close
- endfor _product
- endfor _repository
- endfor _version
-endfunction # generate_packages_config
-
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-gsl from "templates/shared/common_msvc_artifacts.gsl"
-
-generate_packages_config("output", generate)
-
-.endtemplate
diff --git a/templates/gsl.runner.sh b/templates/gsl.runner.sh
deleted file mode 100644
index 0eedf8bc..00000000
--- a/templates/gsl.runner.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate [test]_runner.sh.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-function get_test_list(product)
- define my.product = get_test_list.product
- define my.tests = ""
- for my.product->runner.run as _run
- my.tests = join(my.tests, _run.test, ",")
- endfor
- return my.tests
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro write_test_run(path)
-.
-# ALlow CI to send errors to standard output
-if [[ $CI == true ]]; then
- \./$(my.path) ${BOOST_UNIT_TEST_OPTIONS}
-else
- \./$(my.path) ${BOOST_UNIT_TEST_OPTIONS} > test.log
-fi
-.endmacro
-.
-.macro write_test_options(tests)
-. define my.run = is_empty(my.tests) ?? "*" ? "$(my.tests)"
-.
-BOOST_UNIT_TEST_OPTIONS=\\
-"--run_test=$(my.run) "\\
-"--log_level=warning "\\
-"--show_progress=no "\\
-"--detect_memory_leak=0 "\\
-"--report_level=no "\\
-"--build_info=yes"
-
-.endmacro
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-function generate_runner(path_prefix)
-for generate.repository by name as _repository\
- where (defined(_repository->make))
- require(_repository, "repository", "name")
- for _repository->make.product as _product\
- where (defined(_product->runner))
-
- define target_name = target_name(_product, _repository)
- my.output_path = join(my.path_prefix, canonical_path_name(_repository))
- create_directory(my.output_path)
- define my.out_file = "$(my.output_path)/$(target_name)_runner.sh"
- notify(my.out_file)
- output(my.out_file)
-
- shebang("sh")
- copyleft(_repository.name)
-
- define my.runner = _product->runner
- define my.path = "$(_product.path)/$(target_name)"
- define my.tests = get_test_list(_product)
-
- heading1("Define tests and options.")
- write_test_options(my.tests)
-
- heading1("Run tests.")
- write_test_run(my.path)
-
- close
- endfor _product
-endfor _repository
-endfunction # generate_runner
-.endtemplate
-.template 0
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-
-generate_runner("output")
-
-.endtemplate
diff --git a/templates/gsl.vcxproj b/templates/gsl.vcxproj
deleted file mode 100644
index 0802928f..00000000
--- a/templates/gsl.vcxproj
+++ /dev/null
@@ -1,959 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin .vcxproj.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-###
-### vcxproj related string generators
-###
-function project_build_relative_path(repository, product, path_prefix,\
- vs_version)
-
- define my.repository = project_build_relative_path.repository
- require(my.repository, "repository", "name")
- define my.product = project_build_relative_path.product
- define my.proj_name = project_name(my.product, my.repository)
- define my.subpath = "builds/msvc/$(my.vs_version)"
- return append_path(append_path(append_path(my.path_prefix,\
- canonical_path_name(my.repository)), my.subpath), my.proj_name)
-endfunction
-
-function project_file(repository, product, path_prefix, vs_version)
- define my.repository = project_file.repository
- define my.product = project_file.product
- define my.project_relative_path = project_build_relative_path(\
- my.repository, my.product, my.path_prefix, my.vs_version)
-
- define my.proj_name = project_name(my.product, my.repository)
- return append_path(my.project_relative_path, "$(my.proj_name).vcxproj")
-endfunction
-
-###
-### utilities
-###
-function append_prefix(base, subdir)
- if (!is_empty(my.base))
- return "$(my.base)_$(my.subdir)"
- endif
- return "$(my.subdir)"
-endfunction
-
-function repository_library_uuid(repository)
- define my.repository = repository_library_uuid.repository
- return my.repository->make->product(is_library(_product), _product).uuid
-endfunction
-
-function is_compiled_type(element)
- define my.element = is_compiled_type.element
- return matches_filetype(my.element.name, "cpp") |\
- matches_filetype(my.element.name, "c")
-endfunction
-
-function is_included_type(element)
- define my.element = is_included_type.element
- return matches_filetype(my.element.name, "hpp") |\
- matches_filetype(my.element.name, "h")
-endfunction
-
-function is_none_type(element)
- define my.element = is_none_type.element
- return matches_filetype(my.element.name, "ipp")
-endfunction
-
-function is_resources_type(element)
- define my.element = is_resources_type.element
- return matches_filetype(my.element.name, "rc")
-endfunction
-
-function object_base_from_element(element)
- define my.element = object_base_from_element.element
- if (matches_filetype(my.element.name, "cpp"))
- return global.left(my.element.name,\
- string.length(my.element.name) - 4)
- elsif (matches_filetype(my.element.name, "c"))
- return global.left(my.element.name,\
- string.length(my.element.file_name) - 2)
- endif
-
- return my.element.name
-endfunction
-
-function matches_filetype(name, extension)
- return (regexp.match("(^.)(.*)\\.$(my.extension)$", my.name) > 0)
-endfunction
-
-function is_option_console(product)
- define my.product = is_option_console.product
- return defined(my.product.option) & (my.product.option = "console")
-endfunction
-
-function is_option_tests(product)
- define my.product = is_option_tests.product
- return defined(my.product.option) & (my.product.option = "tests")
-endfunction
-
-###
-### generic assistance functions
-###
-function unsuffix(name)
- return string.substr(my.name, 0, string.locate_last(my.name, ".") - 1)
-endfunction
-
-function match_name(element, name)
- define my.element = match_name.element
- return defined(my.element) & (my.element.name = my.name)
-endfunction
-
-function match_unsuffixed(element, name)
- define my.element = match_unsuffixed.element
- if (unsuffix(my.element.name) = unsuffix(my.name))
- endif
-
- return defined(my.element) & (unsuffix(my.element.name) = unsuffix(my.name))
-endfunction
-
-function exists_collision(root, name)
- define my.root = exists_collision.root
- return count(my.root.collision, match_unsuffixed(count, my.name)) > 0
-endfunction
-
-function add_collision(root, name)
- define my.root = add_collision.root
- if (defined(my.root) & !exists_collision(my.root, my.name))
- new my.root.collision as _collision
- _collision.name = my.name
- endnew
- endif
- return my.root
-endfunction
-
-function collides_file_name(root, name)
- define my.root = collides_file_name.root
- return count(my.root.file, match_unsuffixed(count, my.name)) > 1
-endfunction
-
-function populate_collisions(collisions, file_data)
- define my.collisions = populate_collisions.collisions
- define my.file_data = populate_collisions.file_data
-
- for my.file_data.file as _file
- if (collides_file_name(my.file_data, _file.name))
- add_collision(my.collisions, _file.name)
- endif
- endfor
-endfunction
-
-function get_nuget_package_target(package)
- define my.package = get_nuget_package_target.package
- define my.target = "\$(NuGetPackageRoot)$(my.package.name).$(my.package.version)/build/native/$(my.package.name).targets"
- if (starts_with(my.package.name, "boost") | starts_with(my.package.name, "libbitcoin-boost"))
- new version as _version
- split_version(_version, my.package.version)
- if ((conv.number(_version.major) >= 1) & (conv.number(_version.minor) >= 67))
- define my.target = "\$(NuGetPackageRoot)$(my.package.name).$(my.package.version)/build/$(my.package.name).targets"
- endif
- endnew
- endif
- return my.target
-endfunction
-
-###
-### functional artifact emission
-###
-function emit_item_group_compiler(repository, product, vs_version, file_data,\
- collisions)
-
- define my.repository = emit_item_group_compiler.repository
- define my.product = emit_item_group_compiler.product
- define my.file_data = emit_item_group_compiler.file_data
- define my.collisions = emit_item_group_compiler.collisions
-
- if ((my.repository.name = "libbitcoin-system") |\
- count(my.file_data.file, is_compiled_type(count)) > 0)
-
- emit_item_group_open()
- emit_compile_item_threadsafe_statistics(my.repository, my.product,\
- my.vs_version)
-
- for my.file_data.file as _file by _file.relative_name
- if (is_compiled_type(_file))
- emit_compile_item(my.collisions, _file)
- endif
- endfor
-
- emit_item_group_close()
- endif
-endfunction
-
-function emit_item_group_includes(file_data, collisions)
- define my.file_data = emit_item_group_includes.file_data
- define my.collisions = emit_item_group_includes.collisions
-
- if (count(my.file_data.file, is_included_type(count)) > 0)
- emit_item_group_open()
-
- for my.file_data.file as _file by _file.relative_name
- if (is_included_type(_file))
- emit_include_item(_file)
- endif
- endfor
-
- emit_item_group_close()
- endif
-endfunction
-
-function emit_item_group_none(file_data, collisions)
- define my.file_data = emit_item_group_none.file_data
- define my.collisions = emit_item_group_none.collisions
-
- emit_item_group_open()
-
- for my.file_data.file as _file by _file.relative_name
- if (is_none_type(_file))
- emit_none_item(_file)
- endif
- endfor
-
- new element as _element
- _element.name = "packages.config"
- _element.relative_name = "packages.config"
- _element.relative_path = ""
- _element.tag = ""
- emit_none_item(_element)
- endnew
-
- emit_item_group_close()
-endfunction
-
-function emit_item_group_resources(file_data, collisions)
- define my.file_data = emit_item_group_resources.file_data
- define my.collisions = emit_item_group_resources.collisions
-
- if (count(my.file_data.file, is_resources_type(count)) > 0)
- emit_item_group_open()
-
- for my.file_data.file as _file by _file.relative_name
- if (is_resources_type(_file))
- emit_resources_item(_file)
- endif
- endfor
-
- emit_item_group_close()
- endif
-endfunction
-
-function emit_item_group_product_configurations(product)
- define my.product = emit_item_group_product_configurations.product
- if (is_program(my.product))
- emit_item_group_product_configurations_binary()
- elsif (is_library(my.product))
- emit_item_group_product_configurations_library()
- else
- abort("Product type not recognized: $(my.product.prefix)")
- endif
-endfunction
-
-function emit_propery_group_configuration(product)
- define my.product = emit_propery_group_configuration.product
- if (is_library(my.product))
- emit_propery_group_configuration_library()
- endif
-endfunction
-
-function emit_import_group_extension_settings(toolset, repository, product)
- define my.toolset = emit_import_group_extension_settings.toolset
- define my.repository = emit_import_group_extension_settings.repository
- require(my.repository, "repository", "name")
- define my.product = emit_import_group_extension_settings.product
- require(my.product, "product", "path")
- require(my.product, "product", "prefix")
- require(my.product, "product", "uuid")
-
- emit_import_group_extension_settings_open()
-
- new nuget_dependencies as _nuget
- get_dependencies_nuget(_nuget, generate->nuget, generate,\
- my.repository->configure, my.toolset->nuget.version)
-
- get_dependencies_nuget(_nuget, generate->nuget, generate,\
- my.repository->configure, my.toolset->nuget.version,\
- my.product.option)
-
- if (!defined(my.product.option))
- get_dependencies_nuget(_nuget, generate->nuget, generate,\
- my.repository->configure, my.toolset->nuget.version,\
- "consensus")
- endif
-
- for _nuget.element as _element
- require(_element, "element", "name")
- require(_element, "element", "version")
-
- emit_import_project_nuget(_element)
- endfor
- endnew
-
- emit_import_group_extension_settings_close()
-endfunction
-
-function emit_target_ensure_nuget_imports(toolset, repository, product)
- define my.toolset = emit_target_ensure_nuget_imports.toolset
- define my.repository = emit_target_ensure_nuget_imports.repository
- require(my.repository, "repository", "name")
- define my.product = emit_target_ensure_nuget_imports.product
- require(my.product, "product", "path")
- require(my.product, "product", "prefix")
- require(my.product, "product", "uuid")
-
- emit_target_ensure_nuget_imports_open()
-
- new nuget_dependencies as _nuget
- get_dependencies_nuget(_nuget, generate->nuget, generate,\
- my.repository->configure, my.toolset->nuget.version)
-
- get_dependencies_nuget(_nuget, generate->nuget, generate,\
- my.repository->configure, my.toolset->nuget.version,\
- my.product.option)
-
- if (!defined(my.product.option))
- get_dependencies_nuget(_nuget, generate->nuget, generate,\
- my.repository->configure, my.toolset->nuget.version,\
- "consensus")
- endif
-
- for _nuget.element as _element
- require(_element, "element", "name")
- require(_element, "element", "version")
-
- emit_error_condition_nuget(_element)
- endfor
- endnew
-
- emit_target_ensure_nuget_imports_close()
-endfunction
-
-function emit_item_group_project_references(repository, product)
- define my.repository = emit_item_group_project_references.repository
- require(my.repository, "repository", "name")
- define my.product = emit_item_group_project_references.product
- require(my.product, "product", "path")
- require(my.product, "product", "prefix")
- require(my.product, "product", "uuid")
-
- if (!is_library(my.product))
- emit_item_group_open()
- emit_item_group_project_reference_item(my.repository.name,\
- repository_library_uuid(my.repository))
- emit_item_group_close()
- endif
-
-endfunction
-
-function emit_project(toolset, repository, product, project_path)
- define my.toolset = emit_project.toolset
- define my.repository = emit_project.repository
- require(my.repository, "repository", "name")
- define my.product = emit_project.product
- require(my.product, "product", "path")
- require(my.product, "product", "prefix")
- require(my.product, "product", "uuid")
- define my.product_path = "$(my.project_path)/$(my.product.path)"
- define my.product_dir = open_directory(my.product_path)
- define my.product_offset = "../../../../$(my.product.path)"
-
- emit_xml_declaration()
- xml_copyleft(my.repository.name)
- emit_project_open(msbuild_version(my.toolset, my.product))
-
- emit_property_group_globals(my.toolset, my.product, my.repository)
- emit_item_group_product_configurations(my.product)
- emit_propery_group_configuration(my.product)
- emit_import_props()
- emit_import_property_sheets()
-
- # scan files (product, conditionally 'includes', build relative resources)
- new encountered_files as _files
- get_files(_files, my.product_dir, my.product_offset, my.product.path,\
- "true", "true", "true")
-
- new collisions as _map
- populate_collisions(_map, _files)
-
- # TODO: consider providing this relationship in xml
- if (is_library(my.product))
- define my.include_path = "$(my.project_path)/include"
- define my.include_dir = open_directory(my.include_path)
- define my.headers_offset = "../../../../include"
-
- get_files(_files, my.include_dir, my.headers_offset,\
- "include", "true", "true", "true")
- endif
-
-
- if (is_library(my.product) |\
- (is_program(my.product) & !is_option_tests(my.product)))
-
- define my.resources_path = "$(my.project_path)/builds/msvc"
- define my.resources_dir = open_directory(my.resources_path)
-
- get_files(_files, my.resources_dir, "../../", "build", "false",\
- "true", "true")
- endif
-
- emit_item_group_compiler(my.repository, my.product,\
- my.toolset.name, _files, _map)
-
- emit_item_group_includes(_files, _map)
- emit_item_group_none(_files, _map)
- emit_item_group_resources(_files, _map)
- endnew
- endnew
-
- emit_import_targets()
- emit_import_group_extension_targets()
- emit_import_group_extension_settings(my.toolset, my.repository, my.product)
- emit_target_ensure_nuget_imports(my.toolset, my.repository, my.product)
- emit_item_group_project_references(my.repository, my.product)
- emit_item_group_natvis()
-
- emit_project_close()
-endfunction emit_project
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro emit_xml_declaration()
-
-.endmacro emit_xml_declaration
-.
-.macro emit_project_open(version)
-
-.endmacro emit_project_open
-.
-.macro emit_project_close()
-
-.endmacro emit_project_close
-.
-.macro emit_item_group_open()
-
-.endmacro emit_item_group_open
-.
-.macro emit_item_group_close()
-
-.endmacro emit_item_group_close
-.
-.macro emit_property_group_globals(toolset, product, repository)
-. define my.toolset = emit_property_group_globals.toolset
-. define my.product = emit_property_group_globals.product
-. define my.repository = emit_property_group_globals.repository
-. require(my.product, "product", "uuid")
-
-. if (is_program(my.product))
- Application
-. endif
- $(platform_toolset(my.toolset, my.product, my.repository))
- {$(my.product.uuid:upper)}
- $(project_name(my.product, my.repository))
-
-.endmacro emit_property_group_globals
-.
-.macro emit_item_group_product_configurations_library()
-
-
- DebugDLL
- Win32
-
-
- ReleaseDLL
- Win32
-
-
- DebugDLL
- x64
-
-
- ReleaseDLL
- x64
-
-
- DebugLTCG
- Win32
-
-
- ReleaseLTCG
- Win32
-
-
- DebugLTCG
- x64
-
-
- ReleaseLTCG
- x64
-
-
- DebugLIB
- Win32
-
-
- ReleaseLIB
- Win32
-
-
- DebugLIB
- x64
-
-
- ReleaseLIB
- x64
-
-
- DebugDEXE
- ARM
-
-
- ReleaseDEXE
- ARM
-
-
- DebugDEXE
- ARM64
-
-
- ReleaseDEXE
- ARM64
-
-
- DebugLEXE
- ARM
-
-
- ReleaseLEXE
- ARM
-
-
- DebugLEXE
- ARM64
-
-
- ReleaseLEXE
- ARM64
-
-
- DebugSEXE
- ARM
-
-
- ReleaseSEXE
- ARM
-
-
- DebugSEXE
- ARM64
-
-
- ReleaseSEXE
- ARM64
-
-
-.endmacro emit_item_group_product_configurations_library
-.
-.macro emit_propery_group_configuration_library()
-
- StaticLibrary
- DynamicLibrary
-
-.endmacro emit_propery_group_configuration_library
-.
-.macro emit_item_group_product_configurations_binary()
-
-
- DebugDEXE
- Win32
-
-
- ReleaseDEXE
- Win32
-
-
- DebugDEXE
- x64
-
-
- ReleaseDEXE
- x64
-
-
- DebugLEXE
- Win32
-
-
- ReleaseLEXE
- Win32
-
-
- DebugLEXE
- x64
-
-
- ReleaseLEXE
- x64
-
-
- DebugSEXE
- Win32
-
-
- ReleaseSEXE
- Win32
-
-
- DebugSEXE
- x64
-
-
- ReleaseSEXE
- x64
-
-
- DebugDEXE
- ARM
-
-
- ReleaseDEXE
- ARM
-
-
- DebugDEXE
- ARM64
-
-
- ReleaseDEXE
- ARM64
-
-
- DebugLEXE
- ARM
-
-
- ReleaseLEXE
- ARM
-
-
- DebugLEXE
- ARM64
-
-
- ReleaseLEXE
- ARM64
-
-
- DebugSEXE
- ARM
-
-
- ReleaseSEXE
- ARM
-
-
- DebugSEXE
- ARM64
-
-
- ReleaseSEXE
- ARM64
-
-
-.endmacro emit_item_group_product_configurations_binary
-.
-.macro emit_item_group_product_configurations_library()
-
-
- DebugDLL
- Win32
-
-
- ReleaseDLL
- Win32
-
-
- DebugDLL
- x64
-
-
- ReleaseDLL
- x64
-
-
- DebugLTCG
- Win32
-
-
- ReleaseLTCG
- Win32
-
-
- DebugLTCG
- x64
-
-
- ReleaseLTCG
- x64
-
-
- DebugLIB
- Win32
-
-
- ReleaseLIB
- Win32
-
-
- DebugLIB
- x64
-
-
- ReleaseLIB
- x64
-
-
- DebugDLL
- ARM
-
-
- ReleaseDLL
- ARM
-
-
- DebugDLL
- ARM64
-
-
- ReleaseDLL
- ARM64
-
-
- DebugLTCG
- ARM
-
-
- ReleaseLTCG
- ARM
-
-
- DebugLTCG
- ARM64
-
-
- ReleaseLTCG
- ARM64
-
-
- DebugLIB
- ARM
-
-
- ReleaseLIB
- ARM
-
-
- DebugLIB
- ARM64
-
-
- ReleaseLIB
- ARM64
-
-
-.endmacro emit_item_group_product_configurations_library
-.
-.macro emit_import_props()
-
-
-.endmacro emit_import_props
-.
-.macro emit_import_targets()
-
-.endmacro emit_import_targets
-.
-.macro emit_import_property_sheets()
-
-
-
-
-
-.endmacro emit_import_property_sheets
-.
-.macro emit_import_group_extension_targets()
-
-.endmacro emit_import_group_extension_targets
-.
-.macro emit_import_group_extension_settings_open()
-
-.endmacro emit_import_group_extension_settings_open
-.
-.macro emit_import_group_extension_settings_close()
-
-.endmacro emit_import_group_extension_settings_close
-.
-.macro emit_compile_item(collisions, file_record)
-. define my.collisions = emit_compile_item.collisions
-. define my.file_record = emit_compile_item.file_record
-.
-. if (!exists_collision(my.collisions, my.file_record.name))
-. emit_file_record_item("ClCompile", my.file_record)
-. else
-. emit_item_with_object("ClCompile", my.file_record)
-. endif
-.endmacro emit_compile_item
-.
-.macro emit_include_item(file_record)
-. define my.file_record = emit_include_item.file_record
-. emit_file_record_item("ClInclude", my.file_record)
-.endmacro emit_include_item
-.
-.macro emit_none_item(file_record)
-. define my.file_record = emit_none_item.file_record
-. emit_file_record_item("None", my.file_record)
-.endmacro emit_none_item
-.
-.macro emit_resources_item(file_record)
-. define my.file_record = emit_resources_item.file_record
-. emit_file_record_item("ResourceCompile", my.file_record)
-.endmacro emit_resources_item
-.
-.macro emit_item(type, include)
-. define my.type = emit_item.type
-. define my.file_record = emit_item.include
- <$(my.type) Include="$(my.include)" />
-.endmacro emit_item
-.
-.macro emit_file_record_item(type, file_record)
-. define my.type = emit_file_record_item.type
-. define my.file_record = emit_file_record_item.file_record
-. emit_item(my.type, make_windows_path(my.file_record.relative_name))
-.endmacro emit_file_record_item
-.
-.macro emit_item_with_object(type, file_record)
-. define my.file_record = emit_item_with_object.file_record
-. define my.obj_base_name = object_base_from_element(my.file_record)
-. define my.obj_full_name = "$(make_prefix(my.file_record.tag))_$(my.obj_base_name).obj"
- <$(my.type) Include="$(make_windows_path(my.file_record.relative_name))">
- \$(IntDir)$(my.obj_full_name)
- $(my.type)>
-.endmacro emit_item_with_object
-.
-.macro emit_import_project_nuget(package)
-. define my.package = emit_import_project_nuget.package
-. define my.target = get_nuget_package_target(my.package)
-. define my.windows_path = make_windows_path(my.target)
-
-.endmacro emit_import_project_nuget
-.
-.macro emit_target_ensure_nuget_imports_open()
-
-
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-.endmacro emit_target_ensure_nuget_imports_open
-.
-.macro emit_target_ensure_nuget_imports_close()
-
-.endmacro emit_target_ensure_nuget_imports_close
-.
-.macro emit_error_condition_nuget(package)
-. define my.package = emit_error_condition_nuget.package
-. define my.target = get_nuget_package_target(my.package)
-. define my.windows_path = make_windows_path(my.target)
-
-.endmacro emit_error_condition_nuget
-.
-.macro emit_item_group_project_reference_item(name, uuid)
-
- {$(my.uuid:upper)}
-
-.endmacro emit_item_group_project_reference_item
-.
-.macro emit_item_group_natvis()
-. emit_item_group_open()
-. emit_item("Natvis", "..\\..\\debug.natvis")
-. emit_item_group_close()
-.endmacro emit_item_group_natvis
-.
-.macro emit_compile_item_threadsafe_statistics(repository, product, vs_version)
-. define my.repository = emit_compile_item_threadsafe_statistics.repository
-. define my.product = emit_compile_item_threadsafe_statistics.product
-. if (requires_threadsafe_statistics(my.repository, my.product, my.vs_version))
-
- true
-
-. endif
-.endmacro emit_compile_item_threadsafe_statistics
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-function generate_vcxproj(path_prefix, generate)
- define my.generate = generate_vcxproj.generate
-
- for my.generate->vs.version as _version by _version.value
- define my.toolset = my.generate->msvc->toolset(\
- _toolset.name = _version.value, _toolset)
-
- for my.generate.repository as _repository by _repository.name
- require(_repository, "repsoitory", "name")
-
- define my.absolute_path = append_path(global.root,\
- canonical_path_name(_repository))
-
- for _repository->make.product as _product where \
- has_uuid(_product) & defined(_product.path)
-
- define my.dirname = project_build_relative_path(\
- _repository, _product, my.path_prefix, _version.value)
-
- define my.filename = project_file(_repository, \
- _product, my.path_prefix, _version.value)
-
- create_directory(my.dirname)
- notify(my.filename)
- output(my.filename)
-
- emit_project(my.toolset, _repository, _product,\
- my.absolute_path)
-
- close
- endfor _product
- endfor _repository
- endfor _version
-endfunction # generate_vcxproj
-
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-gsl from "templates/shared/common_msvc_artifacts.gsl"
-
-generate_vcxproj("output", generate)
-
-.endtemplate
diff --git a/templates/gsl.vcxproj.filters b/templates/gsl.vcxproj.filters
deleted file mode 100644
index e0c0783f..00000000
--- a/templates/gsl.vcxproj.filters
+++ /dev/null
@@ -1,473 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL generate libbitcoin .vcxproj.filters.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-###
-### uuid manipulation
-###
-function uuid_init(repository, product)
- define my.repository = uuid_init.repository
- define my.product = uuid_init.product
- return 0
-endfunction
-
-function uuid_inc(uuid)
- return my.uuid + 1
-endfunction
-
-function to_hex(value)
- define my.hex_value = math.mod(my.value, 16)
-
- if (my.hex_value >= 0 & my.hex_value <= 9)
- return conv.string(my.hex_value)
- elsif (my.hex_value = 10)
- return "a"
- elsif (my.hex_value = 11)
- return "b"
- elsif (my.hex_value = 12)
- return "c"
- elsif (my.hex_value = 13)
- return "d"
- elsif (my.hex_value = 14)
- return "e"
- elsif (my.hex_value = 15)
- return "f"
- else
- abort("")
- endif
-endfunction
-
-function to_uuid(seed, value)
- define my.wip = "0"
-
- while (my.value > 0)
- my.wip += to_hex(my.value)
- my.value = math.floor(my.value / 16)
- endwhile
-
- # NOTE: should vary this?
- define my.uuid = left(my.seed, 19)
- my.uuid += "0000-"
- define my.iter = 0
-
- # NOTE: supports at most 0x0fffffffffff
- while ((my.iter + string.length(my.wip)) < 12)
- my.uuid += 0
- my.iter +=1
- endwhile
-
- my.uuid += my.wip
-
- return my.uuid
-endfunction
-
-###
-### vcxproj related string generators
-###
-function project_build_relative_path(repository, product, path_prefix,\
- vs_version)
-
- define my.repository = project_build_relative_path.repository
- require(my.repository, "repository", "name")
- define my.product = project_build_relative_path.product
- define my.proj_name = project_name(my.product, my.repository)
- define my.subpath = "builds/msvc/$(my.vs_version)"
- return append_path(append_path(append_path(my.path_prefix,\
- canonical_path_name(my.repository)), my.subpath), my.proj_name)
-endfunction
-
-function project_file(repository, product, path_prefix, vs_version)
- define my.repository = project_file.repository
- define my.product = project_file.product
- define my.proj_relative_path = project_build_relative_path(\
- my.repository, my.product, my.path_prefix, my.vs_version)
-
- define my.proj_name = project_name(my.product, my.repository)
- return append_path(my.proj_relative_path, "$(my.proj_name).vcxproj.filters")
-endfunction
-
-###
-### generic assistance functions
-###
-function discover_directories(data, directory, win_path, value_path, uuid)
- define my.data = discover_directories.data
- define my.directory = discover_directories.directory
-
- for my.directory.directory as _dir by _dir.name
- if (!starts_with(_dir.name, "."))
- table_add(my.data, make_windows_path(append_path(my.value_path,\
- _dir.name)), my.uuid)
- my.uuid = uuid_inc(my.uuid)
- endif
- endfor
-
- for my.directory.directory as _dir by _dir.name
- define my.subdir = open_directory(append_path(my.directory.path,\
- _dir.name))
- define my.sub_path = append_path(my.win_path, _dir.name)
- define my.sub_value_path = append_path(my.value_path, _dir.name)
-
- if (!starts_with(_dir.name, "."))
- my.uuid = discover_directories(my.data, my.subdir, my.sub_path,\
- my.sub_value_path, my.uuid)
- endif
- endfor
-
- return my.uuid
-endfunction
-
-function matches_filetype(file_name, extension)
- return (regexp.match("(^.)(.*)\\.$(my.extension)$", my.file_name) > 0)
-endfunction
-
-function is_compiled_type(name)
- return matches_filetype(my.name, "cpp") |\
- matches_filetype(my.name, "c")
-endfunction
-
-function is_included_type(name)
- return matches_filetype(my.name, "hpp") |\
- matches_filetype(my.name, "h")
-endfunction
-
-function is_none_type(name)
- return matches_filetype(my.name, "ipp")
-endfunction
-
-function is_resources_type(name)
- return matches_filetype(my.name, "rc")
-endfunction
-
-function is_option_tests(product)
- define my.product = is_option_tests.product
- return defined(my.product.option) & (my.product.option = "tests")
-endfunction
-
-function filter_add(filters, item, uuid)
- define my.filters = filter_add.filters
- table_add(my.filters, my.item, my.uuid)
- return uuid_inc(my.uuid)
-endfunction
-
-###
-### functional artifact emission
-###
-function emit_declare_filters_item_group(directories, uuid_seed)
- define my.directories = emit_declare_filters_item_group.directories
-
- emit_item_group_open()
-
- for my.directories.row as _row by _row.name
- emit_filter_declaration(make_windows_path(_row.name),\
- to_uuid(my.uuid_seed, _row.value))
- endfor
-
- emit_item_group_close()
-endfunction
-
-function emit_item_group_compiler(files, repository, product, vs_version)
- define my.files = emit_item_group_compiler.files
- define my.repository = emit_item_group_compiler.repository
- define my.product = emit_item_group_compiler.product
-
- if ((my.repository.name = "libbitcoin-system") |\
- count(my.files.file, is_compiled_type(count.name)) > 0)
-
- emit_item_group_open()
- emit_item_compile_threadsafe_statistics(my.repository, my.product,\
- my.vs_version)
-
- for my.files.file as _file by _file.relative_name
- if (is_compiled_type(_file.name))
- emit_item_compile_filtered(_file.relative_name, _file.tag)
- endif
- endfor
-
- emit_item_group_close()
- endif
-endfunction
-
-function emit_item_group_includes(files)
- define my.files = emit_item_group_includes.files
-
- if (count(my.files.file, is_included_type(count.name)) > 0)
- emit_item_group_open()
-
- for my.files.file as _file by _file.relative_name
- if (is_included_type(_file.name))
- emit_item_include_filtered(_file.relative_name, _file.tag)
- endif
- endfor
-
- emit_item_group_close()
- endif
-endfunction
-
-function emit_item_group_none(files)
- define my.files = emit_item_group_none.files
-
- emit_item_group_open()
-
- for my.files.file as _file by _file.relative_name
- if (is_none_type(_file.name))
- emit_item_none_filtered(_file.relative_name, _file.tag)
- endif
- endfor
-
- emit_item_none("packages.config")
-
- emit_item_group_close()
-endfunction
-
-function emit_item_group_resources(files)
- define my.files = emit_item_group_resources.files
-
- if (count(my.files.file, is_resources_type(count.name)) > 0)
- emit_item_group_open()
-
- for my.files.file as _file by _file.relative_name
- if (is_resources_type(_file.name))
- emit_item_resource_filtered(_file.relative_name, _file.tag)
- endif
- endfor
-
- emit_item_group_close()
- endif
-endfunction
-
-function emit_filter(toolset, repository, product, project_path)
- define my.toolset = emit_filter.toolset
- define my.repository = emit_filter.repository
- define my.product = emit_filter.product
- require(my.product, "product", "path")
- require(my.product, "product", "uuid")
-
- emit_xml_declaration()
- xml_copyleft(my.repository.name)
- emit_project_open(msbuild_version(my.toolset, my.product))
-
- new directories as _directories
- new files as _files
- define my.product_prefix = "../../../../$(my.product.path)"
- define my.product_path = "$(my.project_path)/$(my.product.path)"
- define my.product_dir = open_directory(my.product_path)
- define my.product_winpath = "$(my.product.path)"
- define my.uuid = uuid_init(my.repository, my.product)
-
- my.uuid = filter_add(_directories, "src", my.uuid)
-
- my.uuid = discover_directories(_directories, my.product_dir,\
- my.product_winpath, "src", my.uuid)
-
- get_files(_files, my.product_dir, my.product_prefix, "src",\
- "true", "true", "true")
-
- if (is_library(my.product))
- define my.include_prefix = "../../../../include"
- define my.include_path = "$(my.project_path)/include"
- define my.include_dir = open_directory(my.include_path)
- define my.include_winpath = "include"
-
- my.uuid = filter_add(_directories, my.include_winpath, my.uuid)
-
- my.uuid = discover_directories(_directories, my.include_dir,\
- my.include_winpath, my.include_winpath, my.uuid)
-
- get_files(_files, my.include_dir, my.include_prefix,\
- my.include_winpath, "true", "true", "true")
- endif
-
-
- if (is_library(my.product) |\
- (is_program(my.product) & !is_option_tests(my.product)))
-
- define my.resources_prefix = "../.."
- define my.resources_path = "$(my.project_path)/builds/msvc"
- define my.resources_dir = open_directory(my.resources_path)
- define my.resources_winpath = "resource"
-
- my.uuid = filter_add(_directories, my.resources_winpath, my.uuid)
-
- get_files(_files, my.resources_dir, my.resources_prefix,\
- my.resources_winpath, "false", "true", "true")
- endif
-
- if (requires_threadsafe_statistics(my.repository, my.product,\
- my.toolset.name))
-
- my.uuid = filter_add(_directories, "src/external", my.uuid)
- endif
-
- emit_declare_filters_item_group(_directories, my.product.uuid)
- emit_item_group_compiler(_files, my.repository, my.product,\
- my.toolset.name)
-
- emit_item_group_includes(_files)
- emit_item_group_none(_files)
- emit_item_group_natvis()
- emit_item_group_resources(_files)
- endnew
- endnew
-
- emit_project_close()
-endfunction
-
-###############################################################################
-# Macros
-###############################################################################
-.endtemplate
-.template 1
-.
-.macro emit_xml_declaration()
-
-.endmacro emit_xml_declaration
-.
-.macro emit_project_open(version)
-
-.endmacro emit_project_open
-.
-.macro emit_project_close()
-
-.endmacro emit_project_close
-.
-.macro emit_item_group_open()
-
-.endmacro emit_item_group_open
-.
-.macro emit_item_group_close()
-
-.endmacro emit_item_group_close
-.
-.macro emit_filter_declaration(name, uuid)
-
- {$(my.uuid:upper)}
-
-.endmacro emit_filter_declaration
-.
-.macro emit_item_filter(name)
- $(my.name)
-.endmacro
-.
-.macro emit_item_compile_filtered(include, filter_path)
-. emit_item_filtered("ClCompile", my.include, my.filter_path)
-.endmacro emit_item_compile_filtered
-.
-.macro emit_item_include_filtered(include, filter_path)
-. emit_item_filtered("ClInclude", my.include, my.filter_path)
-.endmacro emit_item_include_filtered
-.
-.macro emit_item_none_filtered(include, filter_path)
-. emit_item_filtered("None", my.include, my.filter_path)
-.endmacro emit_item_none_filtered
-.
-.macro emit_item_resource_filtered(include, filter_path)
-. emit_item_filtered("ResourceCompile", my.include, my.filter_path)
-.endmacro emit_item_resource_filtered
-.
-.macro emit_item_filtered(type, include, filter_path)
- <$(my.type) Include="$(make_windows_path(my.include))">
-. emit_item_filter(make_windows_path(my.filter_path))
- $(my.type)>
-.endmacro emit_item_filtered
-.
-.macro emit_item_compile(include)
-. emit_item("ClCompile", my.include)
-.endmacro emit_item_compile
-.
-.macro emit_item_include(include)
-. emit_item("ClInclude", my.include)
-.endmacro emit_item_include
-.
-.macro emit_item_none(include)
-. emit_item("None", my.include)
-.endmacro emit_item_none
-.
-.macro emit_item_resource(include)
-. emit_item("ResourceCompile", my.include)
-.endmacro emit_item_resource
-.
-.macro emit_item(type, include)
- <$(my.type) Include="$(my.include)" />
-.endmacro emit_item
-.
-.macro emit_item_group_natvis()
-. emit_item_group_open()
-. emit_item("Natvis", "..\\..\\debug.natvis")
-. emit_item_group_close()
-.endmacro emit_item_group_natvis
-.
-.macro emit_item_compile_threadsafe_statistics(repository, product, vs_version)
-. define my.repository = emit_item_compile_threadsafe_statistics.repository
-. define my.product = emit_item_compile_threadsafe_statistics.product
-. define my.item = "\$(VC_CTP_Nov2013_InstallDir)/crt/src/threadsafestatics.cpp"
-. define my.filter = "src/external"
-. if (requires_threadsafe_statistics(my.repository, my.product, my.vs_version))
-. emit_item_compile_filtered(my.item, my.filter)
-. endif
-.endmacro emit_item_compile_threadsafe_statistics
-.
-.endtemplate
-.template 0
-###############################################################################
-# Generation
-###############################################################################
-function generate_filter(path_prefix, generate)
- define my.generate = generate_filter.generate
-
- for my.generate->vs.version as _version by _version.value
- define my.toolset = my.generate->msvc->toolset(\
- _toolset.name = _version.value, _toolset)
-
- for my.generate.repository as _repository by _repository.name
- require(_repository, "repsoitory", "name")
-
- define my.absolute_path = append_path(global.root,\
- canonical_path_name(_repository))
-
- for _repository->make.product as _product where \
- has_uuid(_product) & defined(_product.path)
-
- define my.dirname = project_build_relative_path(\
- _repository, _product, my.path_prefix, _version.value)
-
- define my.filename = project_file(_repository, \
- _product, my.path_prefix, _version.value)
-
- create_directory(my.dirname)
- notify(my.filename)
- output(my.filename)
-
- emit_filter(my.toolset, _repository, _product,\
- my.absolute_path)
-
- close
- endfor _product
- endfor _repository
- endfor _version
-endfunction # generate_filter
-
-###############################################################################
-# Execution
-###############################################################################
-[global].root = ".."
-[global].trace = 0
-[gsl].ignorecase = 0
-
-# Note: expected context root libbitcoin-build directory
-gsl from "library/math.gsl"
-gsl from "library/string.gsl"
-gsl from "library/collections.gsl"
-gsl from "utilities.gsl"
-gsl from "templates/shared/common_msvc_artifacts.gsl"
-
-generate_filter("output", generate)
-
-.endtemplate
diff --git a/templates/msbuild/debug.natvis.gsl b/templates/msbuild/debug.natvis.gsl
new file mode 100644
index 00000000..30fe6d98
--- /dev/null
+++ b/templates/msbuild/debug.natvis.gsl
@@ -0,0 +1,122 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL generate libbitcoin debug.ntvis
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+# Note: expected context root libbitcoin-build/process directory
+[gsl].ignorecase = 0
+[gsl].shuffle = 0
+
+gsl from "../library/math.gsl"
+gsl from "../library/string.gsl"
+gsl from "../lib/xml.gsl"
+gsl from "../lib/debug.gsl"
+gsl from "../lib/filesystem.gsl"
+gsl from "../lib/output.gsl"
+gsl from "../lib/xml-output.gsl"
+gsl from "../lib/msbuild.gsl"
+
+###############################################################################
+# Generation
+###############################################################################
+function generate_debug_natvis(configuration)
+ define my.configuration = generate_debug_natvis.configuration
+ require(my.configuration->templates, "templates", "resultpath")
+
+ define my.template = my.configuration->templates->template(.name = "$(script)")
+
+ if !defined(my.template)
+ abort "Generator configuration missing."
+ endif
+
+ require(my.template, "template", "outpath")
+
+ for my.configuration.repository as _repository
+ for _repository. as _target where is_target_element(_target)
+ generate_target_debug_natvis(_target, _repository, \
+ my.configuration, my.template)
+ endfor
+ endfor
+endfunction
+
+function generate_target_debug_natvis(target, repository, configuration, meta)
+ define my.target = generate_target_debug_natvis.target
+ define my.repository = generate_target_debug_natvis.repository
+ define my.configuration = generate_target_debug_natvis.configuration
+ define my.meta = generate_target_debug_natvis.meta
+
+ define my.filename = "debug.natvis"
+
+ define my.output_path = path_append(my.configuration->templates.resultpath, \
+ path_append(my.repository.name, my.meta.outpath))
+
+ create_directory(my.output_path)
+
+ define my.out_file = path_append(my.output_path, my.filename)
+
+ notify(my.out_file)
+ output(my.out_file)
+
+ emit_debug_natvis(my.target, my.repository, my.configuration, my.meta)
+
+ close
+endfunction
+
+###############################################################################
+# Functions
+###############################################################################
+function xml_text(text)
+ define my.text = xml_text.text
+ return string.replace(my.text, "<|<,>|>")
+endfunction
+
+###############################################################################
+# Generation
+###############################################################################
+.endtemplate
+.template 1
+.
+.macro emit_debug_natvis(target, repository, configuration, meta)
+. define my.target = emit_debug_natvis.target
+. define my.repository = emit_debug_natvis.repository
+. define my.configuration = emit_debug_natvis.configuration
+. define my.meta = emit_debug_natvis.meta
+.
+
+.
+. copyleft(my.repository.name)
+.
+
+.
+. for my.meta.substitution as _substitution
+
+ { $(_substitution.display) }
+
+. endfor
+.
+. for my.repository. as _target where is_target_element(_target)
+. for _target.substitution as _substitution
+
+ { $(_substitution.display) }
+
+. endfor
+. endfor
+.
+
+.
+.endmacro # emit_debug_natvis
+.
+.endtemplate
+.template 0
+###############################################################################
+# Execution
+###############################################################################
+
+generate_debug_natvis(configuration)
+
+.endtemplate
diff --git a/templates/msbuild/packages.config.gsl b/templates/msbuild/packages.config.gsl
index 0f211996..e573b852 100644
--- a/templates/msbuild/packages.config.gsl
+++ b/templates/msbuild/packages.config.gsl
@@ -93,7 +93,7 @@ function compute_packages(result, target, repository, configuration, tooling, me
this.name = my.tooling.set, this)
new dependencies as _dependencies
- target_dependency_list(_dependencies, my.target, my.repository, my.configuration)
+ target_dependency_list(_dependencies, my.target, my.repository, my.configuration, 1)
for _dependencies.dependency as _depend where defined(_depend->nuget)
# address non-component resources
for _depend->nuget.resource as _resource where \
diff --git a/templates/msbuild/vcxproj.gsl b/templates/msbuild/vcxproj.gsl
index b9623ea9..99861d12 100644
--- a/templates/msbuild/vcxproj.gsl
+++ b/templates/msbuild/vcxproj.gsl
@@ -77,17 +77,6 @@ endfunction
###############################################################################
# Functions
###############################################################################
-function matches_substitution(substitutions, path)
- define my.substitutions = matches_substitution.substitutions
- define my.path = matches_substitution.path
-
- for my.substitutions.substitution as _sub
- if starts_with(my.path, _sub.absolute_path)
- return _sub
- endif
- endfor
-endfunction
-
function nuget_target(package)
define my.package = nuget_target.package
define my.prefix = "\$(NuGetPackageRoot)$(my.package.name).$(my.package.version)"
@@ -173,7 +162,7 @@ function linearize_nuget_packages(packages, toolset, target, repository, configu
define my.configuration = linearize_nuget_packages.configuration
new dependencies as _dependencies
- target_dependency_list(_dependencies, my.target, my.repository, my.configuration)
+ target_dependency_list(_dependencies, my.target, my.repository, my.configuration, 1)
for _dependencies.dependency as _depend where defined(_depend->nuget)
define my.found = 0
@@ -394,7 +383,7 @@ $(my.indent)
$(my.indent)
.
. new dependencies as _dependencies
-. target_dependency_list(_dependencies, my.target, my.repository, my.configuration)
+. target_dependency_list(_dependencies, my.target, my.repository, my.configuration, 1)
. for _dependencies.dependency as _depend by _depend.name \
where defined(_depend->nuget)
.
diff --git a/templates/shared/common_msvc_artifacts.gsl b/templates/shared/common_msvc_artifacts.gsl
deleted file mode 100644
index 225f222a..00000000
--- a/templates/shared/common_msvc_artifacts.gsl
+++ /dev/null
@@ -1,177 +0,0 @@
-.template 0
-###############################################################################
-# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
-#
-# GSL libbitcoin msvc artifact utilities in the 'global' scope.
-#
-# This is a code generator built using the iMatix GSL code generation
-# language. See https://github.com/imatix/gsl for details.
-###############################################################################
-# Functions
-###############################################################################
-
-function global.is_compiler_msvc(dependency)
- define my.dependency = is_compiler_msvc.dependency
- return !defined(my.dependency.compiler) |\
- (defined(my.dependency.compiler) & (my.dependency.compiler = "msvc"))
-endfunction
-
-function global.has_function(dependency)
- define my.dependency = has_function.dependency
- return defined(my.dependency) & defined(my.dependency.function)
-endfunction
-
-function global.has_optionXXX(dependency)
- define my.dependency = has_optionXXX.dependency
- return defined(my.dependency) & defined(my.dependency.optionXXX)
-endfunction
-
-function global.is_dependency_pthread(dependency)
- define my.dependency = is_dependency_pthread.dependency
- return defined(my.dependency) & (my.dependency.name = "pthread")
-endfunction
-
-function global.matches_option(dependency, option)
- define my.dependency = matches_option.dependency
- return defined(my.dependency) &\
- ((!defined(my.option) & !defined(my.dependency.option)) |\
- (defined(my.option) & defined(my.dependency.option) &\
- (my.option = my.dependency.option)))
-endfunction
-
-function global.has_canonical_resource(resources, dependency)
- define my.resources = has_canonical_resource.resources
- define my.dependency = has_canonical_resource.dependency
-
- return defined(my.resources->resource(\
- _resource.canonical = my.dependency.name, _resource))
-endfunction
-
-function global.is_dependency_nuget(resources, dependency, compiler)
- define my.resources = is_dependency_nuget.resources
- define my.dependency = is_dependency_nuget.dependency
-
- return defined(my.dependency) &\
- is_compiler_msvc(my.dependency) &\
- has_canonical_resource(my.resources, my.dependency) &\
- (count(my.resources->resource(\
- _resource.canonical = my.dependency.name, _resource).package,\
- count.compiler = my.compiler) > 0)
-endfunction
-
-function global.get_dependency_nuget_package(resources, dependency, compiler)
- define my.resources = get_dependency_nuget_package.resources
- define my.dependency = get_dependency_nuget_package.dependency
-
- return my.resources->resource(\
- _resource.canonical = my.dependency.name, _resource)->package(\
- _package.compiler = my.compiler, _package)
-endfunction
-
-function global.is_dependency_repository(resources, dependency, compiler)
- define my.resources = is_dependency_repository.resources
- define my.dependency = is_dependency_repository.dependency
-
- return defined(my.dependency) &\
- is_compiler_msvc(my.dependency) &\
- !is_dependency_nuget(my.resources, my.dependency, my.compiler) &\
- !has_optionXXX(my.dependency) &\
- !has_function(my.dependency) &\
- !is_dependency_pthread(my.dependency)
-endfunction
-
-function global.match_element_by_name(element, name)
- define my.element = match_element_by_name.element
- return defined(my.element) & (my.element.name = my.name)
-endfunction
-
-function global.detect_collision_by_name(collection, name)
- define my.collection = detect_collision_by_name.collection
- return count(my.collection.element, match_element_by_name(count, my.name)) > 0
-endfunction
-
-function global.get_dependencies_nuget(result, resources, repositories, \
- configure, compiler, option)
- define my.result = get_dependencies_nuget.result
- define my.resources = get_dependencies_nuget.resources
- define my.repositories = get_dependencies_nuget.repositories
- define my.configure = get_dependencies_nuget.configure
-
- for my.configure.dependency as _dependency where is_dependency_nuget(\
- my.resources, _dependency, my.compiler) &\
- matches_option(_dependency, my.option)
-
- define my.entry = get_dependency_nuget_package(my.resources,\
- _dependency, my.compiler)
-
- # could replace with computation of name, would require more
- # context embedding
- if (defined(my.result) & defined(my.entry.name) &\
- !detect_collision_by_name(my.result, my.entry.name))
-
- new my.result.element as _element
- _element.name = my.entry.name
- _element.version = my.entry.version
- endnew
- endif
- endfor
-
- for my.configure.dependency as _dependency where is_dependency_repository(\
- my.resources, _dependency, my.compiler) &\
- matches_option(_dependency, my.option)
-
- # embedded prefix
- define my.name = "lib$(_dependency.name)"
-
- define my.repository = my.repositories->repository(\
- _repository.name = my.name, _repository)
-
- if (defined(my.repository))
- get_dependencies_nuget(my.result, my.resources, my.repositories,\
- my.repository->configure, my.compiler, my.option)
- endif
- endfor
-endfunction
-
-function msbuild_version(toolset, product)
- define my.toolset = msbuild_version.toolset
- define my.product = msbuild_version.product
-
- if (is_library(my.product))
- return my.toolset->msbuild->version.lib
- endif
- return my.toolset->msbuild->version.bin
-endfunction
-
-function platform_toolset(toolset, product, repository)
- define my.toolset = platform_toolset.toolset
- define my.product = platform_toolset.product
- define my.repository = platform_toolset.repository
-
- if (defined(my.toolset->msbuild.ctp) &\
- is_compiler_ctp(my.product, my.repository))
- return my.toolset->msbuild.ctp
- else
- return my.toolset->msbuild.toolset
- endif
-endfunction
-
-function is_compiler_ctp(product, repository)
- define my.product = is_compiler_ctp.product
- define my.repository = is_compiler_ctp.repository
- require(my.repository, "repository", "name")
-
- return is_library(my.product) |\
- (is_program(my.product) & !is_option_tests(my.product)) |\
- (is_program(my.product) & is_option_tests(my.product) &\
- (my.repository.name = "libbitcoin-consensus"))
-endfunction
-
-function requires_threadsafe_statistics(repository, product, vs_version)
- define my.repository = requires_threadsafe_statistics.repository
- define my.product = requires_threadsafe_statistics.product
- return (my.vs_version = "vs2013") & is_library(my.product) &\
- (target_name(my.product, my.repository) = "libbitcoin-system")
-endfunction
-
-.endtemplate
diff --git a/templates/shell/install-bash.gsl b/templates/shell/install-bash.gsl
index 758a8933..38ca845f 100644
--- a/templates/shell/install-bash.gsl
+++ b/templates/shell/install-bash.gsl
@@ -735,7 +735,7 @@ display_configure_options()
# directory rationalization
push_directory "${BUILD_SRC_DIR}/${PROJECT}"
- push_directory "${RELATIVE_PATH}"
+ push_directory "${RELATIVE_SRC_PATH}"
local BUILD_PATH="\$(pwd)"
pop_directory
@@ -748,6 +748,11 @@ display_configure_options()
pop_directory
push_directory "${BUILD_OBJ_DIR}/${PROJECT}"
fi
+
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ create_directory_force "${RELATIVE_OBJ_PATH}"
+ push_directory "${RELATIVE_OBJ_PATH}"
+ fi
.endmacro # define_build_initialize_path
.
.macro define_clean_action(meta, configuration, repository, name, command)
@@ -760,7 +765,8 @@ display_configure_options()
clean_$(my.name)()
{
local PROJECT="$1"
- shift 1
+ local RELATIVE_OBJ_PATH="$2"
+ shift 2
msg "Preparing to clean ${PROJECT}"
@@ -772,6 +778,10 @@ clean_$(my.name)()
push_directory "${BUILD_OBJ_DIR}/${PROJECT}"
fi
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ push_directory "${RELATIVE_OBJ_PATH}"
+ fi
+
disable_exit_on_error
$(my.command)
@@ -785,6 +795,9 @@ clean_$(my.name)()
pop_directory # BUILD_OBJ_DIR
pop_directory # BUILD_SRC_DIR/PROJECT
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ pop_directory
+ fi
msg_success "'${PROJECT}' clean complete."
}
@@ -818,8 +831,9 @@ clean_$(my.name)()
test_cmake()
{
local PROJECT="$1"
- local JOBS="$2"
- shift 2
+ local RELATIVE_OBJ_PATH="$2"
+ local JOBS="$3"
+ shift 3
msg "Preparing to test ${PROJECT}"
@@ -831,6 +845,10 @@ test_cmake()
push_directory "${BUILD_OBJ_DIR}/${PROJECT}"
fi
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ push_directory "${RELATIVE_OBJ_PATH}"
+ fi
+
disable_exit_on_error
ctest --test-dir .
@@ -855,6 +873,9 @@ test_cmake()
pop_directory # BUILD_OBJ_DIR
pop_directory # BUILD_SRC_DIR/PROJECT
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ pop_directory
+ fi
msg_success "'${PROJECT}' test complete."
}
@@ -868,8 +889,9 @@ test_cmake()
test_gnu()
{
local PROJECT="$1"
- local JOBS="$2"
- shift 2
+ local RELATIVE_OBJ_PATH="$2"
+ local JOBS="$3"
+ shift 3
msg "Preparing to test ${PROJECT}"
@@ -881,6 +903,10 @@ test_gnu()
push_directory "${BUILD_OBJ_DIR}/${PROJECT}"
fi
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ push_directory "${RELATIVE_OBJ_PATH}"
+ fi
+
disable_exit_on_error
if [[ ${JOBS} -gt ${SEQUENTIAL} ]]; then
@@ -909,6 +935,9 @@ test_gnu()
pop_directory # BUILD_OBJ_DIR
pop_directory # BUILD_SRC_DIR/PROJECT
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ pop_directory
+ fi
msg_success "'${PROJECT}' test complete."
}
@@ -924,7 +953,8 @@ test_gnu()
install_$(my.name)()
{
local PROJECT="$1"
- shift
+ local RELATIVE_OBJ_PATH="$2"
+ shift 2
msg "Preparing to install ${PROJECT}"
@@ -936,6 +966,10 @@ install_$(my.name)()
push_directory "${BUILD_OBJ_DIR}/${PROJECT}"
fi
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ push_directory "${RELATIVE_OBJ_PATH}"
+ fi
+
$(my.command)
if [[ ${OS} == Linux ]] && [[ "${PREFIX}" == "/usr/local" ]]; then
@@ -944,6 +978,9 @@ install_$(my.name)()
pop_directory # BUILD_OBJ_DIR
pop_directory # BUILD_SRC_DIR/PROJECT
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ pop_directory
+ fi
msg_success "'${PROJECT}' installation complete."
}
@@ -974,9 +1011,10 @@ install_$(my.name)()
build_cmake()
{
local PROJECT="$1"
- local RELATIVE_PATH="$2"
- local JOBS="$3"
- shift 3
+ local RELATIVE_SRC_PATH="$2"
+ local RELATIVE_OBJ_PATH="$3"
+ local JOBS="$4"
+ shift 4
local VERBOSITY_CMAKE=""
local VERBOSITY_MAKE=""
@@ -992,7 +1030,7 @@ build_cmake()
display_configure_options "$@"
- cmake ${VERBOSITY_CMAKE} -LA "$@" "${BUILD_SRC_DIR}/${PROJECT}/${RELATIVE_PATH}"
+ cmake ${VERBOSITY_CMAKE} -LA "$@" "${BUILD_SRC_DIR}/${PROJECT}/${RELATIVE_SRC_PATH}"
# make
if [[ ${JOBS} -gt ${SEQUENTIAL} ]]; then
@@ -1003,6 +1041,10 @@ build_cmake()
pop_directory # BUILD_OBJ_DIR
pop_directory # BUILD_SRC_DIR/PROJECT
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ pop_directory
+ fi
+
msg_success "'${PROJECT}' built successfully."
}
@@ -1013,9 +1055,10 @@ build_cmake()
build_preset()
{
local PROJECT="$1"
- local RELATIVE_PATH="$2"
- local JOBS="$3"
- shift 3
+ local RELATIVE_SRC_PATH="$2"
+ local RELATIVE_OBJ_PATH="$3"
+ local JOBS="$4"
+ shift 4
local VERBOSITY_CMAKE=""
local VERBOSITY_MAKE=""
@@ -1031,7 +1074,7 @@ build_preset()
display_configure_options "$@"
- cmake ${VERBOSITY_CMAKE} -LA --preset="${BUILD_PRESET}" "$@" "${BUILD_SRC_DIR}/${PROJECT}/${RELATIVE_PATH}"
+ cmake ${VERBOSITY_CMAKE} -LA --preset="${BUILD_PRESET}" "$@" "${BUILD_SRC_DIR}/${PROJECT}/${RELATIVE_SRC_PATH}"
# make
if [[ ${JOBS} -gt ${SEQUENTIAL} ]]; then
@@ -1042,6 +1085,10 @@ build_preset()
pop_directory # BUILD_OBJ_DIR
pop_directory # BUILD_SRC_DIR/PROJECT
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ pop_directory
+ fi
+
msg_success "'${PROJECT}' built successfully."
}
@@ -1052,9 +1099,10 @@ build_preset()
build_gnu()
{
local PROJECT="$1"
- local RELATIVE_PATH="$2"
- local JOBS="$3"
- shift 3
+ local RELATIVE_SRC_PATH="$2"
+ local RELATIVE_OBJ_PATH="$3"
+ local JOBS="$4"
+ shift 4
local VERBOSITY_GNU=""
local VERBOSITY_MAKE=""
@@ -1086,6 +1134,10 @@ build_gnu()
pop_directory # BUILD_OBJ_DIR
pop_directory # BUILD_SRC_DIR/PROJECT
+ if [[ "${RELATIVE_OBJ_PATH}" != "." ]]; then
+ pop_directory
+ fi
+
msg_success "'${PROJECT}' built successfully."
}
@@ -1752,41 +1804,44 @@ $(my.indent)export CPPFLAGS="${CPPFLAGS} ${$(my.vname)_FLAGS[@]}"
.
. if (my.active_build.method = "gnu")
. require(my.active_build, "build", "filepath")
-$(my.indent)build_gnu "$(_depend.name)" "$(my.active_build.filepath)" "${PARALLEL}" "${$(my.vname)_OPTIONS[@]}" "${CONFIGURE_OPTIONS_GNU[@]}"
+. require(my.active_build, "build", "objpath")
+$(my.indent)build_gnu "$(_depend.name)" "$(my.active_build.filepath)" "$(my.active_build.objpath)" "${PARALLEL}" "${$(my.vname)_OPTIONS[@]}" "${CONFIGURE_OPTIONS_GNU[@]}"
. if last()
$(my.indent)if ! [[ "${BUILD_SKIP_TESTS}" == "yes" ]]; then
- $(my.indent)test_gnu "$(_depend.name)" "${PARALLEL}"
+ $(my.indent)test_gnu "$(_depend.name)" "$(my.active_build.objpath)" "${PARALLEL}"
$(my.indent)fi
. endif
-$(my.indent)install_gnu "$(_depend.name)"
+$(my.indent)install_gnu "$(_depend.name)" "$(my.active_build.objpath)"
$(my.indent)if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then
- $(my.indent)clean_gnu "$(_depend.name)"
+ $(my.indent)clean_gnu "$(_depend.name)" "$(my.active_build.objpath)"
$(my.indent)fi
.
. elsif (my.active_build.method = "cmake")
. require(my.active_build, "build", "filepath")
-$(my.indent)build_cmake "$(_depend.name)" "$(my.active_build.filepath)" "${PARALLEL}" "${$(my.vname)_OPTIONS[@]}" "${CONFIGURE_OPTIONS_CMAKE[@]}"
+. require(my.active_build, "build", "objpath")
+$(my.indent)build_cmake "$(_depend.name)" "$(my.active_build.filepath)" "$(my.active_build.objpath)" "${PARALLEL}" "${$(my.vname)_OPTIONS[@]}" "${CONFIGURE_OPTIONS_CMAKE[@]}"
. if last()
$(my.indent)if ! [[ "${BUILD_SKIP_TESTS}" == "yes" ]]; then
- $(my.indent)test_cmake "$(_depend.name)" "${PARALLEL}"
+ $(my.indent)test_cmake "$(_depend.name)" "$(my.active_build.objpath)" "${PARALLEL}"
$(my.indent)fi
. endif
-$(my.indent)install_cmake "$(_depend.name)"
+$(my.indent)install_cmake "$(_depend.name)" "$(my.active_build.objpath)"
$(my.indent)if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then
- $(my.indent)clean_cmake "$(_depend.name)"
+ $(my.indent)clean_cmake "$(_depend.name)" "$(my.active_build.objpath)"
$(my.indent)fi
.
. elsif (my.active_build.method = "preset")
. require(my.active_build, "build", "filepath")
-$(my.indent)build_preset "$(_depend.name)" "$(my.active_build.filepath)" "${PARALLEL}" "${$(my.vname)_OPTIONS[@]}" "${CONFIGURE_OPTIONS_CMAKE[@]}"
+. require(my.active_build, "build", "objpath")
+$(my.indent)build_preset "$(_depend.name)" "$(my.active_build.filepath)" "$(my.active_build.objpath)" "${PARALLEL}" "${$(my.vname)_OPTIONS[@]}" "${CONFIGURE_OPTIONS_CMAKE[@]}"
. if last()
$(my.indent)if ! [[ "${BUILD_SKIP_TESTS}" == "yes" ]]; then
- $(my.indent)test_cmake "$(_depend.name)" "test" "${PARALLEL}"
+ $(my.indent)test_cmake "$(_depend.name)" "$(my.active_build.objpath)" "${PARALLEL}"
$(my.indent)fi
. endif
-$(my.indent)install_cmake "$(_depend.name)"
+$(my.indent)install_cmake "$(_depend.name)" "$(my.active_build.objpath)"
$(my.indent)if [[ "${BUILD_POST_INSTALL_CLEAN}" == "yes" ]]; then
- $(my.indent)clean_cmake "$(_depend.name)"
+ $(my.indent)clean_cmake "$(_depend.name)" "$(my.active_build.objpath)"
$(my.indent)fi
.
. elsif (my.active_build.method = "boost_build")
diff --git a/templates/shell/runner.sh.gsl b/templates/shell/runner.sh.gsl
new file mode 100644
index 00000000..7b7eef31
--- /dev/null
+++ b/templates/shell/runner.sh.gsl
@@ -0,0 +1,104 @@
+.template 0
+###############################################################################
+# Copyright (c) 2014-2026 libbitcoin developers (see COPYING).
+#
+# GSL generate libbitcoin _runner.sh
+#
+# This is a code generator built using the iMatix GSL code generation
+# language. See https://github.com/imatix/gsl for details.
+###############################################################################
+
+# Note: expected context root libbitcoin-build/process directory
+[gsl].ignorecase = 0
+[gsl].shuffle = 0
+
+gsl from "../library/math.gsl"
+gsl from "../library/string.gsl"
+gsl from "../lib/xml.gsl"
+gsl from "../lib/debug.gsl"
+gsl from "../lib/filesystem.gsl"
+gsl from "../lib/output.gsl"
+gsl from "../lib/sh-output.gsl"
+
+###############################################################################
+# Generation
+###############################################################################
+function generate_runner(configuration)
+ define my.configuration = generate_runner.configuration
+ require(my.configuration->templates, "templates", "resultpath")
+
+ define my.template = my.configuration->templates->template(.name = "$(script)")
+
+ if !defined(my.template)
+ abort "Generator configuration missing."
+ endif
+
+ require(my.template, "template", "outpath")
+
+ for my.configuration.repository as _repository
+ define my.output_path = path_append(my.configuration->templates.resultpath, \
+ path_append(_repository.name, my.template.outpath))
+
+ create_directory(my.output_path)
+
+ for _repository.test as _target where defined(_target.runner)
+ define my.filename = _target.runner
+ define my.out_file = path_append(my.output_path, my.filename)
+
+ notify(my.out_file)
+ output(my.out_file)
+
+ emit_runner(_target, _repository, my.configuration, my.template)
+
+ close
+ endfor
+ endfor
+endfunction
+
+###############################################################################
+# Functions
+###############################################################################
+
+###############################################################################
+# Generation
+###############################################################################
+.endtemplate
+.template 1
+.
+.macro emit_runner(target, repository, configuration, meta)
+. define my.library= emit_runner.target
+. define my.repository = emit_runner.repository
+. define my.configuration = emit_runner.configuration
+. define my.meta = emit_runner.meta
+.
+. shebang("sh")
+.
+. copyleft(my.library.name)
+.
+. heading1("Define tests and options.")
+BOOST_UNIT_TEST_OPTIONS=\\
+ "--log_level=warning "\\
+ "--show_progress=no "\\
+ "--detect_memory_leak=0 "\\
+ "--report_level=no "\\
+ "--build-info=yes "\\
+ "--run_tests=*"
+.
+. heading1("Run tests.")
+if [[ ${CI} == true ]]; then
+ \./test/$(my.target.name) ${BOOST_UNIT_TEST_OPTIONS}
+else
+ \./test/$(my.target.name) ${BOOST_UNIT_TEST_OPTIONS} > test.log
+fi
+.
+.endmacro # emit_runner
+.
+.endtemplate
+.template 0
+###############################################################################
+# Execution
+###############################################################################
+
+generate_runner(configuration)
+
+.endtemplate
diff --git a/version4.xml b/version4.xml
index eb19586a..5ff19dbc 100644
--- a/version4.xml
+++ b/version4.xml
@@ -10,7 +10,8 @@
-
+
-
-
-
-
-
+ comment="Use shrec/UltrafastSecp256k1 library." />
-
+ comment="Use bitcoin-core/secp256k1 library." />
@@ -73,7 +68,8 @@
+ type="public"
+ substitute="avx2">
@@ -88,7 +84,8 @@
+ type="public"
+ substitute="avx512">
@@ -103,7 +100,8 @@
+ type="public"
+ substitute="shani">
@@ -120,7 +118,8 @@
+ type="public"
+ substitute="sse41">
@@ -153,11 +152,14 @@
+ option="tests" type="with" default="yes"
+ comment="Compile with unit tests."
+ runner="test_runner.sh">
-
+
+
-
+
-
+
@@ -438,7 +443,8 @@
-
+
-
+
@@ -466,8 +475,12 @@
-
-
+
+
+
+
+
+
@@ -487,13 +500,16 @@
+ option="tests" type="with" default="yes"
+ comment="Compile with unit tests."
+ runner="test_runner.sh">
+
@@ -1785,17 +1824,17 @@
-
+
-
+
-
+
@@ -1803,20 +1842,21 @@
+
-
+
-
+
-
+
@@ -1824,20 +1864,21 @@
+
-
+
-
+
-
+
@@ -1845,38 +1886,40 @@
+
-
+
-
+
-
+
+
-
+
-
+
-
+
@@ -1884,6 +1927,7 @@
+
-
+
@@ -1986,6 +2030,7 @@
+
-
+
-
+
@@ -2017,6 +2062,7 @@
+
@@ -2614,17 +2660,17 @@ g and optimizations for size." hidden="false" display="*nix/GNU/Release/Static/S
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -2665,6 +2711,21 @@ g and optimizations for size." hidden="false" display="*nix/GNU/Release/Static/S
+
+
+
+
+
+
+
+
+
+
+
@@ -2757,6 +2818,81 @@ g and optimizations for size." hidden="false" display="*nix/GNU/Release/Static/S
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+