From b9f052893cadaa7a3e7c922dc94af09fbb89f588 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Tue, 4 Jul 2006 16:29:34 +0000 Subject: [PATCH] * ltdl/m4/m4-getopt.m4 (M4_GETOPT): Update to take into account changes to gnulib getopt.m4 since last build. * Makefile.am (src_m4_SOURCES): Only compile shipped getopt module if the system getopt fails M4_GETOPT tests. --- ChangeLog | 7 +++++++ Makefile.am | 9 ++++++--- ltdl/m4/m4-getopt.m4 | 24 +++++++++++++++++++++--- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21e43f2a..3e64c119 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-07-04 Gary V. Vaughan + + * ltdl/m4/m4-getopt.m4 (M4_GETOPT): Update to take into account + changes to gnulib getopt.m4 since last build. + * Makefile.am (src_m4_SOURCES): Only compile shipped getopt module + if the system getopt fails M4_GETOPT tests. + 2006-06-22 Eric Blake * Makefile.am (EXTRA_DIST): Distribute gnulib-cache.m4. diff --git a/Makefile.am b/Makefile.am index 40f1e38e..15ed9a3e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -70,15 +70,18 @@ EXTRA_DIST += stamp-vcl bin_PROGRAMS = src/m4 src_m4_SOURCES = \ - src/getopt.c \ - src/getopt1.c \ - src/getopt.h \ src/version-etc-fsf.c \ src/version-etc.c \ src/version-etc.h \ src/main.c \ src/m4.h \ src/freeze.c +if GETOPT +src_m4_SOURCES += \ + src/getopt.c \ + src/getopt1.c \ + src/getopt.h +endif if STACKOVF src_m4_SOURCES += src/stackovf.c endif diff --git a/ltdl/m4/m4-getopt.m4 b/ltdl/m4/m4-getopt.m4 index 4eea7c12..fc75473a 100644 --- a/ltdl/m4/m4-getopt.m4 +++ b/ltdl/m4/m4-getopt.m4 @@ -40,14 +40,32 @@ if test -z "$GETOPT_H"; then AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include ]) fi -dnl Solaris 10 getopt doesn't handle `+' as a leading character in an -dnl option string (as of 2005-05-05). if test -z "$GETOPT_H"; then - AC_CHECK_DECL([getopt_clip], [GETOPT_H=getopt.h], [], [#include ]) + AC_CACHE_CHECK([for working gnu getopt function], [gl_cv_func_gnu_getopt], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([#include ], + [[ + 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 ])])]) + 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_GETOPT -- 2.11.4.GIT