From 989a5bbb74c3620abaa2191ce2c4f8d5968dbf0a Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Tue, 15 Sep 2009 10:40:29 +0300 Subject: Branch off from the Mailfromd project into a separate repository. --- am/proctitle.m4 | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 am/proctitle.m4 (limited to 'am/proctitle.m4') 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 @@ +dnl This file is part of Mailfromd. +dnl Copyright (C) 2008 Sergey Poznyakoff +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 3, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program. If not, see . + +AC_DEFUN([MF_PROCTITLE],[ + AH_TEMPLATE([MF_PROCTITLE_TYPE], [Type of setproctitle implementation]) + AH_BOTTOM([ +#define MF_PROCTITLE_SETPROCTITLE 0 +#define MF_PROCTITLE_REPLACE_ARGV 1 +#define MF_PROCTITLE_REWRITE_ARGV 2 +#define MF_PROCTITLE_PSTAT 3 +#define MF_PROCTITLE_PSSTRINGS 4 +]) + AC_SUBST(MF_PROCTITLE_LIBS) + + AC_TRY_LINK([extern char *__progname, *__progname_full;], + [__progname = "foo"; __progname_full = "foo bar";], + [AC_DEFINE(HAVE___PROGNAME, 1, + [Define to 1 if libc has __progname])]) + + mf_proctitle_type=no + AC_CHECK_FUNC(setproctitle, + [mf_proctitle_type=MF_PROCTITLE_SETPROCTITLE], + [AC_CHECK_HEADERS(libutil.h) + AC_CHECK_LIB(util, setproctitle, + [mf_proctitle_type=MF_PROCTITLE_SETPROCTITLE + MF_PROCTITLE_LIBS="-lutil"])]) + + if test "$mf_proctitle_type" = no; then + AC_CHECK_HEADER([sys/pstat.h], + [AC_CHECK_FUNC([pstat], + [mf_proctitle_type=MF_PROCTITLE_PSTAT], + [mf_proctitle_type=MF_PROCTITLE_REWRITE_ARGV])]) + if test "$mf_proctitle_type" = no; then + AC_TRY_COMPILE([#include + #include ], + [ +#include +#include +#include +#include +#include +#include + +main() +{ + int i = PS_STRINGS; +} +], + [mf_proctitle_type=MF_PROCTITLE_PSSTRINGS]) + + if test "$mf_proctitle_type" = no; then + AC_EGREP_CPP(yes,[ +#if defined(__GNU_HURD__) + yes +#endif +], + [mf_proctitle_type=MF_PROCTITLE_REPLACE_ARGV], + [mf_proctitle_type=MF_PROCTITLE_REWRITE_ARGV]) + fi + fi + fi + + AC_DEFINE_UNQUOTED([MF_PROCTITLE_TYPE],$mf_proctitle_type) + +]) + \ No newline at end of file -- cgit v1.2.1