diff --git a/.gitignore b/.gitignore index 522fe6e..b7e0073 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ *.o daemonize daemonize.html -config.h +auto_config.h config.log config.status config.cache diff --git a/Makefile.in b/Makefile.in index 40d3dee..26a78c3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -49,7 +49,7 @@ clean: rm -rf *.o daemonize testdaemon *.ps distclean: clean - rm -rf config.status config.log config.cache config.h Makefile autom?te.cache + rm -rf config.status config.log config.cache auto_config.h Makefile autom?te.cache # Copy stuff to the gh-pages directory. I doubt you want to use this target, # unless you're maintaining the web site (i.e., unless you're me). diff --git a/acconfig.h b/config.h similarity index 54% rename from acconfig.h rename to config.h index 7246ef7..3d0bc9b 100644 --- a/acconfig.h +++ b/config.h @@ -10,89 +10,9 @@ #ifndef _CONFIG_H_ #define _CONFIG_H_ +#include #include -@@TOP@@ - -/* define if your C compiler lacks a built-in `bool' type */ -#undef bool - -/* define to `int' if your system lacks `ssize_t' */ -#undef ssize_t - -/* define to `unsigned short' if your system lacks `ushort' */ -#undef ushort - -/* - Define if you have the `sig_t' type in or - (e.g., FreeBSD) -*/ -#undef HAVE_SIG_T - -/* - Define if your compiler supports a native "byte" type that holds at least - eight bits. -*/ -#undef HAVE_BYTE_TYPE - -/* Define if you have the getpgrp() function. */ -#undef HAVE_GETPGRP - -/* Define if you have the setpgrp() function. */ -#undef HAVE_SETPGRP - -/* Define if you have the initgroups() function. */ -#undef HAVE_INITGROUPS - -/* Define if you have the setsid() function. Almost everyone does. */ -#undef HAVE_SETSID - -/* Define if you have the sysconf() function. */ -#undef HAVE_SYSCONF - -/* Define if you have the daemon() function. */ -#undef HAVE_DAEMON - -/* Define if you have the strerror() function. */ -#undef HAVE_STRERROR - -/* Define if you have vfork() */ -#undef HAVE_VFORK - -/* Define if you have vprintf() */ -#undef HAVE_VPRINTF - -/* Define if you have the `pw_comment' field in `struct passwd' (pwd.h) */ -#undef HAVE_PW_COMMENT - -/* Define if you have the `pw_gecos' field in `struct passwd' (pwd.h) */ -#undef HAVE_PW_GECOS - -/* Define to `long' if you don't have `off_t' */ -#undef off_t - -/* Define to `int' if you don't have `mode_t' */ -#undef mode_t - -/* Define to `int' if you don't have `pid_t' */ -#undef pid_t - -/* Define to `int' if you don't have `gid_t' and `uid_t' */ -#undef uid_t -#undef gid_t - -/* Define to `unsigned' if you don't have `size_t' */ -#undef size_t - -/* Define if you have */ -#undef HAVE_ERRNO_H - -@@BOTTOM@@ - -/*****************************************************************************\ - DON'T TOUCH ANYTHING BELOW HERE! -\*****************************************************************************/ - #ifndef HAVE_BYTE_TYPE typedef unsigned char byte; /* 8 bit unsigned critter */ #endif /* HAVE_BYTE_TYPE */ diff --git a/config.h.in b/config.h.in deleted file mode 100644 index 013c38c..0000000 --- a/config.h.in +++ /dev/null @@ -1,254 +0,0 @@ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/*---------------------------------------------------------------------------*\ - Site-specific configuration file for run-as utility - - Input to `autoheader': $Id$ -\*---------------------------------------------------------------------------*/ - -#ifndef _CONFIG_H_ -#define _CONFIG_H_ - -#include - - -/* Define if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -#undef _ALL_SOURCE -#endif - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define if the `getpgrp' function takes no argument. */ -#undef GETPGRP_VOID - -/* Define to `int' if doesn't define. */ -#undef gid_t - -/* Define if you don't have vprintf but do have _doprnt. */ -#undef HAVE_DOPRNT - -/* Define if you support file names longer than 14 characters. */ -#undef HAVE_LONG_FILE_NAMES - -/* Define if you have that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define if you have . */ -#undef HAVE_VFORK_H - -/* Define if you have the vprintf function. */ -#undef HAVE_VPRINTF - -/* Define to `int' if doesn't define. */ -#undef mode_t - -/* Define to `int' if doesn't define. */ -#undef pid_t - -/* Define if the `setpgrp' function takes no argument. */ -#undef SETPGRP_VOID - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to `int' if doesn't define. */ -#undef uid_t - -/* Define vfork as fork if vfork does not work. */ -#undef vfork - -/* define if your C compiler lacks a built-in `bool' type */ -#undef bool - -/* define to `int' if your system lacks `ssize_t' */ -#undef ssize_t - -/* - Define if you have the `sig_t' type in or - (e.g., FreeBSD) -*/ -#undef HAVE_SIG_T - -/* - Define if your compiler supports a native "byte" type that holds at least - eight bits. -*/ -#undef HAVE_BYTE_TYPE - -/* Define if you have the getpgrp() function. */ -#undef HAVE_GETPGRP - -/* Define if you have the setpgrp() function. */ -#undef HAVE_SETPGRP - -/* Define if you have the setsid() function. Almost everyone does. */ -#undef HAVE_SETSID - -/* Define if you have the daemon() function. */ -#undef HAVE_DAEMON - -/* Define if you have the basename() function. */ -#undef HAVE_BASENAME - -/* Define if you have */ -#undef HAVE_LIBGEN_H - -/* Define if you have the strerror() function. */ -#undef HAVE_STRERROR - -/* Define if you have initgroups() */ -#undef HAVE_INITGROUPS - -/* Define if you have vfork() */ -#undef HAVE_VFORK - -/* Define if you have vprintf() */ -#undef HAVE_VPRINTF - -/* Define if you have the `pw_comment' field in `struct passwd' (pwd.h) */ -#undef HAVE_PW_COMMENT - -/* Define if you have the `pw_gecos' field in `struct passwd' (pwd.h) */ -#undef HAVE_PW_GECOS - -/* Define to `int' if you don't have `mode_t' */ -#undef mode_t - -/* Define to `int' if you don't have `pid_t' */ -#undef pid_t - -/* Define to `int' if you don't have `gid_t' and `uid_t' */ -#undef uid_t -#undef gid_t - -/* Define to `unsigned' if you don't have `size_t' */ -#undef size_t - -/* Define if you have the header file. */ -#undef HAVE_ERRNO_H - -/* Define if you have the setenv(3) function. */ -#undef HAVE_SETENV - -/* Define if you have the flock(3) function. */ -#undef HAVE_FLOCK - -/*****************************************************************************\ - DON'T TOUCH ANYTHING BELOW HERE! -\*****************************************************************************/ - -#ifndef HAVE_BYTE_TYPE -typedef unsigned char byte; /* 8 bit unsigned critter */ -#endif /* HAVE_BYTE_TYPE */ - -#ifndef HAVE_SIG_T -typedef void __sighandler_t (int); -typedef __sighandler_t *sig_t; -#endif /* HAVE_SIG_T */ - -#ifndef HAVE_FALSE -#define FALSE (0) -#endif /* FALSE */ - -#ifndef HAVE_TRUE -#define TRUE (1) -#endif /* TRUE */ - -#ifndef HAVE_SETSID -#define setsid() ((pid_t) -1) -#endif /* HAVE_SETSID */ - -#ifndef HAVE_SYSCONF -#define sysconf(name) ((long) -1) -#endif /* HAVE_SYSCONF */ - -#ifndef HAVE_INITGROUPS -#define initgroups(name, gid) (0) -#endif - -#ifndef HAVE_STRERROR -extern char *strerror (int errnum); -#endif /* HAVE_STRERROR */ - -extern int x_getopt (int argc, char **argv, const char *opts); -extern int x_opterr; -extern int x_optind; -extern int x_optopt; -extern char *x_optarg; - -#ifndef HAVE_DAEMON -extern int daemon (int nochdir, int noclose); -#endif - -#ifdef HAVE_VFORK -#ifdef HAVE_VFORK_H -#include -#endif -#else /* HAVE_VFORK */ -#undef vfork -#define vfork fork -#endif /* HAVE_VFORK */ - -#ifdef HAVE_ERRNO_H -#include -#else -extern int errno; -#endif - -#ifndef HAVE_SETENV -extern int setenv(const char *name, const char *value, int overwrite); -#endif - -#ifndef STDC_HEADERS -#error "Must have standard C headers. Sorry." -#endif - -/* - Password field: If only one of `pw_comment' and `pw_gecos' is present, - define the missing one in terms of the existing one. If neither is - present, define both in terms of `pw_name'. -*/ -#if !defined(HAVE_PW_COMMENT) && !defined(HAVE_PW_GECOS) -#define pw_comment pw_name -#define pw_gecos pw_name -#else -#if defined(HAVE_PW_COMMENT) && !defined(HAVE_PW_GECOS) -#define pw_gecos pw_comment -#else -#if defined(HAVE_PW_GECOS) && !defined(HAVE_PW_COMMENT) -#define pw_comment pw_gecos -#endif -#endif -#endif - -#include -#if HAVE_SYS_WAIT_H -# include -#endif -#ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) -#endif -#ifndef WIFEXITED -# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif - -#ifndef HAVE_BASENAME -extern char *basename (char *path); -#endif - -#ifdef HAVE_LIBGEN_H -#include -#endif - -#ifndef HAVE_FLOCK -#include "flock.h" -#endif - -#endif /* _CONFIG_H_ */ diff --git a/configure.in b/configure.ac similarity index 93% rename from configure.in rename to configure.ac index 49becf3..285d8b8 100644 --- a/configure.in +++ b/configure.ac @@ -36,7 +36,27 @@ dnl Process this file with autoconf to produce a configure script. dnl --------------------------------------------------------------------------- AC_INIT(daemonize.c) -AC_CONFIG_HEADER(config.h) +AC_CONFIG_HEADER(auto_config.h) + +dnl --------------------------------------------------------------------------- +dnl Autoconf template +dnl --------------------------------------------------------------------------- + +AH_TEMPLATE([HAVE_BASENAME]) +AH_TEMPLATE([HAVE_FLOCK]) +AH_TEMPLATE([HAVE_GETPGRP]) +AH_TEMPLATE([HAVE_INITGROUPS]) +AH_TEMPLATE([HAVE_PW_COMMENT]) +AH_TEMPLATE([HAVE_PW_GECOS]) +AH_TEMPLATE([HAVE_SETENV]) +AH_TEMPLATE([HAVE_SETPGRP]) +AH_TEMPLATE([bool]) +AH_TEMPLATE([HAVE_DAEMON]) +AH_TEMPLATE([HAVE_FALSE]) +AH_TEMPLATE([HAVE_SETSID]) +AH_TEMPLATE([HAVE_SIG_T]) +AH_TEMPLATE([HAVE_STRERROR]) +AH_TEMPLATE([HAVE_TRUE]) dnl --------------------------------------------------------------------------- dnl Directories and package-specific vars