[an error occurred while processing this directive]

Standalone GNU getopt package

Original version: Sat Oct 14 07:55:15 2006                Valid HTML 4.0!

An increasing number of GNU, and other, software packages assume that the extended GNU getopt() implementation is available. While getopt() is standardized by POSIX, and thus should be available on most current Unix systems, the GNU version offers extended features, and additional functions, that are not part of POSIX, and generally unavailable outside of GNU/Linux operating systems.

While GNU getopt() has a relatively small code base (about 2K lines), the GNU Project at the Free Software Foundation have never packaged it for independent standalone distribution. Instead, it is distributed only as part of glibc, the GNU/Linux C run-time library. That package is not easy to build on other platforms, and generally cannot be installed on GNU/Linux systems except when a complete new O/S distribution is prepared, for fear of breaking every installed program written in C, C++, Fortran, and many other languages, since those programs have been linked against an earlier version of the C library that may no longer exist.

This directory offers a package to remedy this situation. It uses untouched getopt() code from the latest-available glibc release, augmented with additional source files from BSD Unix, and a simple, but not localizable, version of gettext(), along with GNU-standard autoconfiguration files that allow the package to be built with the usual recipe supported by thousands of modern GNU and Unix software packages:

    ./configure && make all check install

This package has been installed on several local systems at this site, include Compaq/DEC OSF/1 Alpha, SGI IRIX 6.5 MIPS, Sun Solaris 7, 8, 9, and 10 SPARC, and Sun Solaris 10 IA-32, and has been used to remedy failing builds of packages that require GNU getopt(). Usually all that is required is the simple addition of -lgetopt to the list of link libraries, and ensuring that the directory where getopt.h has been installed is added to the front of the include-file search path.

Downloads

The package is available here:

[an error occurred while processing this directive]