all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Checking for sed during configure on Windows
@ 2011-05-07 19:58 Christoph Scholtes
  2011-05-07 20:31 ` Juanma Barranquero
  2011-05-08  3:02 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Christoph Scholtes @ 2011-05-07 19:58 UTC (permalink / raw
  To: emacs-devel; +Cc: Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

When I run a `make bootstrap' after `maintainer-clean' or a fresh 
checkout I have to remember to regenerate `getopt_.h'.

The following patch checks if sed is available and if it is, does this 
automatically.

Christoph

[-- Attachment #2: check_sed.patch --]
[-- Type: text/plain, Size: 2973 bytes --]

=== modified file 'ChangeLog'
--- ChangeLog	2011-05-06 07:13:19 +0000
+++ ChangeLog	2011-05-07 19:56:48 +0000
@@ -1,3 +1,8 @@
+2011-05-07  Christoph Scholtes  <cschol2112@googlemail.com>
+
+	* lib/makefile.w32-in: If sed is available build `getopt._h' as
+	part of bootstrap.
+
 2011-05-06  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Use C99's va_copy to avoid undefined behavior on x86-64 GNU/Linux.

=== modified file 'lib/makefile.w32-in'
--- lib/makefile.w32-in	2011-04-06 16:05:49 +0000
+++ lib/makefile.w32-in	2011-05-07 19:42:57 +0000
@@ -157,7 +157,11 @@
 doit:
 
 getopt_.h: getopt.in.h $(ARG_NONNULL_H)
+ifdef HAVE_SED
+	$(MAKE) $(MFLAGS) getopt_h
+else
 	$(MAKE) $(MFLAGS) getopt_.h-$(SHELLTYPE)
+endif
 
 getopt_.h-CMD: doit
 	@echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.

=== modified file 'nt/ChangeLog'
--- nt/ChangeLog	2011-05-07 04:00:12 +0000
+++ nt/ChangeLog	2011-05-07 19:55:07 +0000
@@ -1,3 +1,7 @@
+2011-05-07  Christoph Scholtes  <cschol2112@googlemail.com>
+
+	* configure.bat: Check if sed is available on system.
+
 2011-05-07  Ben Key  <bkey76@gmail.com>
 
 	* configure.bat: Renamed the fusercflags variable to escusercflags

=== modified file 'nt/configure.bat'
--- nt/configure.bat	2011-05-07 04:00:12 +0000
+++ nt/configure.bat	2011-05-07 19:38:54 +0000
@@ -356,7 +356,7 @@
 echo Checking for 'rm'...
 rm junk.bat
 if exist junk.bat goto needrm
-goto checkcompiler
+goto checkmaintutils
 
 :needcp
 echo You need 'cp' (the Unix file copy program) to build Emacs.
@@ -368,6 +368,34 @@
 goto end
 
 rem ----------------------------------------------------------------------
+rem   Check if maintainer tools are present (optional).
+
+:checkmaintutils
+
+rem Checking for sed requires command extensions, if not available skip
+if "%use_extensions%" == "1" goto :checksed
+goto checkcompiler
+
+:checksed
+echo Checking for 'sed' (optional)...
+set junk=junk
+for /f "tokens=*" %%a in (
+'"echo foo | sed -e s/foo/bar/g"'
+) do (
+set junk=%%a
+)
+if not %junk% == bar goto donthavesed
+
+set havesed=Y
+set junk=
+goto checkcompiler
+
+:donthavesed
+set junk=
+set havesed=
+goto checkcompiler
+
+rem ----------------------------------------------------------------------
 rem   Auto-detect compiler if not specified, and validate GCC if chosen.
 
 :checkcompiler
@@ -735,6 +763,7 @@
 if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings
 if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix%>>config.settings
 if not "(%distfiles%)" == "()" echo DIST_FILES=%distfiles%>>config.settings
+if (%havesed%) == (Y) echo HAVE_SED=1 >>config.settings
 rem We go thru docflags because usercflags could be "-DFOO=bar" -something
 rem and the if command cannot cope with this
 for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y
@@ -894,6 +923,7 @@
 set distfiles=
 set HAVE_DISTFILES=
 set distFilesOk=
+set havesed=
 set pngsupport=
 set tlssupport=
 set jpegsupport=


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Checking for sed during configure on Windows
  2011-05-07 19:58 Checking for sed during configure on Windows Christoph Scholtes
@ 2011-05-07 20:31 ` Juanma Barranquero
  2011-05-07 21:20   ` Christoph Scholtes
  2011-05-08  3:02 ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Juanma Barranquero @ 2011-05-07 20:31 UTC (permalink / raw
  To: Christoph Scholtes; +Cc: Eli Zaretskii, emacs-devel

> When I run a `make bootstrap' after `maintainer-clean' or a fresh checkout I
> have to remember to regenerate `getopt_.h'.

What do you mean, you have to remember to regenerate getopt_.h?

    Juanma



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Checking for sed during configure on Windows
  2011-05-07 20:31 ` Juanma Barranquero
@ 2011-05-07 21:20   ` Christoph Scholtes
  2011-05-07 21:36     ` Juanma Barranquero
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Scholtes @ 2011-05-07 21:20 UTC (permalink / raw
  To: Juanma Barranquero; +Cc: Eli Zaretskii, emacs-devel

On 5/7/2011 2:31 PM, Juanma Barranquero wrote:
>> When I run a `make bootstrap' after `maintainer-clean' or a fresh checkout I
>> have to remember to regenerate `getopt_.h'.
>
> What do you mean, you have to remember to regenerate getopt_.h?
>
>      Juanma

`maintainer-clean' removes getopt.h.

 From lib/makefile:

maintainer-clean: distclean
	- $(DEL) getopt_.h

When I run `make bootstrap' after that, this is executed:

getopt_.h-CMD: doit
	@echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
	@echo Run "$(MAKETYPE) getopt_h" in the lib/ subdirectory.
	@echo You will need GNU Sed to be installed.
	exit -1

I know it's usually a one time thing, but when I have sed installed it 
shouldnt abort there but just regenerate it automatically.

Christoph



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Checking for sed during configure on Windows
  2011-05-07 21:20   ` Christoph Scholtes
@ 2011-05-07 21:36     ` Juanma Barranquero
  2011-05-07 22:28       ` Christoph Scholtes
  0 siblings, 1 reply; 7+ messages in thread
From: Juanma Barranquero @ 2011-05-07 21:36 UTC (permalink / raw
  To: Christoph Scholtes; +Cc: Eli Zaretskii, emacs-devel

On Sat, May 7, 2011 at 23:20, Christoph Scholtes
<cschol2112@googlemail.com> wrote:

> `maintainer-clean' removes getopt.h.
>
> From lib/makefile:
>
> maintainer-clean: distclean
>        - $(DEL) getopt_.h
>
> When I run `make bootstrap' after that, this is executed:
>
> getopt_.h-CMD: doit
>        @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
>        @echo Run "$(MAKETYPE) getopt_h" in the lib/ subdirectory.
>        @echo You will need GNU Sed to be installed.
>        exit -1
>
> I know it's usually a one time thing, but when I have sed installed it
> shouldnt abort there but just regenerate it automatically.

You said "after `maintainer-clean' or a fresh checkout".

I always bootstrap like this:

  cd trunk
  bzr --no-plugins clean-tree --unknown --ignored --detritus --force
  cd nt
  configure  # several options
  make bootstrap
  make install-bin

and it just works (I have sed in the path, of course).

    Juanma



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Checking for sed during configure on Windows
  2011-05-07 21:36     ` Juanma Barranquero
@ 2011-05-07 22:28       ` Christoph Scholtes
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Scholtes @ 2011-05-07 22:28 UTC (permalink / raw
  To: Juanma Barranquero; +Cc: Eli Zaretskii, emacs-devel

On 5/7/2011 3:36 PM, Juanma Barranquero wrote:

> You said "after `maintainer-clean' or a fresh checkout".

Sorry, a fresh checkout just works, since getopt_.h is under version 
control. I was mistaken. This only applies to the state after 
`maintainer-clean', where getopt_.h is removed.

I remember you telling me about the nifty clean tree command you use in 
another thread. I guess that would solve my use case (start from a clean 
sheet), without having to regenerate getopt_.h.

Thanks.

Christoph




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Checking for sed during configure on Windows
  2011-05-07 19:58 Checking for sed during configure on Windows Christoph Scholtes
  2011-05-07 20:31 ` Juanma Barranquero
@ 2011-05-08  3:02 ` Eli Zaretskii
  2011-05-08  3:30   ` Christoph Scholtes
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2011-05-08  3:02 UTC (permalink / raw
  To: Christoph Scholtes; +Cc: emacs-devel

> Date: Sat, 07 May 2011 13:58:39 -0600
> From: Christoph Scholtes <cschol2112@googlemail.com>
> CC: Eli Zaretskii <eliz@gnu.org>
> 
> [1:text/plain Hide]
> When I run a `make bootstrap' after `maintainer-clean' or a fresh 
> checkout I have to remember to regenerate `getopt_.h'.
> 
> The following patch checks if sed is available and if it is, does this 
> automatically.

Since this is only a problem during bootstrap, how about moving the
command to some target that only gets run as part of bootstrap?

I would also support simply trying to run Sed at that time, without
any configure-time checks.  People who bootstrap can be trusted to
have Sed, I think.  If they don't Make will barf and let them know.

Thanks.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Checking for sed during configure on Windows
  2011-05-08  3:02 ` Eli Zaretskii
@ 2011-05-08  3:30   ` Christoph Scholtes
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Scholtes @ 2011-05-08  3:30 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: emacs-devel

On 5/7/2011 9:02 PM, Eli Zaretskii wrote:

> Since this is only a problem during bootstrap, how about moving the
> command to some target that only gets run as part of bootstrap?
>
> I would also support simply trying to run Sed at that time, without
> any configure-time checks.  People who bootstrap can be trusted to
> have Sed, I think.  If they don't Make will barf and let them know.

Sounds good to me. I will try to find a spot during bootstrap and just 
run Sed. Less complexity is better.

My initial patch was based on wrong assumption that this is needed every 
time Emacs is build from scratch through either a fresh check out or a 
maintainer clean. As Juanma pointed out this is not the case. The use 
case for this is rather specific (maintainer-clean only or if the 
getopt.in.h ever changed) as far as I can tell.

Christoph



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-05-08  3:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-07 19:58 Checking for sed during configure on Windows Christoph Scholtes
2011-05-07 20:31 ` Juanma Barranquero
2011-05-07 21:20   ` Christoph Scholtes
2011-05-07 21:36     ` Juanma Barranquero
2011-05-07 22:28       ` Christoph Scholtes
2011-05-08  3:02 ` Eli Zaretskii
2011-05-08  3:30   ` Christoph Scholtes

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.