ENDIF(BUILD_JPIP)
OPTION(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
OPTION(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
+OPTION(USE_SYSTEM_GETOPT "Prefer system installed getopt()" OFF)
+MARK_AS_ADVANCED(USE_SYSTEM_GETOPT)
MARK_AS_ADVANCED(BUILD_VIEWER)
MARK_AS_ADVANCED(BUILD_JAVA)
convert.c
index.c
${OPENJPEG_SOURCE_DIR}/applications/common/color.c
- ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
)
+if(NOT USE_SYSTEM_GETOPT)
+ list(APPEND common_SRCS
+ ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
+ )
+endif()
# Headers file are located here:
INCLUDE_DIRECTORIES(
#include <string.h>
#include "opj_getopt.h"
+#ifdef USE_SYSTEM_GETOPT
+#error
+#endif
+
int opj_opterr = 1, /* if error message should be printed */
opj_optind = 1, /* index into parent argv vector */
opj_optopt, /* character checked for validity */
/* last review : october 29th, 2002 */
+#include "opj_config.h"
+
#ifndef _GETOPT_H_
#define _GETOPT_H_
int has_arg;
int *flag;
int val;
-}opj_option_t;
+} opj_option_t;
#define NO_ARG 0
#define REQ_ARG 1
#define OPT_ARG 2
+#ifdef USE_SYSTEM_GETOPT
+#include <getopt.h>
+
+#define opj_opterr opterr
+#define opj_optind optind
+#define opj_optopt optopt
+#define opj_optreset optreset
+#define opj_optarg optarg
+
+#define opj_getopt getopt
+#define opj_getopt_long getopt_long
+
+#else
extern int opj_opterr;
extern int opj_optind;
extern int opj_optopt;
const opj_option_t *longopts, int totlen);
extern void reset_options_reading(void);
+#endif /* USE_SYSTEM_GETOPT */
#endif /* _GETOPT_H_ */
#cmakedefine HAVE_LIBLCMS2
#cmakedefine HAVE_LCMS1_H
#cmakedefine HAVE_LCMS2_H
+#cmakedefine USE_SYSTEM_GETOPT
/* Byte order. */
/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or
# First thing define the common source:
SET(comparePGXimages_SRCS comparePGXimages.c
${OPENJPEG_SOURCE_DIR}/applications/codec/convert.c
- ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
)
-
-SET(compare_dump_files_SRCS compare_dump_files.c
- ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
-
-SET(compareRAWimages_SRCS compareRAWimages.c
- ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
+SET(compare_dump_files_SRCS compare_dump_files.c)
+SET(compareRAWimages_SRCS compareRAWimages.c)
+
+if(NOT USE_SYSTEM_GETOPT)
+ list(APPEND comparePGXimages_SRCS ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
+ list(APPEND compare_dump_files_SRCS ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
+ list(APPEND compareRAWimages_SRCS ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c)
+endif()
ADD_EXECUTABLE(comparePGXimages ${comparePGXimages_SRCS})
TARGET_LINK_LIBRARIES(comparePGXimages