Browse code

build: properly process lzo-stub

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: Samuli Seppänen <samuli@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>

Alon Bar-Lev authored on 2012/03/01 05:12:08
Showing 5 changed files
... ...
@@ -701,11 +701,6 @@ if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
701 701
    fi
702 702
 fi
703 703
 
704
-dnl enable multi-client mode
705
-if test "${enable_lzo_stub}" = "yes"; then
706
-	AC_DEFINE([LZO_STUB], [1], [Enable LZO stub capability])
707
-fi
708
-
709 704
 PKG_CHECK_MODULES(
710 705
 	[PKCS11_HELPER],
711 706
 	[libpkcs11-helper-1 >= 1.02],
... ...
@@ -867,6 +862,13 @@ if test "${enable_selinux}" = "yes"; then
867 867
 	AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
868 868
 fi
869 869
 
870
+if test "${enable_lzo_stub}" = "yes"; then
871
+	test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both lzo stub and lzo enabled])
872
+	AC_DEFINE([ENABLE_LZO_STUB], [1], [Enable LZO stub capability])
873
+	AC_DEFINE([USE_LZO], [1], [Enable LZO compression library])
874
+	AC_DEFINE([LZO_VERSION_NUM], ["STUB"], [LZO version number])
875
+fi
876
+
870 877
 if test "${enable_pkcs11}" = "yes"; then
871 878
 	test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing])
872 879
 	test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled])
... ...
@@ -36,7 +36,7 @@
36 36
 
37 37
 #include "memdbg.h"
38 38
 
39
-#ifndef LZO_STUB
39
+#ifndef ENABLE_LZO_STUB
40 40
 /**
41 41
  * Perform adaptive compression housekeeping.
42 42
  *
... ...
@@ -91,7 +91,7 @@ lzo_adaptive_compress_data (struct lzo_adaptive_compress *ac, int n_total, int n
91 91
   ac->n_comp += n_comp;
92 92
 }
93 93
 
94
-#endif /* LZO_STUB */
94
+#endif /* ENABLE_LZO_STUB */
95 95
 
96 96
 void lzo_adjust_frame_parameters (struct frame *frame)
97 97
 {
... ...
@@ -109,7 +109,7 @@ lzo_compress_init (struct lzo_compress_workspace *lzowork, unsigned int flags)
109 109
   CLEAR (*lzowork);
110 110
 
111 111
   lzowork->flags = flags;
112
-#ifndef LZO_STUB
112
+#ifndef ENABLE_LZO_STUB
113 113
   lzowork->wmem_size = LZO_WORKSPACE;
114 114
 
115 115
   if (lzo_init () != LZO_E_OK)
... ...
@@ -129,7 +129,7 @@ lzo_compress_uninit (struct lzo_compress_workspace *lzowork)
129 129
   if (lzowork)
130 130
     {
131 131
       ASSERT (lzowork->defined);
132
-#ifndef LZO_STUB
132
+#ifndef ENABLE_LZO_STUB
133 133
       lzo_free (lzowork->wmem);
134 134
       lzowork->wmem = NULL;
135 135
 #endif
... ...
@@ -140,7 +140,7 @@ lzo_compress_uninit (struct lzo_compress_workspace *lzowork)
140 140
 static inline bool
141 141
 lzo_compression_enabled (struct lzo_compress_workspace *lzowork)
142 142
 {
143
-#ifndef LZO_STUB
143
+#ifndef ENABLE_LZO_STUB
144 144
   if ((lzowork->flags & (LZO_SELECTED|LZO_ON)) == (LZO_SELECTED|LZO_ON))
145 145
     {
146 146
       if (lzowork->flags & LZO_ADAPTIVE)
... ...
@@ -157,7 +157,7 @@ lzo_compress (struct buffer *buf, struct buffer work,
157 157
 	      struct lzo_compress_workspace *lzowork,
158 158
 	      const struct frame* frame)
159 159
 {
160
-#ifndef LZO_STUB
160
+#ifndef ENABLE_LZO_STUB
161 161
   lzo_uint zlen = 0;
162 162
   int err;
163 163
   bool compressed = false;
... ...
@@ -168,7 +168,7 @@ lzo_compress (struct buffer *buf, struct buffer work,
168 168
   if (buf->len <= 0)
169 169
     return;
170 170
 
171
-#ifndef LZO_STUB
171
+#ifndef ENABLE_LZO_STUB
172 172
   /*
173 173
    * In order to attempt compression, length must be at least COMPRESS_THRESHOLD,
174 174
    * and our adaptive level must give the OK.
... ...
@@ -226,7 +226,7 @@ lzo_decompress (struct buffer *buf, struct buffer work,
226 226
 		struct lzo_compress_workspace *lzowork,
227 227
 		const struct frame* frame)
228 228
 {
229
-#ifndef LZO_STUB
229
+#ifndef ENABLE_LZO_STUB
230 230
   lzo_uint zlen = EXPANDED_SIZE (frame);
231 231
   int err;
232 232
 #endif
... ...
@@ -244,7 +244,7 @@ lzo_decompress (struct buffer *buf, struct buffer work,
244 244
 
245 245
   if (c == YES_COMPRESS)	/* packet was compressed */
246 246
     {
247
-#ifndef LZO_STUB
247
+#ifndef ENABLE_LZO_STUB
248 248
       ASSERT (buf_safe (&work, zlen));
249 249
       err = LZO_DECOMPRESS (BPTR (buf), BLEN (buf), BPTR (&work), &zlen,
250 250
 			    lzowork->wmem);
... ...
@@ -291,7 +291,7 @@ void lzo_print_stats (const struct lzo_compress_workspace *lzo_compwork, struct
291 291
 {
292 292
   ASSERT (lzo_compwork->defined);
293 293
 
294
-#ifndef LZO_STUB
294
+#ifndef ENABLE_LZO_STUB
295 295
   status_printf (so, "pre-compress bytes," counter_format, lzo_compwork->pre_compress);
296 296
   status_printf (so, "post-compress bytes," counter_format, lzo_compwork->post_compress);
297 297
   status_printf (so, "pre-decompress bytes," counter_format, lzo_compwork->pre_decompress);
... ...
@@ -39,7 +39,7 @@
39 39
  * @{
40 40
  */
41 41
 
42
-#ifndef LZO_STUB
42
+#ifndef ENABLE_LZO_STUB
43 43
 #ifdef LZO_HEADER_DIR
44 44
 #include "lzo/lzoutil.h"
45 45
 #include "lzo/lzo1x.h"
... ...
@@ -68,7 +68,7 @@
68 68
 
69 69
 /**************************************************************************/
70 70
 /** @name LZO library interface defines *//** @{ *//***********************/
71
-#ifndef LZO_STUB
71
+#ifndef ENABLE_LZO_STUB
72 72
 #define LZO_COMPRESS    lzo1x_1_15_compress
73 73
                                 /**< LZO library compression function.
74 74
                                  *
... ...
@@ -90,7 +90,7 @@
90 90
                                  *   verify the integrity of incoming
91 91
                                  *   packets, you might want to consider
92 92
                                  *   using the non-safe version. */
93
-#endif /* LZO_STUB */
93
+#endif /* ENABLE_LZO_STUB */
94 94
 /** @} name LZO library interface *//**************************************/
95 95
 
96 96
 
... ...
@@ -98,10 +98,10 @@
98 98
 /** @name Miscellaneous compression defines *//** @{ *//*******************/
99 99
 #define LZO_EXTRA_BUFFER(len) ((len)/8 + 128 + 3)
100 100
                                 /**< LZO 2.0 worst-case size expansion. */
101
-#ifndef LZO_STUB
101
+#ifndef ENABLE_LZO_STUB
102 102
 #define COMPRESS_THRESHOLD 100  /**< Minimum packet size to attempt
103 103
                                  *   compression. */
104
-#endif /* LZO_STUB */
104
+#endif /* ENABLE_LZO_STUB */
105 105
 /** @} name Miscellaneous compression defines *//**************************/
106 106
 
107 107
 
... ...
@@ -119,7 +119,7 @@
119 119
 
120 120
 /**************************************************************************/
121 121
 /** @name Adaptive compression defines *//** @{ *//************************/
122
-#ifndef LZO_STUB
122
+#ifndef ENABLE_LZO_STUB
123 123
 #define AC_SAMP_SEC    2        /**< Number of seconds in a sample period. */
124 124
 #define AC_MIN_BYTES   1000     /**< Minimum number of bytes a sample
125 125
                                  *   period must contain for it to be
... ...
@@ -129,10 +129,10 @@
129 129
                                  *   turned off. */
130 130
 #define AC_OFF_SEC     60       /**< Seconds to wait after compression has
131 131
                                  *   been turned off before retesting. */
132
-#endif /* LZO_STUB */
132
+#endif /* ENABLE_LZO_STUB */
133 133
 /** @} name Adaptive compression defines *//*******************************/
134 134
 
135
-#ifndef LZO_STUB
135
+#ifndef ENABLE_LZO_STUB
136 136
 
137 137
 /**
138 138
  * Adaptive compression state.
... ...
@@ -144,7 +144,7 @@ struct lzo_adaptive_compress {
144 144
   int n_comp;
145 145
 };
146 146
 
147
-#endif /* LZO_STUB */
147
+#endif /* ENABLE_LZO_STUB */
148 148
 
149 149
 
150 150
 /**
... ...
@@ -161,7 +161,7 @@ struct lzo_compress_workspace
161 161
 {
162 162
   bool defined;
163 163
   unsigned int flags;
164
-#ifndef LZO_STUB
164
+#ifndef ENABLE_LZO_STUB
165 165
   lzo_voidp wmem;
166 166
   int wmem_size;
167 167
   struct lzo_adaptive_compress ac;
... ...
@@ -1652,7 +1652,7 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
1652 1652
       }
1653 1653
 
1654 1654
       /* push LZO status */
1655
-#ifdef LZO_STUB
1655
+#ifdef ENABLE_LZO_STUB
1656 1656
       buf_printf (&out, "IV_LZO_STUB=1\n");
1657 1657
 #endif
1658 1658
 
... ...
@@ -700,18 +700,6 @@ socket_defined (const socket_descriptor_t sd)
700 700
 #define ENABLE_CLIENT_NAT
701 701
 
702 702
 /*
703
- * Support LZO as a stub in client? (LZO lib not included, but we
704
- * we still support LZO protocol changes that allow us to
705
- * communicate with an LZO-enabled server)
706
- */
707
-#ifdef LZO_STUB
708
-#undef USE_LZO
709
-#undef LZO_VERSION_NUM
710
-#define USE_LZO 1
711
-#define LZO_VERSION_NUM "STUB"
712
-#endif
713
-
714
-/*
715 703
  * Enable --memstats option
716 704
  */
717 705
 #ifdef TARGET_LINUX