On Sat, 16 Apr 2011, Gilles wrote:
On Sat, 16 Apr 2011 02:31:56 -0700, Harlan Stenn <stenn@xxxxxxx>
wrote:
A quick hack (and it may not work well) would be to detect these
systems, and stuff in something that effectively does '#define fork
vfork'.
What I'd like, is to learn how to modify the linker so that it
displays a warning instead of an error, like it used to.
Does someone know how to do this?
What you are looking to do ultimately has nothing to do with autoconf.
Autoconf is all about configuration prior to compilation of the
application software. It has nothing to do with link-time or run-time
configuration.
An alternate approach you could use is to use dlopen(0,RTLD_NOLOAD)
and then dlsym() to see if the "fork" symbol is available at run time
to the running program. If it is available, then use it. This avoids
directly linking against fork().
Here is some completely untested code which might even compile:
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <link.h>
int my_fork_func(void)
{
void *dl_handle;
pid_t (*fork_f)(void);
int status=-1;
dl_handle=dlopen(0,RTLD_NOLOAD);
if (dl_handle)
{
fork_f=dlsym(dl_handle,"fork");
if !(fork_f)
fork_f=dlsym(dl_handle,"vfork");
if (fork_f)
status=fork_f();
(void) dlclose(dl_handle);
}
return status;
}
Bob
--
Bob Friesenhahn
bfriesen@xxxxxxxxxxxxxxxxxxx, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf