Fix issue 11764
Merge pull request #1783 from andralex/getopt

Fix issue 11764