]> git.notmuchmail.org Git - notmuch/blobdiff - configure
configure: Use pkg-config --exists rather than --modversion
[notmuch] / configure
index 1ae717aea7b8107e2cbb6938bf6bd9df7ef619ca..fba075dd0e8a16371ba7c0e42cb2915b5dbeaeea 100755 (executable)
--- a/configure
+++ b/configure
@@ -220,7 +220,7 @@ fi
 printf "Checking for GMime development files... "
 have_gmime=0
 for gmimepc in gmime-2.6 gmime-2.4; do
-    if pkg-config --modversion $gmimepc > /dev/null 2>&1; then
+    if pkg-config --exists $gmimepc; then
        printf "Yes ($gmimepc).\n"
        have_gmime=1
        gmime_cflags=$(pkg-config --cflags $gmimepc)
@@ -233,7 +233,7 @@ if [ "$have_gmime" = "0" ]; then
 fi
 
 printf "Checking for talloc development files... "
-if pkg-config --modversion talloc > /dev/null 2>&1; then
+if pkg-config --exists talloc; then
     printf "Yes.\n"
     have_talloc=1
     talloc_cflags=$(pkg-config --cflags talloc)
@@ -246,7 +246,7 @@ else
 fi
 
 printf "Checking for valgrind development files... "
-if pkg-config --modversion valgrind > /dev/null 2>&1; then
+if pkg-config --exists valgrind; then
     printf "Yes.\n"
     have_valgrind=1
     valgrind_cflags=$(pkg-config --cflags valgrind)
@@ -256,7 +256,7 @@ else
 fi
 
 if [ -z "${EMACSLISPDIR}" ]; then
-    if pkg-config --modversion emacs > /dev/null 2>&1; then
+    if pkg-config --exists emacs; then
        EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
     else
        EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
@@ -399,6 +399,17 @@ then
     rpath_ldflags="-Wl,--enable-new-dtags -Wl,-rpath,\$(libdir)"
 else
     printf "No (nothing to worry about).\n"
+    rpath_ldflags=""
+fi
+
+printf "Checking for -Wl,--as-needed... "
+if ${CC} -Wl,--as-needed -o minimal minimal.c >/dev/null 2>&1
+then
+    printf "Yes.\n"
+    as_needed_ldflags="-Wl,--as-needed"
+else
+    printf "No (nothing to worry about).\n"
+    as_needed_ldflags=""
 fi
 
 WARN_CXXFLAGS=""
@@ -534,6 +545,9 @@ TALLOC_LDFLAGS = ${talloc_ldflags}
 # Flags needed to have linker set rpath attribute
 RPATH_LDFLAGS = ${rpath_ldflags}
 
+# Flags needed to have linker link only to necessary libraries
+AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
+
 # Whether valgrind header files are available
 HAVE_VALGRIND = ${have_valgrind}