changeset 5478:fca5a7f08a72

(gl_GETOPT): Check if GETOPT_H is already set, in order not to spoil the result of an eventual previous invocation of gl_GETOPT_SUBSTITUTE.
author Sergey Poznyakoff <gray@gnu.org.ua>
date Tue, 23 Nov 2004 02:52:44 +0000
parents 65231c66005d
children e82f409b1d52
files m4/getopt.m4
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -25,16 +25,18 @@
 [
   gl_PREREQ_GETOPT
 
-  GETOPT_H=
-  AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
-  AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
+  if test -z "$GETOPT_H"; then
+    GETOPT_H=
+    AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
+    AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
 
-  dnl BSD getopt_long uses an incompatible method to reset option processing,
-  dnl and (as of 2004-10-15) mishandles optional option-arguments.
-  AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
+    dnl BSD getopt_long uses an incompatible method to reset option processing,
+    dnl and (as of 2004-10-15) mishandles optional option-arguments.
+    AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
 
-  if test -n "$GETOPT_H"; then
-     gl_GETOPT_SUBSTITUTE
+    if test -n "$GETOPT_H"; then
+      gl_GETOPT_SUBSTITUTE
+    fi
   fi
 ])