aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-02-17 17:30:55 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-02-17 17:30:55 +0200
commit644cf10bb7ba4d4a349dc0a31836d5cbbf247eb9 (patch)
treef935dbfc92e94f7363d691d87624a7b2fa380216
parent6cfe6f8fe1b7506e772403fecc9d7298fc52dc74 (diff)
downloadwydawca-644cf10bb7ba4d4a349dc0a31836d5cbbf247eb9.tar.gz
wydawca-644cf10bb7ba4d4a349dc0a31836d5cbbf247eb9.tar.bz2
Fix library autodetection
-rw-r--r--acinclude.m491
-rw-r--r--configure.ac8
2 files changed, 46 insertions, 53 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index eb82717..8a5368f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,34 +1,17 @@
-dnl This file is part of GSC
-dnl Copyright (C) 2007 Sergey Poznyakoff
-dnl
-dnl GSC is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 3, or (at your option)
-dnl any later version.
-dnl
-dnl GSC is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with GSC. If not, see <http://www.gnu.org/licenses/>.
-
-dnl MU_RESULT_ACTIONS -- generate shell code for the result of a test
-dnl $1 -- CVAR -- cache variable to check
-dnl $2 -- NAME -- if not empty, used to generate a default value TRUE:
-dnl `AC_DEFINE(HAVE_NAME)'
-dnl $2 -- TRUE -- what to do if the CVAR is not `no'
-dnl $3 -- FALSE -- what to do otherwise; defaults to `:'
-dnl
-AC_DEFUN([MU_RESULT_ACTIONS], [
-[if test "$$1" != "" -a "$$1" != no; then
- ]ifelse([$3], ,
- [AC_DEFINE(HAVE_]translit($2, [a-z ./<>], [A-Z___])[,1,[FIXME])],
- [$3])[
-else
- ]ifelse([$4], , [:], [$4])[
-fi]])dnl
+# Copyright (C) 2001, 2006, 2008, 2009 Sergey Poznyakoff
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
dnl Arguments:
dnl $1 -- Library to look for
@@ -37,21 +20,31 @@ dnl $3 -- Any additional libraries that might be needed
dnl $4 -- Action to be taken when test succeeds
dnl $5 -- Action to be taken when test fails
dnl $6 -- Directories where the library may reside
-AC_DEFUN([MU_CHECK_LIB],
-[
- save_LIBS=$LIBS
- AC_CACHE_CHECK([for -l$1], mu_cv_lib_$1,
- [
- for path in $6
- do
- LIBS="$save_LIBS -L$path"
- unset ac_cv_lib_$1_$2
- AC_CHECK_LIB($1, $2,
- [mu_cv_lib_$1="$3 -L$path -l$1"
- break],
- [mu_cv_lib_$1=no],$3)
- done
- ])
- MU_RESULT_ACTIONS([mu_cv_lib_$1],[LIB$1],[$4],[$5])
- LIBS=$save_LIBS
-])
+AC_DEFUN([WD_CHECK_LIB],
+[m4_ifval([$4], , [AH_CHECK_LIB([$1])])dnl
+AS_VAR_PUSHDEF([wd_Lib], [wd_cv_lib_$1])dnl
+AC_CACHE_CHECK([for $2 in -l$1], [wd_Lib],
+[AS_VAR_SET([wd_Lib], [no])
+ wd_check_lib_save_LIBS=$LIBS
+ for path in "" $6
+ do
+ if test -n "$path"; then
+ wd_ldflags="-L$path -l$1 $3"
+ else
+ wd_ldflags="-l$1 $3"
+ fi
+ LIBS="$wd_ldflags $wd_check_lib_save_LIBS"
+ AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
+ [AS_VAR_SET([wd_Lib], ["$wd_ldflags"])
+ break])
+ done
+ LIBS=$wd_check_lib_save_LIBS])
+AS_IF([test "AS_VAR_GET([wd_Lib])" != no],
+ [m4_default([$4], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
+ LIBS="-l$1 $LIBS"
+])],
+ [$5])dnl
+AS_VAR_POPDEF([wd_Lib])dnl
+])# WD_CHECK_LIB
+
+
diff --git a/configure.ac b/configure.ac
index d72e815..412fa32 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,11 +85,11 @@ AM_GNU_MAILUTILS(2.0, [mailer], [:])
AC_SUBST(SQLLIB)
AH_TEMPLATE(HAVE_MYSQL,[Define if you have libmysql])
-MU_CHECK_LIB(mysqlclient,
+WD_CHECK_LIB(mysqlclient,
mysql_real_connect,
[-lm],
[ AC_DEFINE(HAVE_MYSQL)
- SQLLIB="$mu_cv_lib_mysqlclient" ],
+ SQLLIB="$wd_cv_lib_mysqlclient" ],
[ AC_MSG_FAILURE([The requested library libmysqlclient is not found or is unusable])],
[/usr/lib/mysql /usr/local/lib/mysql])
@@ -101,8 +101,8 @@ AC_SUBST(GPGMELIB)
AH_TEMPLATE(HAVE_GPGME,[Define if you have gpgme])
AC_CHECK_HEADERS(gpgme.h)
-MU_CHECK_LIB([gpgme],[main],[],
- [GPGMELIB="$mu_cv_lib_gpgme"
+WD_CHECK_LIB([gpgme],[main],[],
+ [GPGMELIB="$wd_cv_lib_gpgme"
AC_DEFINE(HAVE_GPGME) ],
[ AC_MSG_FAILURE([The requested library libgpgme is not found or is unusable])],
[/usr/pkg/lib /opt/lib /sw/lib])

Return to:

Send suggestions and report system problems to the System administrator.