Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ INSTALL_MAN = $(INSTALL_PREFIX)/share/man
MISSING_SOURCES = @LOCAL_MISSING_SOURCES@
MISSING_OBJECTS = $(MISSING_SOURCES:.c=.o)
CC = @CC@

PAM_LIBS = @PAM_LIBS@
.PHONY: all psman install clean distclean

.c.o:
Expand All @@ -22,7 +22,7 @@ CC = @CC@
all: daemonize

daemonize: daemonize.o getopt.o $(MISSING_OBJECTS)
$(CC) $(CFLAGS) -o daemonize daemonize.o getopt.o $(MISSING_OBJECTS)
$(CC) $(CFLAGS) -o daemonize daemonize.o getopt.o $(MISSING_OBJECTS) $(PAM_LIBS)

testdaemon: testdaemon.o
$(CC) $(CFLAGS) -o testdaemon testdaemon.o
Expand Down
6 changes: 6 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
/* Define if you have the flock(3) function. */
#undef HAVE_FLOCK

/* Define to 1 if you have the `libpam,libpam_misc' library (-lpam,-lpam_misc). */
#undef HAVE_PAM

/* PAM support. */
#undef WITH_PAM

/*****************************************************************************\
DON'T TOUCH ANYTHING BELOW HERE!
\*****************************************************************************/
Expand Down
213 changes: 167 additions & 46 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,13 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
LOCAL_MISSING_SOURCES
PAM_LIBS
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
EGREP
GREP
DAEMONIZE_LIBS
CPP
OBJEXT
EXEEXT
Expand Down Expand Up @@ -676,6 +678,7 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
with_pam
'
ac_precious_vars='build_alias
host_alias
Expand Down Expand Up @@ -1289,6 +1292,11 @@ if test -n "$ac_init_help"; then

cat <<\_ACEOF

Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-pam enable PAM support

Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
Expand Down Expand Up @@ -1614,6 +1622,52 @@ $as_echo "$ac_res" >&6; }

} # ac_fn_c_check_header_compile

# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval

} # ac_fn_c_try_link

# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
# -------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
Expand Down Expand Up @@ -1668,52 +1722,6 @@ $as_echo "$ac_res" >&6; }

} # ac_fn_c_check_type

# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval

} # ac_fn_c_try_link

# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
Expand Down Expand Up @@ -3072,6 +3080,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu




{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
if ${ac_cv_path_GREP+:} false; then :
Expand Down Expand Up @@ -3701,6 +3710,118 @@ export CPPFLAGS



# Check whether --with-pam was given.
if test "${with_pam+set}" = set; then :
withval=$with_pam;
else
with_pam=no
fi

if test "x$with_pam" = xyes; then
LIBS_save=$LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5
$as_echo_n "checking for pam_start in -lpam... " >&6; }
if ${ac_cv_lib_pam_pam_start+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpam $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pam_start ();
int
main ()
{
return pam_start ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pam_pam_start=yes
else
ac_cv_lib_pam_pam_start=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_start" >&5
$as_echo "$ac_cv_lib_pam_pam_start" >&6; }
if test "x$ac_cv_lib_pam_pam_start" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPAM 1
_ACEOF

LIBS="-lpam $LIBS"

else
as_fn_error $? "PAM selected but libpam not found" "$LINENO" 5
fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for misc_conv in -lpam_misc" >&5
$as_echo_n "checking for misc_conv in -lpam_misc... " >&6; }
if ${ac_cv_lib_pam_misc_misc_conv+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpam_misc $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char misc_conv ();
int
main ()
{
return misc_conv ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pam_misc_misc_conv=yes
else
ac_cv_lib_pam_misc_misc_conv=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_misc_misc_conv" >&5
$as_echo "$ac_cv_lib_pam_misc_misc_conv" >&6; }
if test "x$ac_cv_lib_pam_misc_misc_conv" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPAM_MISC 1
_ACEOF

LIBS="-lpam_misc $LIBS"

else
as_fn_error $? "PAM selected but libpam_misc not found" "$LINENO" 5
fi

LIBS=$LIBS_save
PAM_LIBS="-lpam -lpam_misc"

$as_echo "#define WITH_PAM 1 " >>confdefs.h

fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
if ${ac_cv_c_const+:} false; then :
Expand Down
20 changes: 19 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ dnl Autoconf file for daemonize
dnl
dnl Process this file with autoconf to produce a configure script.
dnl ---------------------------------------------------------------------------

AC_INIT(daemonize.c)
AC_CONFIG_HEADER(config.h)

Expand All @@ -53,6 +52,7 @@ AC_PROG_CPP

AC_SUBST(CC)
AC_SUBST(CPP)
AC_SUBST(DAEMONIZE_LIBS)

dnl ---------------------------------------------------------------------------
dnl UNIX variant hacks
Expand Down Expand Up @@ -81,6 +81,24 @@ dnl ---------------------------------------------------------------------------
dnl Checks for libraries.
dnl ---------------------------------------------------------------------------

dnl check the existance of the libpam and libpam_misc
AC_ARG_WITH([pam],
AS_HELP_STRING([--with-pam], [enable PAM support]),
[], [with_pam=no])
if test "x$with_pam" = xyes; then
LIBS_save=$LIBS
AC_CHECK_LIB(pam, pam_start,
[],
AC_MSG_ERROR([PAM selected but libpam not found]))
AC_CHECK_LIB(pam_misc, misc_conv,
[],
AC_MSG_ERROR([PAM selected but libpam_misc not found]))
LIBS=$LIBS_save
PAM_LIBS="-lpam -lpam_misc"
AC_DEFINE(WITH_PAM, [1] ,[PAM support.])
fi
AC_SUBST([PAM_LIBS])

dnl ---------------------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ---------------------------------------------------------------------------
Expand Down
Loading