diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-09-15 10:40:29 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-09-15 10:40:54 +0300 |
commit | 989a5bbb74c3620abaa2191ce2c4f8d5968dbf0a (patch) | |
tree | c0b2324a523905c3c17201cc2468c9078976fc74 /am/proctitle.m4 | |
parent | dbad35177723e19147ab49b59a3728e00fe05875 (diff) | |
download | pies-989a5bbb74c3620abaa2191ce2c4f8d5968dbf0a.tar.gz pies-989a5bbb74c3620abaa2191ce2c4f8d5968dbf0a.tar.bz2 |
Branch off from the Mailfromd project into a separate repository.
Diffstat (limited to 'am/proctitle.m4')
-rw-r--r-- | am/proctitle.m4 | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/am/proctitle.m4 b/am/proctitle.m4 new file mode 100644 index 0000000..c912072 --- /dev/null +++ b/am/proctitle.m4 | |||
@@ -0,0 +1,79 @@ | |||
1 | dnl This file is part of Mailfromd. | ||
2 | dnl Copyright (C) 2008 Sergey Poznyakoff | ||
3 | dnl | ||
4 | dnl This program is free software; you can redistribute it and/or modify | ||
5 | dnl it under the terms of the GNU General Public License as published by | ||
6 | dnl the Free Software Foundation; either version 3, or (at your option) | ||
7 | dnl any later version. | ||
8 | dnl | ||
9 | dnl This program is distributed in the hope that it will be useful, | ||
10 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | dnl GNU General Public License for more details. | ||
13 | dnl | ||
14 | dnl You should have received a copy of the GNU General Public License | ||
15 | dnl along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AC_DEFUN([MF_PROCTITLE],[ | ||
18 | AH_TEMPLATE([MF_PROCTITLE_TYPE], [Type of setproctitle implementation]) | ||
19 | AH_BOTTOM([ | ||
20 | #define MF_PROCTITLE_SETPROCTITLE 0 | ||
21 | #define MF_PROCTITLE_REPLACE_ARGV 1 | ||
22 | #define MF_PROCTITLE_REWRITE_ARGV 2 | ||
23 | #define MF_PROCTITLE_PSTAT 3 | ||
24 | #define MF_PROCTITLE_PSSTRINGS 4 | ||
25 | ]) | ||
26 | AC_SUBST(MF_PROCTITLE_LIBS) | ||
27 | |||
28 | AC_TRY_LINK([extern char *__progname, *__progname_full;], | ||
29 | [__progname = "foo"; __progname_full = "foo bar";], | ||
30 | [AC_DEFINE(HAVE___PROGNAME, 1, | ||
31 | [Define to 1 if libc has __progname])]) | ||
32 | |||
33 | mf_proctitle_type=no | ||
34 | AC_CHECK_FUNC(setproctitle, | ||
35 | [mf_proctitle_type=MF_PROCTITLE_SETPROCTITLE], | ||
36 | [AC_CHECK_HEADERS(libutil.h) | ||
37 | AC_CHECK_LIB(util, setproctitle, | ||
38 | [mf_proctitle_type=MF_PROCTITLE_SETPROCTITLE | ||
39 | MF_PROCTITLE_LIBS="-lutil"])]) | ||
40 | |||
41 | if test "$mf_proctitle_type" = no; then | ||
42 | AC_CHECK_HEADER([sys/pstat.h], | ||
43 | [AC_CHECK_FUNC([pstat], | ||
44 | [mf_proctitle_type=MF_PROCTITLE_PSTAT], | ||
45 | [mf_proctitle_type=MF_PROCTITLE_REWRITE_ARGV])]) | ||
46 | if test "$mf_proctitle_type" = no; then | ||
47 | AC_TRY_COMPILE([#include <machine/vmparam.h> | ||
48 | #include <sys/exec.h>], | ||
49 | [ | ||
50 | #include <sys/types.h> | ||
51 | #include <sys/proc.h> | ||
52 | #include <vm/pmap.h> | ||
53 | #include <machine/pmap.h> | ||
54 | #include <machine/vmparam.h> | ||
55 | #include <sys/exec.h> | ||
56 | |||
57 | main() | ||
58 | { | ||
59 | int i = PS_STRINGS; | ||
60 | } | ||
61 | ], | ||
62 | [mf_proctitle_type=MF_PROCTITLE_PSSTRINGS]) | ||
63 | |||
64 | if test "$mf_proctitle_type" = no; then | ||
65 | AC_EGREP_CPP(yes,[ | ||
66 | #if defined(__GNU_HURD__) | ||
67 | yes | ||
68 | #endif | ||
69 | ], | ||
70 | [mf_proctitle_type=MF_PROCTITLE_REPLACE_ARGV], | ||
71 | [mf_proctitle_type=MF_PROCTITLE_REWRITE_ARGV]) | ||
72 | fi | ||
73 | fi | ||
74 | fi | ||
75 | |||
76 | AC_DEFINE_UNQUOTED([MF_PROCTITLE_TYPE],$mf_proctitle_type) | ||
77 | |||
78 | ]) | ||
79 | \ No newline at end of file | ||