use gnulib to provide the newest implementation of getopt_long()#25
use gnulib to provide the newest implementation of getopt_long()#25mywave82 wants to merge 2 commits into
Conversation
fb5f1bc to
1e2b5fd
Compare
…cc files on not .h files, since it by default does not contain any guards.
|
I think Windows is the only modern version of the commonly used operating systems that is lacking getopt_long(). We need to jump back in time to old versions of BSD probably to find the need / proper test-system. With gnulib infrastructure in place, it is easy to add other features that might be missing in different target operating systems in the future. |
|
This appears to be a quite involved change (include a whole new library) to support getopt_long() on Windows? |
|
(This might be historically incorrect) There is currently an old copy of getopt() and getopt_long() (last one is a GNU extension), from about 1998 looking at the copyright header. I'm guessing back then, getopt() had many quirks in systems and due to the GNU extension, this was available as a standalone project. Since then the code-base has been fully merged into glibc and gnulib. It is no longer contained in a single file due to header dependencies. So if we want to get up to date with possible bugfixes, and have it working on non-gnu systems (and old systems) this can be a way to go. I can refresh the commit to more recent version of gnulib (I left description of this is in the gnulib.txt) Alternative options:
|
|
Thanks! The reason getopt is in the source tree is to support non-GNU systems, where getopt_long is not available. I agree that the included version is outdated. I'd recommend this option: We keep the old getopt implementation, but output a compiler warning that it is old and unmaintained. It is only linked whenever the system doesn't support getopt_long. We can also point to gnulib as a potential option for users that would like a newer getopt_long. I'm also happy to add POSIX getopt as a fallback with broader system support. Would this work? |
|
Alternative spotted on ncurses mailinglist |
TODO list: