blob: b3ebb84af0c0e84d1f02e5c2cb72fa09212386bd [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001dnl Copyright (C) 1999-2005 Open Source Telecom Corporation.
2dnl Copyright (C) 2006-2010 David Sugar, Tycho Softworks.
3dnl
4dnl This program is free software; you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation; either version 2 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program; if not, write to the Free Software
16dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17dnl
18dnl As a special exception to the GNU General Public License, if you
19dnl distribute this file as part of a program that contains a configuration
20dnl script generated by Autoconf, you may include it under the same
21dnl distribution terms that you use for the rest of that program.
22
23AC_DEFUN([OST_CC_GETOPT],[
24 ost_cv_libgetopt_long=false
25 GETOPT_LIBS=""
26 LIBGETOPTOBJS=""
27 AC_REQUIRE([OST_SYS_POSIX])
28 AC_CHECK_FUNCS(getopt,[
29 AC_DEFINE(HAVE_GETOPT, [1], [have getopt header])
30 ],[
31 AC_CHECK_LIB(m, getopt,[
32 AC_DEFINE(HAVE_GETOPT, [1])
33 GETOPT_LIBS="-lm"
34 ])
35 ])
36 AC_CHECK_HEADERS(getopt.h)
37 AC_CHECK_LIB(gnugetopt, getopt_long,[
38 AC_DEFINE(HAVE_GETOPT_LONG, [1], [have gnugetopt lib])
39 GETOPT_LIBS="-lgnugetopt $GETOPT_LIBS"
40 LIBS="$LIBS -lgnugetopt"],[
41 AC_CHECK_FUNCS(getopt_long,[
42 AC_DEFINE(HAVE_GETOPT_LONG, [1])
43 ],[
44 LIBGETOPTOBJS="getopt.c getopt1.c"
45 ])
46 ])
47 AC_SUBST(GETOPT_LIBS)
48 AC_SUBST(LIBGETOPTOBJS)
49])
50