glib: Allow cross-building with native glib 2.24.
[minipack.git] / patches / pcb / 0001-Use-_spawnvp-if-present.patch
blob9b27219898167f22ae65d2731a455a1b0de156cd
1 From: Cesar Strauss <cstrauss@not2005.cea.inpe.br>
2 Date: Sat, 9 Oct 2010 21:37:26 +0000 (-0300)
3 Subject: Check for the _spawnvp function and use it if present.
4 X-Git-Url: http://git.gpleda.org/?p=pcb.git;a=commitdiff_plain;h=02fa7cf6646ad4f16383c91e53784986f4d8d15d;hp=70786c0c18c8d2c4626d429068e88a4601a21d6d
6 Check for the _spawnvp function and use it if present.
7 ---
9 diff --git a/configure.ac b/configure.ac
10 index a220a82..abdd8a1 100644
11 --- a/configure.ac
12 +++ b/configure.ac
13 @@ -662,6 +662,9 @@ AC_CHECK_FUNCS(popen)
14 AC_CHECK_FUNCS(realpath canonicalize_file_name)
15 libiberty_NEED_DECLARATION(canonicalize_file_name)
17 +# for pcb_spawnvp in action.c on Windows
18 +AC_CHECK_FUNCS(_spawnvp)
20 AC_HEADER_STDC
21 AC_CHECK_HEADERS(limits.h locale.h string.h sys/types.h regex.h pwd.h)
22 AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h sys/wait.h)
23 diff --git a/src/action.c b/src/action.c
24 index 0e035a6..88907af 100644
25 --- a/src/action.c
26 +++ b/src/action.c
27 @@ -7287,6 +7287,13 @@ ActionExecCommand (int argc, char **argv, int x, int y)
28 static int
29 pcb_spawnvp (char **argv)
31 +#ifdef HAVE__SPAWNVP
32 + int result = _spawnvp (_P_WAIT, argv[0], argv);
33 + if (result == -1)
34 + return 1;
35 + else
36 + return 0;
37 +#else
38 int pid;
39 pid = fork ();
40 if (pid < 0)
41 @@ -7308,6 +7315,7 @@ pcb_spawnvp (char **argv)
42 wait (&rv);
44 return 0;
45 +#endif
48 /* ---------------------------------------------------------------- */