[ di - disk information utility ]
[ mkconfig - build configuration utility ]
[ mkconfig manual ]
[ mkconfig_d manual ]
[ mkconfig_env manual ]
Name
mkconfig_c - mkconfig C language units
Description
The C language units create an include file for use by C programs.
C Language Units
c-main
The c-main unit creates an include file for C programs. The hdr
and sys directives should be listed first in the mkconfig con‐
figuration file so that the headers are available for use in the
other tests.
standard
The standard checks are: the headers stdio.h, stdlib.h,
sys/types.h and sys/param.h, the keywords void and const,
the void * type as a parameter, and C function proto‐
types.
Output:
#define _hdr_stdio 1
#define _hdr_stdlib 1
#define _sys_types 1
#define _sys_param 1
#define _key_void 1
#define _key_const 1
#define _param_void_star 1
#define _proto_stdc 1
args [noconst] name-of-function
Checks the number of arguments, the types of the argu‐
ments and the return type for a function. If 'noconst'
is specified, any data type is returned. Outputs the
following check variables: _args_function, _c_arg_N_func‐
tion, and _c_type_function. _args_function indicates the
number of arguments. _c_arg_N_function indicates the
argument data type. _c_type_function indicates the
return type of the function. The 'awk' program is a
requirement for this directive.
e.g.
args noconst setmntent
Output:
#define _c_arg_1_setmntent char *
#define _c_arg_2_setmntent char *
#define _c_type_setmntent FILE *
#define _args_setmntent 2
hdr name-of-header [required-headers]
Check for a header. The standard include path as set in
CFLAGS is used. If required-headers is specified, those
headers are included in the compilation test before
attempting the compilation test.
e.g.
hdr getopt
hdr storage/volumes.h gui/window.h
Output:
#define _hdr_getopt 1
#define _hdr_storage_volumes 0
sys name-of-sys-header [required-headers]
Like hdr, but looks in the sys/ directory.
e.g.
sys types.h
Output:
#define _sys_types 1
class class [libs, ...]
Check to see if class class exists. If the optional libs
are specified, the test will try first without the
libraries, then with the first set of libraries speci‐
fied, then the next set, etc. Sets of libraries to be
tested are separated by commas.
e.g.
class os::Volumes
Output:
#define _class_os__Volumes 0
Execute mkc.sh -reqlib after creating the output file to
output the libraries required for linking. See the usage
for mkc.sh -reqlib in the lib check below.
const constant-name [required-headers]
Check to see that a constant exists. If required-headers
is specified, those headers are included in the compila‐
tion test before attempting the compilation test.
e.g.
const O_NOCTTY
Output:
#define _const_O_NOCTTY 1
dcl {int|ptr} variable-name
Check to see if variable-name is declared. If int is
specified, the variable is a numeric type. If ptr is
specified, the variable is a pointer type.
e.g.
dcl int errno
dcl ptr optarg
Output:
#define _dcl_errno 1
#define _dcl_optarg 1
define definition-name
Check to see if definition-name is defined.
e.g.
define MCTL_QUERY
Output:
#define _define_MCTL_QUERY 0
key keyword
Check to see if a C-language keyword is reserved.
e.g.
key volatile
Output:
#define _key_volatile 1
lib function [libs, ...]
Check to see if the library function function exists. If
the optional libs are specified, the test will try first
without the libraries, then with the first set of
libraries specified linked in, then the next set, etc.
Sets of libraries to be tested are separated by commas.
If link libraries are specified, any value in the cache
is ignored, and the function is retested.
e.g.
lib gettext -lintl, -lintl -liconv
[Will first test gettext, then gettext -lintl,
then gettext -lintl -liconv]
Output:
#define _lib_gettext 1
Execute mkc.sh -reqlib after creating the output file to
output the libraries required for linking.
mkc.sh -reqlib creates the list of libraries required for
linking based on the output file. This allows the user
to modify the output file and only the necessary
libraries will be linked in.
mkc.sh -reqlib is executed with a command line argument
of the output file name created by mkconfig.sh. The out‐
put library file defaults to 'mkconfig.reqlibs', but may
be changed with the -o command line option.
The string '_dollar_', if included in the library func‐
tion name will be replaced with the '$' symbol.
member struct struct-name member
member union union-name member
member typedef-name member
Check to see if member is a member of struct struct-name
or typedef-name.
e.g.
member struct statfs f_bsize
Output:
#define _mem_struct_statfs_f_bsize 1
memberxdr struct-name member
Define the appropriate xdr function for struct-name.mem‐
ber. The 'awk' program is a requirement for this direc‐
tive.
e.g.
memberxdr getquota_args gqa_uid
Output:
#define xdr_gqa_uid xdr_int
#define _memberxdr_getquota_args_gqa_uid 1
npt function [library-requirement]
Check to see if if function needs to have a prototype
declared. The optional library-requirement should be
written as: _lib_. If library-requirement does
not exist, _npt_ will be set to false in the
output file.
e.g.
npt getopt
npt statfs _lib_statfs
Output:
#define _npt_getopt 0
#define _npt_statfs 0
siz type-name
Check the size of type-name.
e.g.
siz long long
Output:
#define _siz_long_long 8
typ type-name
Check to see if a type-name exists. type-name may be a
type or a structure.
e.g.
typ size_t
typ struct dqblk
Output:
#define _typ_size_t 1
#define _typ_struct_dqblk 1
c-include-conflict
include_conflict
Check to see if there is a compile conflict when includ‐
ing two headers. If there is a conflict, the check vari‐
able is set to 0.
e.g.
include_conflict time.h sys/time.h
Output:
#define _inc_conflict__hdr_time__sys_time 1
See Also
iffe(1) autoconf(1) dist(7) mkconfig(7) mkconfig_env(7) mkconfig_d(7)
Bugs
Send bug reports to: brad.lanam.di_at_gmail.com
Website
http://www.gentoo.com/di/mkconfig.html
Author
This program is Copyright 2011 by Brad Lanam, Walnut Creek CA
Brad Lanam, Walnut Creek, CA (brad.lanam.di_at_gmail.com)