BSDBuild Logo

BSDBuild Manual

(Printable Version)




The mkconfigure program reads a BSDBuild source from the standard input and produces a portable Bourne configure script.

The source may include valid Bourne shell script, along with special directives interpreted by mkconfigure. Directives are case-insensitive. Long lines can be wrapped with a terminating \ character.


The following directives provide information about the package:
package (name)
Short name for the package. Included in generated messages and comments.
version (string)
Specify current package version.
release (string)
Specify a release codename.
register (name, desc)
Describe a configure script argument to show in ./configure --help. name is the name of the getopt_long(3) style argument (e.g., --with-foo,--enable-foo)and desc is a one-line description.
register_env_var (name, desc)
Describe an influential environment variable to show in ./configure --help. name is the name of the environment variable and desc is a one-line description.
register_section (text)
Provide a title for a section of arguments in ./configure --help.


The following directives alter the operation of the configure script.
config_cache (bool)
Enable support for caching of test results (./configure --cache option). Set to "yes" (enable caching) or "no" (the default).
config_guess (path)
Specify an alternate path to config.guess (default is mk/config.guess).
default_dir (dirname, path)
Override one of the standard installation path defaults. dirname may be one of: PREFIX, BINDIR, LIBDIR, LIBEXECDIR, DATADIR, STATEDIR, SYSCONFDIR, LOCALEDIR or MANDIR. The path argument may include variable references such as "${PREFIX}".
success_fn (fname)
Instead of printing the default "Configuration successful" message at the end of the script, run the indicated Bourne shell function fname instead.


The following directives invoke installed BSDBuild test modules. Modules generate Bourne script for performing tests and returning results as variables. For instance, a test for a package "foo" would set variable HAVE_FOO to "yes" or "no" and return detected compilation flags under FOO_CFLAGS and FOO_LIBS.
check (pkg[,ver[,pfx]])
Invoke the BSDBuild module called pkg. A <pkg>.pm module file should exist under ${PREFIX}/share/bsdbuild/BSDBuild/.

If ver is given and non-zero, check the version and set MK_VERSION_OK to "yes" if the installed version is compatible with ver.

If pfx is given, look under that installation prefix (and fail if it is not installed there). Typically, the value "${prefix_foo}" (from user-given --enable-foo=VALUE or --with-foo=VALUE) is used here.
require (pkg[,ver[,pfx]])
Variant of check() which implicitely terminates the script with an error message if pkg is not found or the ver is incompatible.
disable (pkg)
Short-circuit a test module. Emit the defines that would have resulted from a failed test, without actually running any tests.
test_dir (path)
Specify an extra directory in which to search for BSDBuild test modules (.pm files). The default module path is ${PREFIX}/share/bsdbuild/BSDBuild/.


The following directives deal with Ada code compilation.
ada_option (option)
Append an option to the ADAFLAGS which will be passed to the Ada compiler.
ada_bflag (option)
Append an option to the ADABFLAGS which will be passed to the Ada binder.


The following directives apply to C, C++ and other C-like languages.
c_define (optname)
Specify a global define that will be passed to the compiler. An optname of "FOO" would result in the -DFOO flag being passed to the compiler. This value is also used by
c_incdir (dir)
Specify a directory for include files. This results in the -Idir flag being added to the compiler command line. This value is also used by
c_incdir_config (dir)
Specify a target directory for individual include files with configure-script generated statements (i.e., HAVE_FOO is written to have_foo.h in the specified directory). Pass an empty argument to disable. By default, config/ is used.
c_include_config (file)
Specify a monolithic C include file which will contain configure-script generated statements (i.e., HAVE_FOO defines). Pass an empty argument to disable (default).
c_incprep (dir)
Specify a target directory for preprocessed C header files. The ./configure option --includes is a BSDBuild extension which gives the user the option of either generating preprocessed headers in the working directory ("--includes=yes", the default) or alternatively, to create a set of symbolic links to the original headers in the source directory ("--includes=link").
c_option (option)
Provide a gcc-style compiler option, such as -Wall,-Werror or -Wmissing-prototypes.For environments using other compilers, BSDBuild will attempt to set equivalent options.
check_func (fn[, ...])
Check for the existence of one or more C functions. If a function fn called foo() exists, then HAVE_FUNCTION_FOO is set.
check_func_opts (cflags, libs, fn[, ...])
Variant of check_function() with additional CFLAGS and LIBS.
check_header (name[, ...])
Check whether one or more header files are available (with the current CFLAGS). If a header such as sys/foo.h is found, then HAVE_SYS_FOO_H is set.
check_header_opts (cflags, libs, header[, ...])
Variant of check_header() with additional CFLAGS and LIBS.
c_extra_warnings() Request extra compiler warnings. Exact interpretation is compiler specific.
c_fatal_warnings() Fail compilation if warnings are encountered.
hdefine (opt, val)
Define a C preprocessor style header option. opt is an unquoted string (uppercase by convention), and the value val is a string enclosed in double quotes. For example, if opt is ENABLE_FOO, a file config/enable_foo.h will be generated by configure.
hdefine_unquoted (opt, val)
Variant of hdefine() which keeps val unquoted instead of interpreting it as a string.
hdefine_if (condition, opt)
If condition evaluates true, then generate a define with hdefine (opt)
otherwise call hundef (opt) .
to generate an #undef.
hundef (opt)
Write an #undef directive to which writes an #undef directive to config/<option>.h (the opposite of hdefine()).
hundef_if (condition, opt)
If condition evaluates true, then call hundef (opt) .
ld_option (option)
Provide a ld-style linker option, such as -g or -nostdlib.
mappend (opt, val)
Append a space and val to the exported make(1) variable opt.
mdefine (opt, val)
Define an exported make(1) variable opt with value val.


The following directives deal with the installation of Perl modules.
check_perl_module (mod)
Check that the specified Perl module is installed and functioning. For example, if mod is "Time::Zone", the macro will set the variable "HAVE_TIME_ZONE" accordingly.
require_perl_module (mod)
Variant of check_perl_module() which aborts the configure script if the module is not found.


The following directives produce output scripts and modules for integration by external packages.
config_script (name[,args])
Generate a standard "foo-config" script. name specifies the name of the script. For C/C++ style packages, the arguments are usually the --cflags output, followed by the --libs output.
pkgconfig_module (name, desc, req, confl, cflags, libs, pvtLibs)
Output a pkgconf(1) compatible pc(5) file to "name.pc" (which may be then installed into PKGCONFIG_LIBDIR). desc is the "Description" string, req is the "Required" modules list (space-separated), confl is the "Conflicts" list, cflags is the "Cflags" field, libs is Libs (for --libs) and pvtLibs is Libs.private (for --static --libs).

SEE ALSO,, ElectronTubeStore