Skip to content

Commit f9581b0

Browse files
committed
simplify pkg-config library checking
rather than invoking pkg-config multiple times to check for libraries, this invokes it just once. the error message before this change (by changing imlib2 to imlib22 in configure.ac): checking for imlib22... no configure: error: Package requirements (imlib22) were not met: pkg-config: could not find package 'imlib22' the error message after this change (by changing imlib2 to imlib22 in deps.pc): checking for ./deps.pc... no configure: error: Package requirements (./deps.pc) were not met: pkg-config: could not find package 'imlib22' so there's no real loss of functionality here. the reason for using `deps.pc` rather than just adding multiple libraries in a single PKG_CHECK_MODULES is to reduce dependency on autoconf. additionally move the _XOPEN_SOURCE flag to deps.pc.
1 parent 2c98fc9 commit f9581b0

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ man_MANS = man/scrot.1
3737

3838
dist_doc_DATA = AUTHORS ChangeLog CONTRIBUTING.md doc/scrot.png FAQ README.md TODO.md
3939

40-
EXTRA_DIST = $(man_MANS) autogen.sh
40+
EXTRA_DIST = $(man_MANS) autogen.sh deps.pc
4141

4242
SUBDIRS = src
4343

configure.ac

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,8 @@ AS_IF([test "x$orig_CFLAGS" = "x"], [
2727
AX_APPEND_LINK_FLAGS(["$SCROT_FLAGS"])
2828
])
2929

30-
AX_APPEND_COMPILE_FLAGS("-D_XOPEN_SOURCE=700L")
31-
3230
# Checks for libraries.
33-
PKG_CHECK_MODULES([X11], [x11])
34-
PKG_CHECK_MODULES([XCOMPOSITE], [xcomposite])
35-
PKG_CHECK_MODULES([XEXT], [xext])
36-
PKG_CHECK_MODULES([XFIXES], [xfixes])
37-
PKG_CHECK_MODULES([XINERAMA], [xinerama])
38-
PKG_CHECK_MODULES([IMLIB2], [imlib2])
31+
PKG_CHECK_MODULES([SCROT_DEPS], ["$srcdir/deps.pc"])
3932

4033
AC_ARG_ENABLE([libbsd-feature-test],
4134
AS_HELP_STRING([--enable-libbsd-feature-test],
@@ -60,10 +53,8 @@ AS_IF([test "x$LIBBSD_NEEDED" = "xyes"], [
6053
[AC_MSG_ERROR([BSD functions not found, libbsd is required])])
6154
])
6255

63-
AC_SUBST([LIBS], ["$X11_LIBS $XCOMPOSITE_LIBS $XEXT_LIBS $XFIXES_LIBS \
64-
$XINERAMA_LIBS $IMLIB2_LIBS $LIBBSD_LIBS $LIBS"])
65-
AC_SUBST([CPPFLAGS], ["$X11_CFLAGS $XCOMPOSITE_CFLAGS $XEXT_CFLAGS \
66-
$XFIXES_CFLAGS $XINERAMA_CFLAGS $IMLIB2_CFLAGS $LIBBSD_CFLAGS $CPPFLAGS"])
56+
AC_SUBST([LIBS], ["$SCROT_DEPS_LIBS $LIBBSD_LIBS $LIBS"])
57+
AC_SUBST([CPPFLAGS], ["$SCROT_DEPS_CFLAGS $LIBBSD_CFLAGS $CPPFLAGS"])
6758

6859
AC_CONFIG_FILES([Makefile src/Makefile])
6960
AC_OUTPUT

deps.pc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Name: scrot's mandatory dependencies
2+
Description: ditto
3+
Version: infinite
4+
Cflags: -D_XOPEN_SOURCE=700L
5+
Requires: x11 imlib2 xcomposite xext xfixes xinerama

0 commit comments

Comments
 (0)