Check for getopt in the configure script, as we do for other routines
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 15 Feb 2006 19:20:36 +0000 (19:20 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 15 Feb 2006 19:20:36 +0000 (19:20 +0000)
not available on all platforms.  Include getopt.c in
EXTRA_ethereal_SOURCES and include getopt.h in EXTRA_ethereal_INCLUDES,
as we do with the other files that supply routines not available on all
platforms, rather than always including them in the source for dumpcap.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17311 f5534014-38df-0310-8fa8-9805f1628bb7

Makefile.am
Makefile.common
configure.in

index d984a1058de8ccb84102e3327256d9922c7b3dce..47030c2751f63c4644ae3742c67e3ac2bd05af8d 100644 (file)
@@ -268,7 +268,7 @@ endif               # HAVE_PLUGINS
 # we should probably split this into stuff needed both
 # by ethereal and tethereal and stuff needed only by one or the
 # other.
-ethereal_optional_objects = @SNPRINTF_O@ @STRERROR_O@ \
+ethereal_optional_objects = @GETOPT_O@ @SNPRINTF_O@ @STRERROR_O@ \
        @STRCASECMP_O@ @STRNCASECMP_O@ @MKSTEMP_O@ @STRPTIME_O@
 
 # Additional libs that I know how to build. These will be
@@ -565,8 +565,6 @@ EXTRA_DIST = \
        ethereal_be.py          \
        ethereal_gen.py         \
        ethereal.desktop        \
-       getopt.c                \
-       getopt.h                \
        idl2eth.sh              \
        image/Ethereal.icns     \
        image/Makefile.nmake    \
index de033c0bd56709edd64bb4aca745515eb7cbc7a1..1af16d74131558576fb2c715bb3a3c237cbbc2b6 100644 (file)
@@ -116,19 +116,21 @@ TETHEREAL_TAP_SRC =       \
 
 # helpers already available on some platforms (and on others not)
 EXTRA_ethereal_SOURCES =       \
+       getopt.c        \
+       mkstemp.c       \
        snprintf.c      \
        strerror.c      \
        strcasecmp.c    \
        strncasecmp.c   \
-       mkstemp.c       \
        strptime.c
 
 # corresponding headers
 EXTRA_ethereal_INCLUDES =      \
+       getopt.h        \
+       mkstemp.h       \
        snprintf.h      \
        snprintf-imp.h  \
        strerror.h      \
-       mkstemp.h       \
        strptime.h
 
 # ethereal specifics
@@ -218,7 +220,6 @@ dumpcap_SOURCES =   \
        clopts_common.c \
        conditions.c    \
        dumpcap.c       \
-       getopt.c        \
        ringbuffer.c    \
        tempfile.c      \
        version_info.c
@@ -229,4 +230,3 @@ noinst_HEADERS =    \
        $(ETHEREAL_COMMON_INCLUDES) \
        $(ethereal_INCLUDES) \
        $(EXTRA_ethereal_INCLUDES)
-
index 4ad5e2ad8c1f04864bc8bc0160ec0896ad0bb2fe..b435430ae5b3e5a8f2df4ab63acf95fe2c846b88 100644 (file)
@@ -1033,6 +1033,19 @@ AC_C_BIGENDIAN
 # XXX - do we need this?
 AC_PROG_GCC_TRADITIONAL
 
+GETOPT_C=""
+GETOPT_O=""
+AC_CHECK_FUNC(getopt, GETOPT_O="",
+  [GETOPT_O="getopt.o"
+   AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h needs to be included])
+])
+if test "$ac_cv_func_getopt" = no ; then
+  GETOPT_C="getopt.c"
+  GETOPT_O="getopt.o"
+fi
+AC_SUBST(GETOPT_C)
+AC_SUBST(GETOPT_O)
+
 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
 # then this won't work.
 SNPRINTF_C=""