Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-bugs: [Wireshark-bugs] [Bug 5608] New: build fails when it tries to #include <getopt.h

Date: Sun, 23 Jan 2011 10:48:14 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5608

           Summary: build fails when it tries to #include <getopt.h>, not
                    present in Solaris 9
           Product: Wireshark
           Version: 1.4.3
          Platform: SPARC
        OS/Version: Solaris
            Status: NEW
          Severity: Normal
          Priority: Low
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: irwin@xxxxxxxxxxxxx


Build Information:
Paste the COMPLETE build information from "Help->About Wireshark", "wireshark
-v", or "tshark -v".
--
Platform: Solaris 9 on SPARC, gcc 4.1.2

Solaris 9 SPARC: build fails  when it tries to #include <getopt.h>.
Solaris 9 doesn't have <getopt.h>.

...
if gcc -DHAVE_CONFIG_H -I. -I. -I..  -I.. -I../wiretap    -I/usr/local/include
-I/usr/local/include '-DPLUGIN_DIR="/usr/local/lib/wireshark/plugins/1.4.3"' 
-D_U_="__attribute__((unused))" -g -O3 -Wall -W -Wextra
-Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wno-pointer-sign
-Wcast-align -Wformat-security -Wno-return-type -DFUNCPROTO=15
-I/usr/local/include -D_REENTRANT -D_PTHREADS -I/usr/local/include/gtk-2.0
-I/usr/local/lib/gtk-2.0/include -I/usr/local/include/atk-1.0
-I/usr/local/include/cairo -I/usr/local/include/pango-1.0
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
-I/usr/local/include/freetype2 -I/usr/local/include
-I/usr/local/include/libpng12   -I/usr/local/include -MT macros_dlg.o -MD -MP
-MF ".deps/macros_dlg.Tpo" -c -o macros_dlg.o macros_dlg.c; \
then mv -f ".deps/macros_dlg.Tpo" ".deps/macros_dlg.Po"; else rm -f
".deps/macros_dlg.Tpo"; exit 1; fi
if gcc -DHAVE_CONFIG_H -I. -I. -I..  -I.. -I../wiretap    -I/usr/local/include
-I/usr/local/include '-DPLUGIN_DIR="/usr/local/lib/wireshark/plugins/1.4.3"' 
-D_U_="__attribute__((unused))" -g -O3 -Wall -W -Wextra
-Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wno-pointer-sign
-Wcast-align -Wformat-security -Wno-return-type -DFUNCPROTO=15
-I/usr/local/include -D_REENTRANT -D_PTHREADS -I/usr/local/include/gtk-2.0
-I/usr/local/lib/gtk-2.0/include -I/usr/local/include/atk-1.0
-I/usr/local/include/cairo -I/usr/local/include/pango-1.0
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
-I/usr/local/include/freetype2 -I/usr/local/include
-I/usr/local/include/libpng12   -I/usr/local/include -MT main.o -MD -MP -MF
".deps/main.Tpo" -c -o main.o main.c; \
then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo"; exit
1; fi
main.c:49:20: error: getopt.h: No such file or directory
gmake[2]: *** [main.o] Error 1
gmake[2]: Leaving directory `/var/local/src/wireshark-1.4.3+PU-1/gtk'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/var/local/src/wireshark-1.4.3+PU-1'
gmake: *** [all] Error 2


./gtk/main.c:49 is:

#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsutil/wsgetopt.h"
#endif

Solaris 9 has getopt(), but doesn't have /usr/include/getopt.h.

It appears that configure defines HAVE_GETOPT_H based on the existance of
getopt(), 
not on the existance of getopt.h.

The distinction doesn't cause a problem on Solaris 10, where
/usr/include/getopt.h
is present, so when configure #defines HAVE_GETOPT_H based on it finding
getopt(), the #include <getopt.h> works anyway.

(I notice that in version 1.2.9, configure also tested for getopt(),
but instead defined or didn't define NEED_GETOPT_H.  That seemed
to work; on Solaris 9 it found getopt() and didn't define NEED_GETOPT_H,
while on Solaris 10 it found getopt(). )

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.