aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-10-30 16:52:27 +1000
committerSteve Bennett <steveb@workware.net.au>2010-10-30 20:07:28 +1000
commit960fbf0c9b6cbea1980dc47167b191d6783376dd (patch)
tree0a664da8561f97d8bcb8c580f3342a9f4661e07f
parent8016c1d53332b9ad2af8e49482f7848648995a89 (diff)
downloadjimtcl-960fbf0c9b6cbea1980dc47167b191d6783376dd.zip
jimtcl-960fbf0c9b6cbea1980dc47167b191d6783376dd.tar.gz
jimtcl-960fbf0c9b6cbea1980dc47167b191d6783376dd.tar.bz2
Don't search for libs that aren't required
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rwxr-xr-xconfigure93
-rwxr-xr-xconfigure.ac87
2 files changed, 114 insertions, 66 deletions
diff --git a/configure b/configure
index 10a7e27..4e8d758 100755
--- a/configure
+++ b/configure
@@ -3763,7 +3763,51 @@ fi
done
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
+# needs_xxx="yyy zzz" means that extension xxx needs environment variables $yyy and $zzz
+# to not be "no"
+# dep_xxx="yyy zzz" means that if xxx is selected, so is yyy and zzz
+# libs_xxx="yyy zzz" means that if xxx is selected, libs yyy and zzz may be required
+libs_aio="socket"
+needs_regexp="ac_cv_func_regcomp"
+needs_syslog="ac_cv_func_syslog"
+needs_exec="ac_cv_func_vfork"
+needs_readdir="ac_cv_func_opendir"
+dep_glob="readdir"
+needs_posix="ac_cv_func_waitpid"
+needs_load="have_dlopen"
+libs_load="dl"
+needs_signal="ac_cv_func_sigaction ac_cv_func_vfork"
+needs_readline="ac_cv_search_readline"
+dep_rlprompt="readline"
+libs_readline="readline"
+needs_sqlite="ac_cv_search_sqlite_open"
+libs_sqlite="sqlite"
+needs_sqlite3="ac_cv_search_sqlite3_open"
+libs_sqlite3="sqlite3"
+needs_win32="iswin"
+
+for i in $ext_default $with_jim_ext; do
+ in_list "$i" "$with_out_jim_ext" && continue
+ eval "dep=\$dep_$i"
+ test -z "$dep" && continue
+ with_jim_ext="$with_jim_ext $dep"
+done
+for i in $with_jim_extmod; do
+ eval "dep=\$dep_$i"
+ test -z "$dep" && continue
+ for d in $dep; do
+ in_list "$d" "$with_jim_ext" || with_jim_extmod="$with_jim_extmod $d"
+ done
+done
+
+for i in $ext_default $with_jim_ext $with_jim_extmod; do
+ in_list "$i" "$with_out_jim_ext" && continue
+ eval "libs=\$libs_$i"
+ needed_libs="$needed_libs $libs"
+done
+
+if in_list dl "$needed_libs"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
$as_echo_n "checking for library containing dlopen... " >&6; }
if ${ac_cv_search_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
@@ -3821,7 +3865,9 @@ $as_echo "#define HAVE_DLOPEN 1" >>confdefs.h
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing readline" >&5
+fi
+if in_list readline "$needed_libs"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing readline" >&5
$as_echo_n "checking for library containing readline... " >&6; }
if ${ac_cv_search_readline+:} false; then :
$as_echo_n "(cached) " >&6
@@ -3879,7 +3925,9 @@ $as_echo "#define HAVE_READLINE 1" >>confdefs.h
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqlite_open" >&5
+fi
+if in_list sqlite "$needed_libs"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqlite_open" >&5
$as_echo_n "checking for library containing sqlite_open... " >&6; }
if ${ac_cv_search_sqlite_open+:} false; then :
$as_echo_n "(cached) " >&6
@@ -3937,7 +3985,9 @@ $as_echo "#define HAVE_SQLITE 1" >>confdefs.h
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqlite3_open" >&5
+fi
+if in_list sqlite3 "$needed_libs"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqlite3_open" >&5
$as_echo_n "checking for library containing sqlite3_open... " >&6; }
if ${ac_cv_search_sqlite3_open+:} false; then :
$as_echo_n "(cached) " >&6
@@ -3995,8 +4045,9 @@ $as_echo "#define HAVE_SQLITE3 1" >>confdefs.h
fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5
+fi
+if in_list socket "$needed_libs"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5
$as_echo_n "checking for library containing socket... " >&6; }
if ${ac_cv_search_socket+:} false; then :
$as_echo_n "(cached) " >&6
@@ -4052,6 +4103,7 @@ if test "$ac_res" != no; then :
fi
+fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking environ declared in unistd.h?" >&5
$as_echo_n "checking environ declared in unistd.h?... " >&6; }
@@ -4087,35 +4139,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# - If no, error if it is enabled, or do nothing otherwise
# - Modules may be either C or Tcl
-needs_regexp="ac_cv_func_regcomp"
-needs_syslog="ac_cv_func_syslog"
-needs_exec="ac_cv_func_vfork"
-needs_readdir="ac_cv_func_opendir"
-dep_glob="readdir"
-needs_posix="ac_cv_func_waitpid"
-needs_load="have_dlopen"
-needs_signal="ac_cv_func_sigaction ac_cv_func_vfork"
-needs_readline="ac_cv_search_readline"
-dep_rlprompt="readline"
-needs_sqlite="ac_cv_search_sqlite_open"
-needs_sqlite3="ac_cv_search_sqlite3_open"
-needs_win32="iswin"
-
-# First handle dependencies. If an extension is enabled, also enable its dependency
-for i in $ext_default $with_jim_ext; do
- in_list "$i" "$with_out_jim_ext" && continue
- eval "dep=\$dep_$i"
- test -z "$dep" && continue
- with_jim_ext="$with_jim_ext $dep"
-done
-for i in $with_jim_extmod; do
- eval "dep=\$dep_$i"
- test -z "$dep" && continue
- for d in $dep; do
- in_list "$d" "$with_jim_ext" || with_jim_extmod="$with_jim_extmod $d"
- done
-done
-
for i in $ext_all; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking extension $i" >&5
$as_echo_n "checking extension $i... " >&6; }
diff --git a/configure.ac b/configure.ac
index b8b1705..41bfd79 100755
--- a/configure.ac
+++ b/configure.ac
@@ -173,36 +173,11 @@ AC_CHECK_FUNCS([backtrace geteuid mkstemp realpath strptime])
AC_CHECK_FUNCS([regcomp waitpid sigaction sys_signame sys_siglist])
AC_CHECK_FUNCS([syslog opendir readlink sleep usleep pipe inet_ntop getaddrinfo])
-dnl XXX: Don't need to search for libs if the corresponding extensions aren't enabled
-AC_SEARCH_LIBS(dlopen, dl, have_dlopen=yes; AC_DEFINE([HAVE_DLOPEN],[1],[Have the dlopen function]))
-AC_SEARCH_LIBS(readline, readline, AC_DEFINE([HAVE_READLINE],[1],[Have libreadline]))
-AC_SEARCH_LIBS(sqlite_open, sqlite, AC_DEFINE([HAVE_SQLITE],[1],[Have libsqlite]))
-AC_SEARCH_LIBS(sqlite3_open, sqlite3, AC_DEFINE([HAVE_SQLITE3],[1],[Have libsqlite3]))
-
-AC_SEARCH_LIBS(socket, socket)
-
-dnl Look for environ. If it is declared in unistd, no need to declare it
-AC_MSG_CHECKING([environ declared in unistd.h?])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-#define _GNU_SOURCE
-#include <unistd.h>
-int main(int argc, char **argv) { char **ep = environ; }
- ]])], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(NO_ENVIRON_EXTERN, [1], [No need to declare extern 'environ'.])
- ],
- AC_MSG_RESULT([no])
-)
-
-# Now that we know what the platform supports:
-
-# For all known extensions:
-# - If it is disabled, remove it
-# - Otherwise, check to see if it's pre-requisites are met
-# - If yes, add it if it is enabled or is a default
-# - If no, error if it is enabled, or do nothing otherwise
-# - Modules may be either C or Tcl
-
+# needs_xxx="yyy zzz" means that extension xxx needs environment variables $yyy and $zzz
+# to not be "no"
+# dep_xxx="yyy zzz" means that if xxx is selected, so is yyy and zzz
+# libs_xxx="yyy zzz" means that if xxx is selected, libs yyy and zzz may be required
+libs_aio="socket"
needs_regexp="ac_cv_func_regcomp"
needs_syslog="ac_cv_func_syslog"
needs_exec="ac_cv_func_vfork"
@@ -210,14 +185,18 @@ needs_readdir="ac_cv_func_opendir"
dep_glob="readdir"
needs_posix="ac_cv_func_waitpid"
needs_load="have_dlopen"
+libs_load="dl"
needs_signal="ac_cv_func_sigaction ac_cv_func_vfork"
needs_readline="ac_cv_search_readline"
dep_rlprompt="readline"
+libs_readline="readline"
needs_sqlite="ac_cv_search_sqlite_open"
+libs_sqlite="sqlite"
needs_sqlite3="ac_cv_search_sqlite3_open"
+libs_sqlite3="sqlite3"
needs_win32="iswin"
-# First handle dependencies. If an extension is enabled, also enable its dependency
+dnl First handle dependencies. If an extension is enabled, also enable its dependency
for i in $ext_default $with_jim_ext; do
in_list "$i" "$with_out_jim_ext" && continue
eval "dep=\$dep_$i"
@@ -234,6 +213,52 @@ for i in $with_jim_extmod; do
done
done
+dnl Now what libraries may we need?
+for i in $ext_default $with_jim_ext $with_jim_extmod; do
+ in_list "$i" "$with_out_jim_ext" && continue
+ eval "libs=\$libs_$i"
+ needed_libs="$needed_libs $libs"
+done
+
+dnl Don't need to search for libs if the corresponding extensions aren't enabled
+if in_list dl "$needed_libs"; then
+ AC_SEARCH_LIBS(dlopen, dl, have_dlopen=yes; AC_DEFINE([HAVE_DLOPEN],[1],[Have the dlopen function]))
+fi
+if in_list readline "$needed_libs"; then
+ AC_SEARCH_LIBS(readline, readline, AC_DEFINE([HAVE_READLINE],[1],[Have libreadline]))
+fi
+if in_list sqlite "$needed_libs"; then
+ AC_SEARCH_LIBS(sqlite_open, sqlite, AC_DEFINE([HAVE_SQLITE],[1],[Have libsqlite]))
+fi
+if in_list sqlite3 "$needed_libs"; then
+ AC_SEARCH_LIBS(sqlite3_open, sqlite3, AC_DEFINE([HAVE_SQLITE3],[1],[Have libsqlite3]))
+fi
+if in_list socket "$needed_libs"; then
+ AC_SEARCH_LIBS(socket, socket)
+fi
+
+dnl Look for environ. If it is declared in unistd, no need to declare it
+AC_MSG_CHECKING([environ declared in unistd.h?])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#define _GNU_SOURCE
+#include <unistd.h>
+int main(int argc, char **argv) { char **ep = environ; }
+ ]])], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(NO_ENVIRON_EXTERN, [1], [No need to declare extern 'environ'.])
+ ],
+ AC_MSG_RESULT([no])
+)
+
+# Now that we know what the platform supports:
+
+# For all known extensions:
+# - If it is disabled, remove it
+# - Otherwise, check to see if it's pre-requisites are met
+# - If yes, add it if it is enabled or is a default
+# - If no, error if it is enabled, or do nothing otherwise
+# - Modules may be either C or Tcl
+
for i in $ext_all; do
AC_MSG_CHECKING(extension $i)
# Disabled?