OSDN Git Service

writeup
[applied-gslp/test1.git] / acinclude.m4
1 dnl @synopsis adl_FUNC_GETOPT_LONG
2 dnl
3 dnl Check for getopt_long support.
4 dnl
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
10 dnl important.)
11 dnl
12 dnl @category InstalledPackages
13 dnl @author Alexandre Duret-Lutz <adl@gnu.org>
14 dnl @version 2003-10-29
15 dnl @license GPLWithACException
16
17 AC_DEFUN([adl_FUNC_GETOPT_LONG],
18  [AC_PREREQ(2.49)dnl
19   # clean out junk possibly left behind by a previous configuration
20   rm -f lib/getopt.h
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
27       AC_LIBOBJ(getopt)
28       AC_LIBOBJ(getopt1)
29       AC_CONFIG_LINKS([lib/getopt.h:lib/gnugetopt.h])])])])