From f18e1a2db5c2069b20a9cea71a88a22cef5fd057 Mon Sep 17 00:00:00 2001 From: Bob Friesenhahn Date: Sun, 3 Nov 2019 11:21:26 -0600 Subject: [PATCH] Fix Cmake HAVE_GETOPT for systems which declare getopt in stdio.h. Fix utility baked-in getopt prototype which appears when HAVE_GETOPT is not defined. --- CMakeLists.txt | 2 +- libtiff/mkg3states.c | 2 +- tools/ppm2tiff.c | 2 +- tools/raw2tiff.c | 2 +- tools/thumbnail.c | 2 +- tools/tiff2pdf.c | 2 +- tools/tiffcmp.c | 2 +- tools/tiffcp.c | 2 +- tools/tiffdump.c | 2 +- tools/tiffgt.c | 2 +- tools/tiffsplit.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9a43019..35b48770 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -384,7 +384,7 @@ check_symbol_exists(strtol "stdlib.h" HAVE_STRTOL) check_symbol_exists(strtoll "stdlib.h" HAVE_STRTOLL) check_symbol_exists(strtoul "stdlib.h" HAVE_STRTOUL) check_symbol_exists(strtoull "stdlib.h" HAVE_STRTOULL) -check_symbol_exists(getopt "unistd.h" HAVE_GETOPT) +check_symbol_exists(getopt "unistd.h;stdio.h" HAVE_GETOPT) check_symbol_exists(lfind "search.h" HAVE_LFIND) if(NOT HAVE_SNPRINTF) diff --git a/libtiff/mkg3states.c b/libtiff/mkg3states.c index 54fc0599..2cb9174c 100644 --- a/libtiff/mkg3states.c +++ b/libtiff/mkg3states.c @@ -40,7 +40,7 @@ #include "tif_fax3.h" #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif #define streq(a,b) (strcmp(a,b) == 0) diff --git a/tools/ppm2tiff.c b/tools/ppm2tiff.c index d3ea6493..2b275618 100644 --- a/tools/ppm2tiff.c +++ b/tools/ppm2tiff.c @@ -48,7 +48,7 @@ #include "tiffio.h" #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif #define streq(a,b) (strcmp(a,b) == 0) diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c index f502408e..ab36ff4e 100644 --- a/tools/raw2tiff.c +++ b/tools/raw2tiff.c @@ -60,7 +60,7 @@ #include "tiffio.h" #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif #ifndef O_BINARY diff --git a/tools/thumbnail.c b/tools/thumbnail.c index 3d1adc78..169a6369 100644 --- a/tools/thumbnail.c +++ b/tools/thumbnail.c @@ -40,7 +40,7 @@ #include "tiffio.h" #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif #define streq(a,b) (strcmp(a,b) == 0) diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c index 76539925..779c1662 100644 --- a/tools/tiff2pdf.c +++ b/tools/tiff2pdf.c @@ -54,7 +54,7 @@ #include "tiffio.h" #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif #ifndef EXIT_SUCCESS diff --git a/tools/tiffcmp.c b/tools/tiffcmp.c index 299847df..7b764883 100644 --- a/tools/tiffcmp.c +++ b/tools/tiffcmp.c @@ -40,7 +40,7 @@ #include "tiffio.h" #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif static int stopondiff = 1; diff --git a/tools/tiffcp.c b/tools/tiffcp.c index 8c81aa4f..84d81488 100644 --- a/tools/tiffcp.c +++ b/tools/tiffcp.c @@ -52,7 +52,7 @@ #include "tiffio.h" #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif #if defined(VMS) diff --git a/tools/tiffdump.c b/tools/tiffdump.c index ab48e52c..4cdcda0c 100644 --- a/tools/tiffdump.c +++ b/tools/tiffdump.c @@ -51,7 +51,7 @@ #endif #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif #include "tiffio.h" diff --git a/tools/tiffgt.c b/tools/tiffgt.c index 5991d309..2f11b0ca 100644 --- a/tools/tiffgt.c +++ b/tools/tiffgt.c @@ -49,7 +49,7 @@ #include "tiffiop.h" #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif static uint32 width = 0, height = 0; /* window width & height */ diff --git a/tools/tiffsplit.c b/tools/tiffsplit.c index c9e3a787..c8b7f2dd 100644 --- a/tools/tiffsplit.c +++ b/tools/tiffsplit.c @@ -31,7 +31,7 @@ #include "tiffio.h" #ifndef HAVE_GETOPT -extern int getopt(int, char**, char*); +extern int getopt(int argc, char * const argv[], const char *optstring); #endif #define CopyField(tag, v) \