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

Commit 76bab95

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 e4d5af6 commit 76bab95

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
@@ -11302,6 +11302,64 @@ else
1130211302
fi
1130311303

1130411304

11305+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sd_notify" >&5
11306+
$as_echo_n "checking for library containing sd_notify... " >&6; }
11307+
if ${ac_cv_search_sd_notify+:} false; then :
11308+
$as_echo_n "(cached) " >&6
11309+
else
11310+
ac_func_search_save_LIBS=$LIBS
11311+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11312+
/* end confdefs.h. */
11313+
11314+
/* Override any GCC internal prototype to avoid an error.
11315+
Use char because int might match the return type of a GCC
11316+
builtin and then its argument prototype would still apply. */
11317+
#ifdef __cplusplus
11318+
extern "C"
11319+
#endif
11320+
char sd_notify ();
11321+
int
11322+
main ()
11323+
{
11324+
return sd_notify ();
11325+
;
11326+
return 0;
11327+
}
11328+
_ACEOF
11329+
for ac_lib in '' systemd systemd-daemon; do
11330+
if test -z "$ac_lib"; then
11331+
ac_res="none required"
11332+
else
11333+
ac_res=-l$ac_lib
11334+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
11335+
fi
11336+
if ac_fn_c_try_link "$LINENO"; then :
11337+
ac_cv_search_sd_notify=$ac_res
11338+
fi
11339+
rm -f core conftest.err conftest.$ac_objext \
11340+
conftest$ac_exeext
11341+
if ${ac_cv_search_sd_notify+:} false; then :
11342+
break
11343+
fi
11344+
done
11345+
if ${ac_cv_search_sd_notify+:} false; then :
11346+
11347+
else
11348+
ac_cv_search_sd_notify=no
11349+
fi
11350+
rm conftest.$ac_ext
11351+
LIBS=$ac_func_search_save_LIBS
11352+
fi
11353+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sd_notify" >&5
11354+
$as_echo "$ac_cv_search_sd_notify" >&6; }
11355+
ac_res=$ac_cv_search_sd_notify
11356+
if test "$ac_res" != no; then :
11357+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
11358+
11359+
else
11360+
as_fn_error $? "Cannot find systemd library" "$LINENO" 5
11361+
fi
11362+
1130511363
fi
1130611364

1130711365
if test "$with_libxml" = yes ; then

configure.in

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

13041304
if test "$with_systemd" = yes ; then
13051305
AC_CHECK_HEADER(systemd/sd-daemon.h, [], [AC_MSG_ERROR([header file <systemd/sd-daemon.h> is required for systemd support])])
1306+
AC_SEARCH_LIBS([sd_notify],[systemd systemd-daemon],[],[AC_MSG_ERROR([Cannot find systemd library])])
13061307
fi
13071308

13081309
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 -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS))
4747

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

5249
ifeq ($(with_zstd),yes)
5350
LIBS += -lzstd

0 commit comments

Comments
 (0)