aboutsummaryrefslogtreecommitdiff
path: root/am
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-09-15 10:40:29 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-09-15 10:40:54 +0300
commit989a5bbb74c3620abaa2191ce2c4f8d5968dbf0a (patch)
treec0b2324a523905c3c17201cc2468c9078976fc74 /am
parentdbad35177723e19147ab49b59a3728e00fe05875 (diff)
downloadpies-989a5bbb74c3620abaa2191ce2c4f8d5968dbf0a.tar.gz
pies-989a5bbb74c3620abaa2191ce2c4f8d5968dbf0a.tar.bz2
Branch off from the Mailfromd project into a separate repository.
Diffstat (limited to 'am')
-rw-r--r--am/aggr.m460
-rw-r--r--am/gcc.m467
-rw-r--r--am/proctitle.m479
3 files changed, 206 insertions, 0 deletions
diff --git a/am/aggr.m4 b/am/aggr.m4
new file mode 100644
index 0000000..2bdbb46
--- /dev/null
+++ b/am/aggr.m4
@@ -0,0 +1,60 @@
+dnl Autoconf macros for checking for aggregate type members
+dnl
+dnl Copyright (C) 1996, 1997, 1998, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
+dnl
+dnl Mostly written by Miles Bader <miles@gnu.ai.mit.edu>
+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, write to the Free Software
+dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+dnl
+
+dnl IU_CHECK_MEMBER(AGGREGATE.MEMBER,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+dnl [INCLUDES])
+dnl AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos'.
+dnl The member itself can be of an aggregate type
+dnl Shell variables are not a valid argument.
+AC_DEFUN([IU_CHECK_MEMBER],
+[AS_LITERAL_IF([$1], [],
+ [AC_FATAL([$0: requires literal arguments])])dnl
+m4_bmatch([$1], [\.], ,
+ [m4_fatal([$0: Did not see any dot in `$1'])])dnl
+AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
+dnl Extract the aggregate name, and the member name
+AC_CACHE_CHECK([for $1], ac_Member,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
+[dnl AGGREGATE ac_aggr;
+static m4_bpatsubst([$1], [\..*]) ac_aggr;
+dnl ac_aggr.MEMBER;
+if (sizeof(ac_aggr.m4_bpatsubst([$1], [^[^.]*\.])))
+return 0;])],
+ [AS_VAR_SET(ac_Member, yes)],
+ [AS_VAR_SET(ac_Member, no)])])
+AS_IF([test AS_VAR_GET(ac_Member) = yes], [$2], [$3])
+AS_VAR_POPDEF([ac_Member])dnl
+])dnl IU_CHECK_MEMBER
+
+dnl IU_CHECK_MEMBERS([AGGREGATE.MEMBER, ...],
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]
+dnl [INCLUDES])
+AC_DEFUN([IU_CHECK_MEMBERS],
+[m4_foreach([AC_Member], [$1],
+ [IU_CHECK_MEMBER(AC_Member,
+ [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Member), 1,
+ [Define to 1 if `]m4_bpatsubst(AC_Member,
+ [^[^.]*\.])[' is
+ member of `]m4_bpatsubst(AC_Member, [\..*])['.])
+$2],
+ [$3],
+ [$4])])])
diff --git a/am/gcc.m4 b/am/gcc.m4
new file mode 100644
index 0000000..37d90ac
--- /dev/null
+++ b/am/gcc.m4
@@ -0,0 +1,67 @@
+# This file is part of Mailfromd. -*- autoconf -*-
+# Copyright (C) 2009 Sergey Poznyakoff
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AC_DEFUN([MF_CC_OPT],[
+ m4_pushdef([mf_optname],translit($1,[-],[_]))
+ AC_MSG_CHECKING(whether $CC accepts $1)
+ mf_save_cc="$CC"
+ CC="$CC $1"
+ AC_TRY_RUN([int main() { return 0; }],
+ [mf_cv_cc_]mf_optname=yes,
+ [mf_cv_cc_]mf_optname=no,
+ [mf_cv_cc_]mf_optname=no)
+ CC="$mf_save_cc"
+ AC_MSG_RESULT($[mf_cv_cc_]mf_optname)
+
+ if test $[mf_cv_cc_]mf_optname = yes; then
+ ifelse([$2],,:,[$2])
+ ifelse([$3],,,else
+ [$3])
+ fi
+ m4_popdef([mf_optname])
+ ])
+
+AC_DEFUN([MF_CC_OPT_CFLAGS],[
+ MF_CC_OPT([$1],[CFLAGS="$CFLAGS $1"])
+])
+
+AC_DEFUN([MF_GCC_ALIAS_QUIRK],[
+ #
+ # Quoting Linus Torvalds:
+ # The gcc people are more interested in trying to find out what can be
+ # allowed by the c99 specs than about making things actually _work_. The
+ # aliasing code in particular is not even worth enabling, it's just not
+ # possible to sanely tell gcc when some things can alias.
+ # (see http://lkml.org/lkml/2003/2/26/158, for details)
+ #
+ # (The code below is borrowed from Python's configure.in)
+ MF_CC_OPT_CFLAGS([-fno-strict-aliasing])
+])
+
+AC_DEFUN([MF_GCC_PAREN_QUIRK],[
+ MF_CC_OPT_CFLAGS([-Wno-parentheses])
+])
+
+AC_DEFUN([MF_GCC_QUIRKS],[
+ case $GCC in
+ yes)
+ MF_GCC_ALIAS_QUIRK
+ MF_GCC_PAREN_QUIRK
+ ;;
+ *) # FIXME
+ ;;
+ esac])
+
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 <http://www.gnu.org/licenses/>.
+
+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 <machine/vmparam.h>
+ #include <sys/exec.h>],
+ [
+#include <sys/types.h>
+#include <sys/proc.h>
+#include <vm/pmap.h>
+#include <machine/pmap.h>
+#include <machine/vmparam.h>
+#include <sys/exec.h>
+
+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

Return to:

Send suggestions and report system problems to the System administrator.