From 3e6c2e5129fb95be171b3dc0a6a4e239e1b6ea13 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 20 Mar 1997 23:51:25 +0000 Subject: [PATCH] cygwin32 support --- ChangeLog | 20 ++++++++++++++++++ NEWS | 1 + TODO | 7 +++++++ aclocal.in | 5 +++-- automake.in | 52 +++++++++++++++++++++++++++++++++++++++-------- automake.texi | 14 ++++++++++++- lib/am/program.am | 1 + lib/am/progs.am | 6 ++++-- m4/Makefile.am | 3 ++- m4/Makefile.in | 3 ++- m4/cygwin.m4 | 14 +++++++++++++ program.am | 1 + progs-clean.am | 5 ++++- progs.am | 6 ++++-- stamp-vti | 2 +- version.texi | 2 +- 16 files changed, 121 insertions(+), 21 deletions(-) create mode 100644 m4/cygwin.m4 diff --git a/ChangeLog b/ChangeLog index 6777b95c..eec4c3d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,25 @@ Thu Mar 20 00:16:54 1997 Tom Tromey + * automake.in (handle_programs): Remove CYGWIN lines unless + AM_CYGWIN32 seen. + (am_install_var): Remove CYGWIN lines from -clean file as well. + + * progs.am: Put @EXEEXT@ where appropriate. + + * program.am (@PROGRAM@): If using Cygwin32, then create actual + name in addition to ".exe" name. + + * progs-clean.am (clean-@DIR@PROGRAMS): Conditionalize on CYGWIN. + + * automake.in (check_cygnus): Require AM_CYGWIN32 in --cygnus mode. + (am_install_var): If AM_CYGWIN32 not seen, then remove @EXEEXT@ + from .am files. + + * automake.in (seen_cygwin32): New global. + (scan_one_configure_file): Check for AM_CYGWIN32. + + * m4/cygwin.m4: New file. + * automake.in (scan_one_configure_file): Explicitly handle AC_CONFIG_HEADER so we can avoid spurious warnings. (obsolete_macros): Removed AC_CONFIG_HEADER. diff --git a/NEWS b/NEWS index 90de2b86..2de4a21d 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,7 @@ New in 1.1m: AM_CONFIG_HEADER handles it automatically * Texinfo output files no longer need .info extension * Added `missing' support +* Cygwin32 support New in 1.0: * Bug fixes diff --git a/TODO b/TODO index f9cdfeb8..7f87ab3f 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,13 @@ Priorities for release: * should not put texiname_TEXINFOS into distribution should rename this macro anyway, to foo_texi_DEPENDENCIES +* should be able to specify path to texinfo.tex so that 'make dvi' + will work even when it isn't in this dir. + +* *all* installed scripts should support --version, --help + +* have aclocal diagnose unrecognized AM_ macros + For now I guess I'll just have automake give an error if it encounters non-C source in a libtool library specification. diff --git a/aclocal.in b/aclocal.in index ed6b4498..3b326026 100644 --- a/aclocal.in +++ b/aclocal.in @@ -158,10 +158,11 @@ sub parse_arguments } elsif ($arglist[0] eq '--version') { - print "aclocal (GNU $PACKAGE) $VERSION\n"; + print "aclocal (GNU $PACKAGE) $VERSION\n\n"; print "Copyright (C) 1996, 1997 Free Software Foundation, Inc.\n"; print "This is free software; see the source for copying conditions. There is NO\n"; - print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; + print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"; + print "Written by Tom Tromey \n"; exit 0; } elsif ($arglist[0] eq '--help') diff --git a/automake.in b/automake.in index 7696838a..07f79493 100755 --- a/automake.in +++ b/automake.in @@ -190,6 +190,9 @@ $package_version_line = 0; # TRUE if we've seen AM_PATH_LISPDIR. $seen_lispdir = 0; +# TRUE if we've seen AM_CYGWIN32. +$seen_cygwin32 = 0; + # Hash table of discovered configure substitutions. Keys are names, # values are meaningless. %configure_vars = (); @@ -228,7 +231,7 @@ $cygnus_mode = 0; # Note that we do not handle this one, because it is still run # from AM_CONFIG_HEADER. So we deal with it specially in - # handle_configure. + # scan_configure. # 'AC_CONFIG_HEADER', "use \`AM_CONFIG_HEADER'", 'fp_C_PROTOTYPES', "use \`AM_C_PROTOTYPES'", @@ -304,10 +307,11 @@ sub parse_arguments { if ($arglist[0] eq "--version") { - print "automake (GNU $PACKAGE) $VERSION\n"; + print "automake (GNU $PACKAGE) $VERSION\n\n"; print "Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.\n"; print "This is free software; see the source for copying conditions. There is NO\n"; - print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; + print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"; + print "Written by Tom Tromey \n"; exit 0; } @@ -1409,11 +1413,18 @@ sub handle_programs $xlink = $linker ? $linker : 'LINK'; } + local ($cygxform) = ''; + if (! $seen_cygwin32) + { + $cygxform .= 's/^CYGWIN.*$//;'; + } + $output_rules .= &file_contents_with_transform ('s/\@PROGRAM\@/' . $one_file . '/go;' . 's/\@XPROGRAM\@/' . $xname . '/go;' - . 's/\@XLINK\@/' . $xlink . '/go;', + . 's/\@XLINK\@/' . $xlink . '/go;' + . $cygxform, 'program'); } @@ -3634,6 +3645,13 @@ sub scan_one_configure_file # Check for ansi2knr. $am_c_prototypes = 1 if /AM_C_PROTOTYPES/; + # Check for Cygwin32. + if (/AM_CYGWIN32/) + { + $seen_cygwin32 = 1; + $configure_vars{'EXEEXT'} = 1; + } + # Check for NLS support. if (/AM_GNU_GETTEXT/) { @@ -3821,6 +3839,11 @@ sub check_cygnus { &am_conf_error ("\`AM_MAINTAINER_MODE' required when --cygnus specified"); } + + if (! $seen_cygwin32) + { + &am_conf_error ("\`AM_CYGWIN32' required when --cygnus specified"); + } } # Do any extra checking for GNU standards. @@ -4691,6 +4714,16 @@ sub am_install_var $ltxform = 's/\@LIBTOOL([^\@]*)\@//;'; } + local ($cygxform); + if (! $seen_cygwin32) + { + $cygxform = 's/\@EXEEXT\@//g; s/^NOTCYGWIN.*$//;'; + } + else + { + $cygxform .= 's/^CYGWIN.*$//;'; + } + while (@args) { if ($args[0] eq '-clean') @@ -4775,7 +4808,8 @@ sub am_install_var if ($do_clean) { $output_rules .= - &file_contents_with_transform ('s/\@DIR\@/' . $X . '/go;', + &file_contents_with_transform ('s/\@DIR\@/' . $X . '/go;' + . $cygxform, $clean_file); push (@clean, $X . $primary); @@ -4796,10 +4830,10 @@ sub am_install_var next; } - $output_rules .= - &file_contents_with_transform ('s/\@DIR\@/' . $X . '/g;' - . $ltxform, - $file); + $output_rules .= + &file_contents_with_transform ('s/\@DIR\@/' . $X . '/g;' + . $ltxform . $cygxform, + $file); push (@uninstall, 'uninstall-' . $X . $primary); push (@phony, 'uninstall-' . $X . $primary); diff --git a/automake.texi b/automake.texi index 20fb25c4..7355fa05 100644 --- a/automake.texi +++ b/automake.texi @@ -912,6 +912,17 @@ header. If you do use this macro, you must create the file @file{stamp-h.in} in your source directory. It can be empty. @cvindex AM_CONFIG_HEADER +@item AM_CYGWIN32 +Check to see if this @code{configure} is being run in the +@samp{Cygwin32} environment. (FIXME xref). If so, define output +variable @code{EXEEXT} to @samp{.exe}; otherwise define it to the empty +string. Automake recognizes this macro and uses it to generate +@file{Makefile.in}s which will automatically work under @samp{Cygwin32}. +In the @samp{Cygwin32} environment, @code{gcc} generates executables +whose names end in @samp{.exe}, even if this was not specified on the +command line. Automake adds special code to @file{Makefile.in} to +gracefully deal with this. + @item AM_FUNC_STRTOD If the @code{strtod} function is not available, or does not work correctly (like the one on SunOS 5.4), add @file{strtod.o} to output @@ -2183,7 +2194,8 @@ The options @samp{no-installinfo} and @samp{no-dependencies} are implied. @item -The macro @samp{AM_MAINTAINER_MODE} is required. +The macros @samp{AM_MAINTAINER_MODE} and @samp{AM_CYGWIN32} are +required. @end itemize GNU maintainers are advised to use @samp{gnu} strictness in preference diff --git a/lib/am/program.am b/lib/am/program.am index e91639ed..3d8d4116 100644 --- a/lib/am/program.am +++ b/lib/am/program.am @@ -17,3 +17,4 @@ ## 02111-1307, USA. @PROGRAM@: $(@XPROGRAM@_OBJECTS) $(@XPROGRAM@_DEPENDENCIES) $(@XLINK@) $(@XPROGRAM@_LDFLAGS) $(@XPROGRAM@_OBJECTS) $(@XPROGRAM@_LDADD) $(LIBS) +CYGWIN @test -n "$(EXEEXT)" && echo timestamp > @PROGRAM@ diff --git a/lib/am/progs.am b/lib/am/progs.am index debcf71c..3d255ef5 100644 --- a/lib/am/progs.am +++ b/lib/am/progs.am @@ -21,16 +21,18 @@ install-@DIR@PROGRAMS: $(@DIR@_PROGRAMS) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. @list="$(@DIR@_PROGRAMS)"; for p in $$list; do \ +## This works even in Cygwin32, because we've explicitly touched the +## "real" program name after building it. if test -f $$p; then \ ## Note that we explicitly set the libtool mode. This avoids any ## lossage if the install program doesn't have a name that libtool ## expects. echo " @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`"; \ - @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \ + @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p@EXEEXT@ $(@DIR@dir)/`echo $$p|sed '$(transform)'`@EXEEXT@; \ else :; fi; \ done uninstall-@DIR@PROGRAMS: list="$(@DIR@_PROGRAMS)"; for p in $$list; do \ - rm -f $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \ + rm -f $(@DIR@dir)/`echo $$p|sed '$(transform)'`@EXEEXT@; \ done diff --git a/m4/Makefile.am b/m4/Makefile.am index 8cccf1be..b04b2653 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -6,6 +6,7 @@ MAINT_CHARSET = latin1 m4datadir = $(datadir)/aclocal m4data_DATA = ccstdc.m4 dmalloc.m4 init.m4 install.m4 lispdir.m4 \ maintainer.m4 protos.m4 ptrdiff.m4 regex.m4 strtod.m4 termios.m4 \ -winsz.m4 mktime.m4 error.m4 obstack.m4 sanity.m4 header.m4 missing.m4 +winsz.m4 mktime.m4 error.m4 obstack.m4 sanity.m4 header.m4 missing.m4 \ +cygwin.m4 EXTRA_DIST = $(m4data_DATA) diff --git a/m4/Makefile.in b/m4/Makefile.in index 1b4aee3e..801e4274 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -54,7 +54,8 @@ MAINT_CHARSET = latin1 m4datadir = $(datadir)/aclocal m4data_DATA = ccstdc.m4 dmalloc.m4 init.m4 install.m4 lispdir.m4 \ maintainer.m4 protos.m4 ptrdiff.m4 regex.m4 strtod.m4 termios.m4 \ -winsz.m4 mktime.m4 error.m4 obstack.m4 sanity.m4 header.m4 missing.m4 +winsz.m4 mktime.m4 error.m4 obstack.m4 sanity.m4 header.m4 missing.m4 \ +cygwin.m4 EXTRA_DIST = $(m4data_DATA) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs diff --git a/m4/cygwin.m4 b/m4/cygwin.m4 new file mode 100644 index 00000000..0c635f36 --- /dev/null +++ b/m4/cygwin.m4 @@ -0,0 +1,14 @@ +# Check to see if we're running under Cygwin32, without using +# AC_CANONICAL_*. If so, set output variable EXEEXT to ".exe". +# Otherwise set it to "". + +dnl AM_CYGWIN32() +AC_DEFUN(AM_CYGWIN32, +[AC_MSG_CHECKING(for Cygwin32 environment) +AC_EGREP_CPP(lose, [ +#ifdef __CYGWIN32__ +lose +#endif], [EXEEXT=.exe +AC_MSG_RESULT(yes)], [EXEEXT= +AC_MSG_RESULT(no)]) +AC_SUBST(EXEEXT)]) diff --git a/program.am b/program.am index e91639ed..3d8d4116 100644 --- a/program.am +++ b/program.am @@ -17,3 +17,4 @@ ## 02111-1307, USA. @PROGRAM@: $(@XPROGRAM@_OBJECTS) $(@XPROGRAM@_DEPENDENCIES) $(@XLINK@) $(@XPROGRAM@_LDFLAGS) $(@XPROGRAM@_OBJECTS) $(@XPROGRAM@_LDADD) $(LIBS) +CYGWIN @test -n "$(EXEEXT)" && echo timestamp > @PROGRAM@ diff --git a/progs-clean.am b/progs-clean.am index cfe84d0d..a4f14b44 100644 --- a/progs-clean.am +++ b/progs-clean.am @@ -18,7 +18,10 @@ mostlyclean-@DIR@PROGRAMS: clean-@DIR@PROGRAMS: - test -z "$(@DIR@_PROGRAMS)" || rm -f $(@DIR@_PROGRAMS) +NOTCYGWIN test -z "$(@DIR@_PROGRAMS)" || rm -f $(@DIR@_PROGRAMS) +CYGWIN @list="$(@DIR@_PROGRAMS)"; for p in $$list; do \ +CYGWIN rm -f $$p $$p$(EXEEXT); \ +CYGWIN done distclean-@DIR@PROGRAMS: diff --git a/progs.am b/progs.am index debcf71c..3d255ef5 100644 --- a/progs.am +++ b/progs.am @@ -21,16 +21,18 @@ install-@DIR@PROGRAMS: $(@DIR@_PROGRAMS) ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. @list="$(@DIR@_PROGRAMS)"; for p in $$list; do \ +## This works even in Cygwin32, because we've explicitly touched the +## "real" program name after building it. if test -f $$p; then \ ## Note that we explicitly set the libtool mode. This avoids any ## lossage if the install program doesn't have a name that libtool ## expects. echo " @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`"; \ - @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \ + @LIBTOOL --mode=install@ $(INSTALL_PROGRAM) $$p@EXEEXT@ $(@DIR@dir)/`echo $$p|sed '$(transform)'`@EXEEXT@; \ else :; fi; \ done uninstall-@DIR@PROGRAMS: list="$(@DIR@_PROGRAMS)"; for p in $$list; do \ - rm -f $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \ + rm -f $(@DIR@dir)/`echo $$p|sed '$(transform)'`@EXEEXT@; \ done diff --git a/stamp-vti b/stamp-vti index 31205f9b..44defd03 100644 --- a/stamp-vti +++ b/stamp-vti @@ -1,3 +1,3 @@ -@set UPDATED 19 March 1997 +@set UPDATED 20 March 1997 @set EDITION 1.1m @set VERSION 1.1m diff --git a/version.texi b/version.texi index 31205f9b..44defd03 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 19 March 1997 +@set UPDATED 20 March 1997 @set EDITION 1.1m @set VERSION 1.1m -- 2.43.5