Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit eb01a27

Browse files
committed
Use AC_SEARCH_LIBS for finding proper systemd library. (which is called libsystemd on most Linuxes, but libsystemd-daemon on Alt Linux SPT 7 and Debian Wheezy)
1 parent f4a0c7a commit eb01a27

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed

configure

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11187,6 +11187,64 @@ else
1118711187
fi
1118811188

1118911189

11190+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sd_notify" >&5
11191+
$as_echo_n "checking for library containing sd_notify... " >&6; }
11192+
if ${ac_cv_search_sd_notify+:} false; then :
11193+
$as_echo_n "(cached) " >&6
11194+
else
11195+
ac_func_search_save_LIBS=$LIBS
11196+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11197+
/* end confdefs.h. */
11198+
11199+
/* Override any GCC internal prototype to avoid an error.
11200+
Use char because int might match the return type of a GCC
11201+
builtin and then its argument prototype would still apply. */
11202+
#ifdef __cplusplus
11203+
extern "C"
11204+
#endif
11205+
char sd_notify ();
11206+
int
11207+
main ()
11208+
{
11209+
return sd_notify ();
11210+
;
11211+
return 0;
11212+
}
11213+
_ACEOF
11214+
for ac_lib in '' systemd systemd-daemon; do
11215+
if test -z "$ac_lib"; then
11216+
ac_res="none required"
11217+
else
11218+
ac_res=-l$ac_lib
11219+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
11220+
fi
11221+
if ac_fn_c_try_link "$LINENO"; then :
11222+
ac_cv_search_sd_notify=$ac_res
11223+
fi
11224+
rm -f core conftest.err conftest.$ac_objext \
11225+
conftest$ac_exeext
11226+
if ${ac_cv_search_sd_notify+:} false; then :
11227+
break
11228+
fi
11229+
done
11230+
if ${ac_cv_search_sd_notify+:} false; then :
11231+
11232+
else
11233+
ac_cv_search_sd_notify=no
11234+
fi
11235+
rm conftest.$ac_ext
11236+
LIBS=$ac_func_search_save_LIBS
11237+
fi
11238+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sd_notify" >&5
11239+
$as_echo "$ac_cv_search_sd_notify" >&6; }
11240+
ac_res=$ac_cv_search_sd_notify
11241+
if test "$ac_res" != no; then :
11242+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
11243+
11244+
else
11245+
as_fn_error $? "Cannot find systemd library" "$LINENO" 5
11246+
fi
11247+
1119011248
fi
1119111249

1119211250
if test "$with_libxml" = yes ; then

configure.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,7 @@ fi
12821282

12831283
if test "$with_systemd" = yes ; then
12841284
AC_CHECK_HEADER(systemd/sd-daemon.h, [], [AC_MSG_ERROR([header file <systemd/sd-daemon.h> is required for systemd support])])
1285+
AC_SEARCH_LIBS([sd_notify],[systemd systemd-daemon],[],[AC_MSG_ERROR([Cannot find systemd library])])
12851286
fi
12861287

12871288
if test "$with_libxml" = yes ; then

src/backend/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ LIBS := $(filter-out -lpgport -lpgcommon, $(LIBS)) $(LDAP_LIBS_BE) $(ICU_LIBS)
4545
# The backend doesn't need everything that's in LIBS, however
4646
LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS))
4747

48-
ifeq ($(with_systemd),yes)
49-
LIBS += -lsystemd
50-
endif
5148

5249
##########################################################################
5350

0 commit comments

Comments
 (0)