getopt_long not found, even though it is present

Gerald Pfeifer pfeifer at dbai.tuwien.ac.at
Thu Apr 17 05:20:56 CDT 2003


Assume we are on a system which does have /usr/local/include/getopt.h,
and support for getopt_long, but where getopt_long is _not_ in libc.

Our configure then diagnoses

  #define HAVE_GETOPT_H 1
  /* #undef HAVE_GETOPT_LONG */

which leads a compilation error for tools/wrc/wrc.c which includes
"wine/port.h" and <getopt.h>, for _both_ define struct option.


As far as I can see, the problem here is that in tools/wrc/wrc.c we
check for the presence of HAVE_GETOPT_H, while in wine/port.h we check
for HAVE_GETOPT_LONG.

The patch below is one way to fix this problem, another way would be to
move the #inclusion of <getopt.h> from individual files to wine/port.h.

Yet another option would be the hack autoconf to try linking libgnugetopt
when looking for getopt_long, but I don't know how to hack this into
configure.

How should we resolve this?

Gerald

Index: wrc.c
===================================================================
RCS file: /home/wine/wine/tools/wrc/wrc.c,v
retrieving revision 1.33
diff -u -3 -p -r1.33 wrc.c
--- wrc.c	28 Mar 2003 19:31:49 -0000	1.33
+++ wrc.c	17 Apr 2003 10:18:18 -0000
@@ -32,7 +32,9 @@
 #include <ctype.h>
 #include <signal.h>
 #ifdef HAVE_GETOPT_H
-# include <getopt.h>
+# ifdef HAVE_GETOPT_LONG
+#  include <getopt.h>
+# endif
 #endif

 #include "wrc.h"



More information about the wine-devel mailing list