diff --git a/checkin_notes b/checkin_notes index 9709b1e650..f23f097a63 100755 --- a/checkin_notes +++ b/checkin_notes @@ -13902,3 +13902,12 @@ Rom June 17 2004 - Tag for 3.13 release, all platforms boinc_core_release_3_13 +Daniel 17 June 2004 + - Determine utmp location at compile time + + config.h.in + configure + configure.ac + client/ + hostinfo_unix.C + diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index b510808ac0..b1b98f5d1e 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -445,14 +445,14 @@ static struct utmp ut; struct utmp *getutent() { if (ufp == NULL) { -#if defined(HAVE__ETC_UTMP) - if ((ufp = fopen("/etc/utmp", "r")) == NULL) { -#elif defined(HAVE__VAR_RUN_UTMP) - if ((ufp = fopen("/var/run/utmp", "r")) == NULL) { -#elif defined(HAVE__RUN_ADM_UTMP) - if ((ufp = fopen("/var/adm/utmp", "r")) == NULL) { -#else +#if defined(UTMP_LOCATION) + if ((ufp = fopen(UTMP_LOCATION, "r")) == NULL) { +#elif defined(UTMP_FILE) if ((ufp = fopen(UTMP_FILE, "r")) == NULL) { +#elif defined(_PATH_UTMP) + if ((ufp = fopen(_PATH_UTMP, "r")) == NULL) { +#else + if ((ufp = fopen("/etc/utmp", "r")) == NULL) { #endif return((struct utmp *)NULL); } diff --git a/config.h.in b/config.h.in index 13e0bca1ac..847b24c886 100644 --- a/config.h.in +++ b/config.h.in @@ -296,15 +296,6 @@ /* Define to 1 if /dev/tty1 exists */ #undef HAVE__DEV_TTY1 -/* Define to 1 if you have the file `AC_File'. */ -#undef HAVE__ETC_UTMP - -/* Define to 1 if you have the file `AC_File'. */ -#undef HAVE__VAR_ADM_UTMP - -/* Define to 1 if you have the file `AC_File'. */ -#undef HAVE__VAR_RUN_UTMP - /* Host for this compilation */ #undef HOSTTYPE @@ -348,6 +339,9 @@ /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME +/* utmp file location */ +#undef UTMP_LOCATION + /* Version number of package */ #undef VERSION diff --git a/configure b/configure index afa13d3d2a..379b498438 100755 --- a/configure +++ b/configure @@ -7774,82 +7774,18 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for /var/run/utmp" >&5 -echo $ECHO_N "checking for /var/run/utmp... $ECHO_C" >&6 -if test "${ac_cv_file__var_run_utmp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - test "$cross_compiling" = yes && - { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 -echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} - { (exit 1); exit 1; }; } -if test -r "/var/run/utmp"; then - ac_cv_file__var_run_utmp=yes -else - ac_cv_file__var_run_utmp=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_file__var_run_utmp" >&5 -echo "${ECHO_T}$ac_cv_file__var_run_utmp" >&6 -if test $ac_cv_file__var_run_utmp = yes; then +for f in /etc/utmp /var/adm/utmp /var/run/utmp; do + if test -f $f; then + utmp_file=$f + fi +done +if test -n "$utmp_file"; then cat >>confdefs.h <<_ACEOF -#define HAVE__VAR_RUN_UTMP 1 +#define UTMP_LOCATION "$utmp_file" _ACEOF - fi -echo "$as_me:$LINENO: checking for /var/adm/utmp" >&5 -echo $ECHO_N "checking for /var/adm/utmp... $ECHO_C" >&6 -if test "${ac_cv_file__var_adm_utmp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - test "$cross_compiling" = yes && - { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 -echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} - { (exit 1); exit 1; }; } -if test -r "/var/adm/utmp"; then - ac_cv_file__var_adm_utmp=yes -else - ac_cv_file__var_adm_utmp=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_file__var_adm_utmp" >&5 -echo "${ECHO_T}$ac_cv_file__var_adm_utmp" >&6 -if test $ac_cv_file__var_adm_utmp = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE__VAR_ADM_UTMP 1 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking for /etc/utmp" >&5 -echo $ECHO_N "checking for /etc/utmp... $ECHO_C" >&6 -if test "${ac_cv_file__etc_utmp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - test "$cross_compiling" = yes && - { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 -echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} - { (exit 1); exit 1; }; } -if test -r "/etc/utmp"; then - ac_cv_file__etc_utmp=yes -else - ac_cv_file__etc_utmp=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_file__etc_utmp" >&5 -echo "${ECHO_T}$ac_cv_file__etc_utmp" >&6 -if test $ac_cv_file__etc_utmp = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE__ETC_UTMP 1 -_ACEOF - - -fi - if test -e "/dev/mouse"; then diff --git a/configure.ac b/configure.ac index d3bffd9d22..3373a0bcec 100644 --- a/configure.ac +++ b/configure.ac @@ -120,7 +120,15 @@ AC_TYPE_SIZE_T AC_STRUCT_TM AC_STRUCT_TIMEZONE -AC_CHECK_FILES(/var/run/utmp /var/adm/utmp /etc/utmp) +dnl utmp file location +for f in /etc/utmp /var/adm/utmp /var/run/utmp; do + if test -f $f; then + utmp_file=$f + fi +done +if test -n "$utmp_file"; then + AC_DEFINE_UNQUOTED(UTMP_LOCATION, "$utmp_file", utmp file location) +fi dnl Checks for device files if test -e "/dev/mouse"; then