[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.15.2 getopt build requirements

You must supply some compile and link options via environment variables.


In case the option definition file lives in a different directory.


Any special flags required to compile. The flags from autoopts-config cflags will be included automatically. Since the creation of the option parsing code includes creating a program that prints out help text, if it is necessary to include files from various directories to compile that program, you will need to specify those directories with ‘-Idirpath’ text in the CFLAGS. Some experimentation may be necessary in that case.

NOTE: the ‘-Idirpath’ text is only needed if your option callback functions include code that require additional #include directives.


Any special flags required to link. The flags from autoopts-config ldflags will be included automatically. This is required only if additional link flags for the help text emission program might be needed.


This is needed only if cc cannot be found in $PATH (or it is not the one you want).

To use this, set the exported environment variables and specify getopt as the default template in your option definitions file (see section The Identification Definition). You will have four new files. Assuming your definitions were in a file named ‘myprog-opts.def’ and your program name was specified as ‘progname’, the resulting files would be created: ‘myprog-opts.h’, ‘myprog-opts.c’, ‘getopt-progname.h’ and ‘getopt-progname.c’. You must compile and link both ‘.c’ files into your program. If there are link failures, then you are using AutoOpts features that require the ‘libopts’ library. You must remove these features, See section getopt feature limitations.

These generated files depend upon configure defines to work correctly. Therefore, you must specify a config-header attribute (see section Programming Details) and ensure it has #defines for either HAVE_STDINT_H or HAVE_INTTYPES_H; either HAVE_SYS_LIMITS_H or HAVE_LIMITS_H; and HAVE_SYSEXITS_H, if the ‘sysexits.h’ header is available. The required header files for these defines are, respectively, the ‘/usr/include’ files named:

The following header files must also exist on the build platform:

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Bruce Korb on August 21, 2015 using texi2html 1.82.