diff options
Diffstat (limited to 'ltdl/m4/m4-getopt.m4')
-rw-r--r-- | ltdl/m4/m4-getopt.m4 | 53 |
1 files changed, 8 insertions, 45 deletions
diff --git a/ltdl/m4/m4-getopt.m4 b/ltdl/m4/m4-getopt.m4 index a58764ec..9c606ddc 100644 --- a/ltdl/m4/m4-getopt.m4 +++ b/ltdl/m4/m4-getopt.m4 @@ -2,7 +2,7 @@ # m4-getopt.m4 -- Use the installed version of getopt.h if available. # Written by Gary V. Vaughan <gary@gnu.org> # -# Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc +# Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc # # This file is part of GNU M4. # @@ -19,53 +19,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# serial 2 +# serial 3 # M4_GETOPT # --------- # Use the installed version of getopt.h if available. AC_DEFUN([M4_GETOPT], -[GETOPT_H= -AC_SUBST([GETOPT_H]) - -AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h], [AC_INCLUDES_DEFAULT]) - -if test -z "$GETOPT_H"; then - AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) -fi - -dnl BSD getopt_log uses an incompatible method to reset option processing, -dnl and (as of 2004-10-15) mishandles optional option-arguments. -if test -z "$GETOPT_H"; then - AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>]) -fi - -if test -z "$GETOPT_H"; then - AC_CACHE_CHECK([for working gnu getopt function], [gl_cv_func_gnu_getopt], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM([#include <getopt.h>], - [[ - char *myargv[3]; - myargv[0] = "conftest"; - myargv[1] = "-+"; - myargv[2] = 0; - return getopt (2, myargv, "+a") != '?'; - ]])], - [gl_cv_func_gnu_getopt=yes], - [gl_cv_func_gnu_getopt=no], - [dnl cross compiling - pessimistically gues based on decls - dnl Solaris 10 getopt doesn't handle `+' as a leading character in an - dnl option string (as of 2005-05-05). - AC_CHECK_DECL([getopt_clip], - [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes], - [#include <getopt.h>])])]) - test X"$gl_cv_func_gnu_getopt" = Xno && GETOPT_H=getopt.h -fi - -if test -n "$GETOPT_H"; then - AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], - [Define to rpl_ if the getopt replacement function should be used.]) -fi - -AM_CONDITIONAL([GETOPT], [test -n "$GETOPT_H"]) +[ + m4_divert_text([INIT_PREPARE], [M4_replace_getopt=]) + m4_pushdef([AC_LIBOBJ], [M4_replace_getopt=:]) + AC_REQUIRE([gl_FUNC_GETOPT_GNU]) + m4_popdef([AC_LIBOBJ]) + AM_CONDITIONAL([GETOPT], [test -n "$M4_replace_getopt"]) ])# M4_GETOPT |