소스 검색

* Add --disable-script-tcl (default enabled)

Bryan Drewery 14 년 전
부모
커밋
093a7e020a
7개의 변경된 파일70개의 추가작업 그리고 13개의 파일을 삭제
  1. 8 1
      autotools/configure.ac
  2. 17 2
      autotools/includes/libtcl.m4
  3. 10 0
      config.h.in
  4. 25 0
      configure
  5. 2 2
      src/cmds.c
  6. 7 7
      src/libtcl.c
  7. 1 1
      src/libtcl.h

+ 8 - 1
autotools/configure.ac

@@ -124,7 +124,7 @@ tclheaderpaths="$HOME/include $HOME/tcl/include \
 
 
 # Misc Tcl checks.
-EGG_TCL_ARG_WITH
+EGG_TCL_OPTIONS
 EGG_TCL_ENV
 EGG_TCL_WITH_TCLLIB
 EGG_TCL_WITH_TCLINC
@@ -260,6 +260,13 @@ AH_BOTTOM([/*
 #    endif
 #  endif
 #endif
+
+/* TCL sanity check */
+#ifdef USE_SCRIPT_TCL
+#  ifndef HAVE_LIBTCL
+#    undef USE_SCRIPT_TCL
+#  endif
+#endif
 ])
 
 [

+ 17 - 2
autotools/includes/libtcl.m4

@@ -3,13 +3,28 @@ dnl   macros autoconf uses when building configure from configure.in
 dnl   These are taken from Eggdrop
 dnl
 
-dnl EGG_TCL_ARG_WITH()
+dnl EGG_TCL_OPTIONS()
 dnl
-AC_DEFUN([EGG_TCL_ARG_WITH],
+AC_DEFUN([EGG_TCL_OPTIONS],
 [
   AC_ARG_WITH(tcllib, [AS_HELP_STRING([--with-tcllib=PATH],[full path to Tcl library])], [tcllibname="$withval"])
   AC_ARG_WITH(tclinc, [AS_HELP_STRING([--with-tclinc=PATH],[full path to Tcl header])],  [tclincname="$withval"])
 
+  AC_MSG_CHECKING(whether TCL Script is enabled)
+  AC_ARG_ENABLE(script_tcl,
+    [AS_HELP_STRING([--disable-script-tcl], [disable TCL Script support])],
+    [ enable_script_tcl="yes"
+      AC_MSG_RESULT(no)
+    ],
+    [ enable_script_tcl="no"
+      AC_MSG_RESULT(yes)
+    ]
+  )
+
+  if test "$enable_script_tcl" = "no"; then
+    AC_DEFINE(USE_SCRIPT_TCL, 1, [Define if you want TCL Script support])
+  fi
+
   WARN=0
   # Make sure either both or neither $tcllibname and $tclincname are set
   if test "x$tcllibname" != x; then

+ 10 - 0
config.h.in

@@ -313,6 +313,9 @@
 /* Define if you want ipv6 support */
 #undef USE_IPV6
 
+/* Define if you want TCL Script support */
+#undef USE_SCRIPT_TCL
+
 /* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
@@ -468,3 +471,10 @@
 #  endif
 #endif
 
+/* TCL sanity check */
+#ifdef USE_SCRIPT_TCL
+#  ifndef HAVE_LIBTCL
+#    undef USE_SCRIPT_TCL
+#  endif
+#endif
+

+ 25 - 0
configure

@@ -695,6 +695,7 @@ enable_ipv6
 with_openssl
 with_tcllib
 with_tclinc
+enable_script_tcl
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1316,6 +1317,7 @@ Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-ipv6          disable IPv6 support
+  --disable-script-tcl    disable TCL Script support
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -5526,6 +5528,29 @@ if test "${with_tclinc+set}" = set; then :
 fi
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether TCL Script is enabled" >&5
+$as_echo_n "checking whether TCL Script is enabled... " >&6; }
+  # Check whether --enable-script_tcl was given.
+if test "${enable_script_tcl+set}" = set; then :
+  enableval=$enable_script_tcl;  enable_script_tcl="yes"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+else
+   enable_script_tcl="no"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+fi
+
+
+  if test "$enable_script_tcl" = "no"; then
+
+$as_echo "#define USE_SCRIPT_TCL 1" >>confdefs.h
+
+  fi
+
   WARN=0
   # Make sure either both or neither $tcllibname and $tclincname are set
   if test "x$tcllibname" != x; then

+ 2 - 2
src/cmds.c

@@ -4658,7 +4658,7 @@ void cmd_test(int idx, char *par)
   putlog(LOG_CMDS, "*", "#%s# test", dcc[idx].nick);
 }
 
-#ifdef HAVE_LIBTCL
+#ifdef USE_SCRIPT_TCL
 void cmd_tcl(int idx, char *par)
 {
   if (!isowner(dcc[idx].nick)) {
@@ -4800,7 +4800,7 @@ cmd_t C_dcc[] =
   {"w", 		"n", 	(Function) cmd_w, 		NULL, 0},
   {"channels", 		"", 	(Function) cmd_channels, 	NULL, 0},
   {"test",		"",	(Function) cmd_test,		NULL, 0},
-#ifdef HAVE_LIBTCL
+#ifdef USE_SCRIPT_TCL
   {"tcl",		"a",	(Function) cmd_tcl,		NULL, AUTH_ALL},
 #endif
   {"botlink",		"a",	(Function) cmd_botlink,		NULL, 0},

+ 7 - 7
src/libtcl.c

@@ -34,7 +34,7 @@
 #include "libtcl.h"
 #include ".defs/libtcl_defs.c"
 
-#ifdef HAVE_LIBTCL
+#ifdef USE_SCRIPT_TCL
 Tcl_Interp *global_interp = NULL;
 #endif
 
@@ -44,7 +44,7 @@ static bd::Array<bd::String> my_symbols;
 void initialize_binds_tcl();
 
 static int load_symbols(void *handle) {
-#ifdef HAVE_LIBTCL
+#ifdef USE_SCRIPT_TCL
   const char *dlsym_error = NULL;
 
   DLSYM_GLOBAL(handle, Tcl_Eval);
@@ -60,7 +60,7 @@ static int load_symbols(void *handle) {
 }
 
 int load_libtcl() {
-#ifndef HAVE_LIBTCL
+#ifndef USE_SCRIPT_TCL
   sdprintf("Not compiled with TCL support");
   return 1;
 #else
@@ -83,7 +83,7 @@ int load_libtcl() {
 
   load_symbols(libtcl_handle);
 
-#ifdef HAVE_LIBTCL
+#ifdef USE_SCRIPT_TCL
   // create interp
   global_interp = Tcl_CreateInterp();
   Tcl_FindExecutable(binname);
@@ -98,7 +98,7 @@ int load_libtcl() {
   return 0;
 }
 
-#ifdef HAVE_LIBTCL
+#ifdef USE_SCRIPT_TCL
 
 #include "chanprog.h"
 static int cmd_privmsg STDVAR {
@@ -118,7 +118,7 @@ void initialize_binds_tcl() {
 
 int unload_libtcl() {
   if (libtcl_handle) {
-#ifdef HAVE_LIBTCL
+#ifdef USE_SCRIPT_TCL
     if (global_interp) {
       Tcl_DeleteInterp(global_interp);
       global_interp = NULL;
@@ -139,7 +139,7 @@ int unload_libtcl() {
   return 1;
 }
 
-#ifdef HAVE_LIBTCL
+#ifdef USE_SCRIPT_TCL
 bd::String tcl_eval(const bd::String& str) {
   load_libtcl();
   if (!global_interp) return bd::String();

+ 1 - 1
src/libtcl.h

@@ -4,7 +4,7 @@
 #include "common.h"
 #include "dl.h"
 #include <bdlib/src/String.h>
-#ifdef HAVE_LIBTCL
+#ifdef USE_SCRIPT_TCL
 
 #include ".defs/libtcl_pre.h"