OSDN Git Service

Fix in getopt_long
authorShohei Urabe <root@mput.dip.jp>
Thu, 31 Jul 2003 05:46:57 +0000 (05:46 +0000)
committerShohei Urabe <root@mput.dip.jp>
Thu, 31 Jul 2003 05:46:57 +0000 (05:46 +0000)
ChangeLog
config.h.in
configure
configure.in
timidity/timidity.c
utils/getopt.h

index 5afc959..63d1274 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-07-31  mput <root@mput.dip.jp>
+
+       * utils/getopt.h: Fix including headers
+       * timidity/timidity.c: Fix doubled header include
+
 2003-07-29  mput <root@mput.dip.jp>
 
        * timidity/timidity.c (help): rewrite to fit with long optoins.
index 0aa2bb8..eca3de2 100644 (file)
@@ -67,6 +67,9 @@
 /* Define to 1 if you have the <getopt.h> header file. */
 #undef HAVE_GETOPT_H
 
+/* Define to 1 if you have `getopt_long function' */
+#undef HAVE_GETOPT_LONG
+
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
 
index ae79614..5510354 100755 (executable)
--- a/configure
+++ b/configure
@@ -9957,7 +9957,12 @@ fi
 echo "$as_me:$LINENO: result: $ac_cv_func_getopt_long" >&5
 echo "${ECHO_T}$ac_cv_func_getopt_long" >&6
 if test $ac_cv_func_getopt_long = yes; then
-  tm_cv_needgetopt="no"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETOPT_LONG 1
+_ACEOF
+
+        tm_cv_needgetopt="no"
 else
   tm_cv_needgetopt="yes"
 fi
index 6fac870..e70fc60 100644 (file)
@@ -491,6 +491,7 @@ AC_CHECK_FUNCS( \
   strtol \
   usleep])
 AC_CHECK_FUNC(getopt_long,
+        AC_DEFINE([HAVE_GETOPT_LONG],1,[Define to 1 if you have `getopt_long function'])
         tm_cv_needgetopt="no",
         tm_cv_needgetopt="yes")
 AM_CONDITIONAL([NEEDGETOPT], test "x$tm_cv_needgetopt" = "xyes")
index 6791700..abccadf 100644 (file)
 #include "mix.h"
 #include "unimod.h"
 #include "quantity.h"
-#include "utils/getopt.h"
 
 #ifdef IA_W32GUI
 #include "w32g.h"
index f8cd037..1567fe5 100644 (file)
 #ifndef __TMDY_GETOPT_H__
 #define __TMDY_GETOPT_H__
 
-#ifndef HAVE_GETOPT_H
+#ifdef HAVE_UNISTD_H
+/* getopt() declaration here */
+#include <unistd.h>
+#else
 
 /* For communication from `getopt' to the caller.
    When `getopt' finds an option that takes an argument,
@@ -60,12 +63,13 @@ extern int optopt;
 
 extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
 
-#else
-#include <getopt.h>
-#endif
+#endif /* <unistd.h> */
 
+#ifdef HAVE_GETOPT_H
+/* gtopt_long() declared here */
+#include <getopt.h>
+#else
 
-#ifndef HAVE_GETOPT_LONG
 /* Describe the long-named options requested by the application.
    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
    of `struct option' terminated by an element containing a name which is
@@ -137,6 +141,6 @@ extern int getopt_long_only (int __argc, char *const *__argv,
                             const char *__shortopts,
                             const struct option *__longopts, int *__longind);
 
-#endif
+#endif /* <getopt.h> */
 
 #endif