M4 1.4 doesn't build on mingw

Patrick Farry <[email protected]>
Newsgroups gmane.comp.gnu.m4.bugs
Message-ID <[email protected]>
On mingw signal.h is in include directory. Build looks for it in sys/signal.h

Version of mingw - mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0
Windows 10 version 1803

Stack overflow link to issue https://stackoverflow.com/questions/22601045/make-cant-find-sys-signal-h

I copied signal.h into sys and the build ran and m4 seems to run fine.

To reproduce with mingw installed:


  1.  Download M4 source
  2.  ./configure
  3.  make

$ make
for subdir in doc lib src checks examples; do \
  echo making all in $subdir; \
  (cd $subdir && make CC='gcc' CFLAGS='-g -O' LDFLAGS='' LIBS='' prefix='/usr/local' exec_prefix='/usr/local' bindir='/usr/local/bin' infodir='/usr/local/info' all) || exit 1; \
done
making all in doc
make[1]: Entering directory 'C:/Program Files/Git/usr/local/m4-1.4/doc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory 'C:/Program Files/Git/usr/local/m4-1.4/doc'
making all in lib
make[1]: Entering directory 'C:/Program Files/Git/usr/local/m4-1.4/lib'
gcc -c -DHAVE_CONFIG_H -I.. -I.  -g -O regex.c
gcc -c -DHAVE_CONFIG_H -I.. -I.  -g -O getopt.c
getopt.c: In function '_getopt_internal':
getopt.c:408:30: warning: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
      if (optind != argc && !strcmp (argv[optind], "--"))
                              ^~~~~~
getopt.c:484:7: warning: implicit declaration of function 'strncmp' [-Wimplicit-function-declaration]
  if (!strncmp (p->name, nextchar, nameend - nextchar))
       ^~~~~~~
getopt.c:486:32: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
      if (nameend - nextchar == strlen (p->name))
                                ^~~~~~
getopt.c:486:32: warning: incompatible implicit declaration of built-in function 'strlen'
getopt.c:486:32: note: include '<string.h>' or provide a declaration of 'strlen'
getopt.c:77:1:
+#include <string.h>

getopt.c:486:32:
      if (nameend - nextchar == strlen (p->name))
                                ^~~~~~
getopt.c:510:16: warning: incompatible implicit declaration of built-in function 'strlen'
    nextchar += strlen (nextchar);
                ^~~~~~
getopt.c:510:16: note: include '<string.h>' or provide a declaration of 'strlen'
getopt.c:540:17: warning: incompatible implicit declaration of built-in function 'strlen'
     nextchar += strlen (nextchar);
                 ^~~~~~
getopt.c:540:17: note: include '<string.h>' or provide a declaration of 'strlen'
getopt.c:553:17: warning: incompatible implicit declaration of built-in function 'strlen'
     nextchar += strlen (nextchar);
                 ^~~~~~
getopt.c:553:17: note: include '<string.h>' or provide a declaration of 'strlen'
getopt.c:557:16: warning: incompatible implicit declaration of built-in function 'strlen'
    nextchar += strlen (nextchar);
                ^~~~~~
getopt.c:557:16: note: include '<string.h>' or provide a declaration of 'strlen'
gcc -c -DHAVE_CONFIG_H -I.. -I.  -g -O getopt1.c
gcc -c -DHAVE_CONFIG_H -I.. -I.  -g -O error.c
gcc -c -DHAVE_CONFIG_H -I.. -I.  -g -O obstack.c
obstack.c: In function '_obstack_free':
obstack.c:333:5: warning: implicit declaration of function 'abort' [-Wimplicit-function-declaration]
     abort ();
     ^~~~~
obstack.c:333:5: warning: incompatible implicit declaration of built-in function 'abort'
obstack.c:333:5: note: include '<stdlib.h>' or provide a declaration of 'abort'
obstack.c:22:1:
+#include <stdlib.h>

obstack.c:333:5:
     abort ();
     ^~~~~
obstack.c: In function 'obstack_free':
obstack.c:367:5: warning: incompatible implicit declaration of built-in function 'abort'
     abort ();
     ^~~~~
obstack.c:367:5: note: include '<stdlib.h>' or provide a declaration of 'abort'
gcc -c -DHAVE_CONFIG_H -I.. -I.  -g -O xmalloc.c
gcc -c -DHAVE_CONFIG_H -I.. -I.  -g -O xstrdup.c
rm -f libm4.a
ar cru libm4.a regex.o getopt.o getopt1.o error.o obstack.o xmalloc.o xstrdup.o
: libm4.a
make[1]: Leaving directory 'C:/Program Files/Git/usr/local/m4-1.4/lib'
making all in src
make[1]: Entering directory 'C:/Program Files/Git/usr/local/m4-1.4/src'
gcc -c -DHAVE_CONFIG_H -I.. -I. -I./../lib  -g -O m4.c
m4.c:22:10: fatal error: sys/signal.h: No such file or directory
#include <sys/signal.h>
          ^~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:46: m4.o] Error 1
make[1]: Leaving directory 'C:/Program Files/Git/usr/local/m4-1.4/src'
make: *** [Makefile:59: all] Error 1

Patrick Farry
Director of Architecture, Unified Commerce, Global Ecommerce

T  +1 408 510 1424
M +1 408 510 1424

[email protected]<mailto:[email protected]>
pitneybowes.com<http://www.pitneybowes.com/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.