Skip to content

Conversation

@mywave82
Copy link
Contributor

@mywave82 mywave82 commented Apr 2, 2023

TODO list:

@mywave82 mywave82 force-pushed the gnulib branch 2 times, most recently from fb5f1bc to 1e2b5fd Compare April 2, 2023 08:43
@mywave82 mywave82 mentioned this pull request Apr 2, 2023
mywave82 added 2 commits April 3, 2023 20:26
…cc files on not .h files, since it by default does not contain any guards.
@mywave82
Copy link
Contributor Author

mywave82 commented Apr 3, 2023

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.

@dynamite1981
Copy link
Contributor

This appears to be a quite involved change (include a whole new library) to support getopt_long() on Windows?

@mywave82
Copy link
Contributor Author

(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:

  • Split out the first commit that fixes minor issue about config.h
  • Manually update getopt() and getopt_long() with fixes and maintain that (big task)
  • Remote old getopt() and getopt_long() and let configure fail if not provided by the system
  • Move gnulib stuff to its own branch, not poluting the main-branch (and mention it if configure fails)

@dynamite1981
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants