I have some C code originally developed on linux, which makes use of gengetopts to parse the command line. I also want to build that code on cygwin.

(On linux I simply did "apt-get install gengetopt" and everything was fine.

I don't find any package that looks like gengetopt on cygwin, so I try to build from source as per the instructions.

But when I try:

sh ./configure.ac

I first get an error that I have to fix with dos2unix, and then this:

$ sh ./configure.ac
./configure.ac: line 18: dnl: command not found
./configure.ac: line 19: syntax error near unexpected token `GNU'
./configure.ac: line 19: `AC_INIT(GNU gengetopt,2.23)'

The relevant lines in the config file are:

dnl Process this file with autoconf to produce a configure script.
AC_INIT(GNU gengetopt,2.23)

I did make sure that autoconf, bison, flex and m4 are installed. The default shell in cygwin seems to be bash. What is the problem? what is "dnl" - seems to be a linux built in. If so why is it not part of cygwin?

Is there an easier way to do this? it all looks like a bit of a compatibility mess. Is it generally this hard to install packages on cygwin?

1 Answer 1


After some trial and error, I did manage this. Here is what was needed:

  1. Use the cygwin installer to install autoconf, automake, libtool, bison, flex
  2. Download the tar.gz (instead of using git clone) from here
  3. ./configure
  4. make failed with a compilation issue (this was getopt 2.22). I had to add:

    #include "string.h"

into src/fileutils.cpp - after this make succeeded.

  1. Note that on cugwin it seems you don't need to be root to install manually. Simple "make install" worked fine.

I now seem to have a working gengetopt on cygwin.

EDIT : in fact 2.23 is the latest version, and in this version there is no compilation problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .