From 18bc417bbd8d512f7bd6d62a933d198fb46c5aa2 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Mon, 21 Jul 2014 00:28:39 +0900 Subject: [PATCH 1/2] Fix linkage on OS/2 OS/2 kLIBC has getopt() already. ----- CCLD cd-drive.exe ld.exe: symbol `_optarg' defined more than once in F:/lang/gcc/usr/lib/libc_dll.a(IMPORT#45#426bf) ----- --- src/getopt.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/src/getopt.h b/src/getopt.h index da1a01f..b67fdd4 100644 --- a/src/getopt.h +++ b/src/getopt.h @@ -48,6 +48,20 @@ extern "C" { #endif +#ifdef __KLIBC__ +/* OS/2 kLIBC has already getopt(). So to avoid name clash, rename + them here. */ + +#define optarg libcdio_optarg +#define optind libcdio_optind +#define opterr libcdio_opterr +#define optopt libcdio_optopt + +#define getopt libcdio_getopt +#define getopt_long libcdio_getopt_long +#define getopt_long_only libcdio_getopt_long_only +#endif + /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. -- 1.7.3.2