1 dnl @synopsis adl_FUNC_GETOPT_LONG
3 dnl Check for getopt_long support.
5 dnl This assume that the standard getopt.h file (from GNU libc) is
6 dnl available as lib/gnugetopt.h. If needed, this file will be linked
7 dnl as getopt.h, but we want to default to the system's getopt.h file.
8 dnl (See http://sources.redhat.com/ml/automake/2000-09/msg00041.html
9 dnl for an explanation about why using the system's getopt.h file is
12 dnl @category InstalledPackages
13 dnl @author Alexandre Duret-Lutz <adl@gnu.org>
14 dnl @version 2003-10-29
15 dnl @license GPLWithACException
17 AC_DEFUN([adl_FUNC_GETOPT_LONG],
19 # clean out junk possibly left behind by a previous configuration
21 # Check for getopt_long support
22 AC_CHECK_HEADERS([getopt.h])
23 AC_CHECK_FUNCS([getopt_long],,
24 [# FreeBSD has a gnugetopt library for this
25 AC_CHECK_LIB([gnugetopt],[getopt_long],[AC_DEFINE([HAVE_GETOPT_LONG])],
26 [# use the GNU replacement
29 AC_CONFIG_LINKS([lib/getopt.h:lib/gnugetopt.h])])])])