all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Configuring Emacs on Windows with autoconf
@ 2012-11-23 18:34 Eli Zaretskii
  2012-11-23 19:19 ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2012-11-23 18:34 UTC (permalink / raw)
  To: emacs-devel

I need help from the autoconf experts here.

I'm trying to configure Emacs for Windows using the configure script
(modified to DTRT for the MinGW build).  The problem I face is how to
get configure.ac to produce correct results for library functions
implemented in Emacs sources, or shadowed by sys_FOO functions.  The
goal is to provide the necessary HAVE_FOO macros and prevent configure
from linking replacements (from lib/ and sysdep) where an
implementation already exists.

I could simply do something like what this does for Cygwin:

  case $opsys in
    cygwin)
      AC_DEFINE(G_SLICE_ALWAYS_MALLOC, 1, [Define to set the
	G_SLICE environment variable to "always-malloc" at startup, if
	using GTK.])
      ;;

IOW, simply unconditionally define by hand all those HAVE_FOO macros
for which the implementation is in Emacs itself, and similarly for the
various ac_cv_func_FOO variables that control whether gnulib
replacements are used.  But I wonder whether there's a better
alternative.

(I already considered the possibility of adding to gnulib the code
which implements in Emacs the missing or faulty library functions in
the Windows runtime.  My conclusion was that this would be a very
large job, since the implementations we have in Emacs are almost
always not general enough to be pushed into gnulib, and also depend
internally on some Emacs-only facilities.  So I'd like for now not to
go that way.)

TIA.

P.S.  This is the first time I do something half-serious in autoconf,
and I must say that its manual is grossly inadequate: too abstract,
with vague language, and too few examples.  It makes me frequently
try-and-err.  (Yes, I know this is not the right place to complain
about autoconf; just letting off some steam.)



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

* Re: Configuring Emacs on Windows with autoconf
  2012-11-23 18:34 Configuring Emacs on Windows with autoconf Eli Zaretskii
@ 2012-11-23 19:19 ` Paul Eggert
  2012-11-23 19:38   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2012-11-23 19:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 11/23/2012 10:34 AM, Eli Zaretskii wrote:

> I already considered the possibility of adding to gnulib

Another possibility is to use the Gnulib style, but in
Emacs-only modules.  That is, instead of creating a Gnulib
module FOO that implements the replacement function foo,
add to Emacs the files lib/foo.c and m4/foo.m4 (and whatever)
that act like Gnulib, but in a way that's less general and is
Emacs-specific and solves the problem just for Emacs.

You can see a fairly elaborate example of this in GNU
coreutils (see the directory gl).  I don't know that Emacs
would have to be that fancy, but the coreutils code can be a
source of ideas.



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

* Re: Configuring Emacs on Windows with autoconf
  2012-11-23 19:19 ` Paul Eggert
@ 2012-11-23 19:38   ` Eli Zaretskii
  2012-11-23 20:56     ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2012-11-23 19:38 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

> Date: Fri, 23 Nov 2012 11:19:16 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: emacs-devel@gnu.org
> 
> On 11/23/2012 10:34 AM, Eli Zaretskii wrote:
> 
> > I already considered the possibility of adding to gnulib
> 
> Another possibility is to use the Gnulib style, but in
> Emacs-only modules.  That is, instead of creating a Gnulib
> module FOO that implements the replacement function foo,
> add to Emacs the files lib/foo.c and m4/foo.m4 (and whatever)
> that act like Gnulib, but in a way that's less general and is
> Emacs-specific and solves the problem just for Emacs.

Thanks, that's an idea.  But how would configure know to use those
lib/foo.c files for one particular build configuration?

> You can see a fairly elaborate example of this in GNU
> coreutils (see the directory gl).  I don't know that Emacs
> would have to be that fancy, but the coreutils code can be a
> source of ideas.

Thanks for the pointer, I will study that.



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

* Re: Configuring Emacs on Windows with autoconf
  2012-11-23 19:38   ` Eli Zaretskii
@ 2012-11-23 20:56     ` Paul Eggert
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Eggert @ 2012-11-23 20:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 11/23/2012 11:38 AM, Eli Zaretskii wrote:
> how would configure know to use those
> lib/foo.c files for one particular build configuration?

Here's a common pattern:

  gl_FUNC_STRTOUMAX
  if test $ac_cv_func_strtoumax = no; then
    AC_LIBOBJ([strtoumax])
    gl_PREREQ_STRTOUMAX
  fi

The first macro tests whether strtoumax exists.
If it doesn't, the code invokes AC_LIBOBJ to say
that lib/strtoumax.o is needed, and invokes
gl_PREREQ_STRTOUMAX to configure all the stuff
that is needed to compile strtoumax.c.  If
strtoumax exists, the code doesn't compile strtoumax.c
and doesn't do the work necessary to configure it.

A different pattern is used when one must replace
a function rather than simply provide a substitute
when the function is missing.



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

end of thread, other threads:[~2012-11-23 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-23 18:34 Configuring Emacs on Windows with autoconf Eli Zaretskii
2012-11-23 19:19 ` Paul Eggert
2012-11-23 19:38   ` Eli Zaretskii
2012-11-23 20:56     ` Paul Eggert

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.