Permalink
Browse files

let icu decide how to link itself

icu-config on my Ubuntu 11.04 system gives back -ansi.
I changed the comments to conform and icu driver compiles.

git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1133287 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 3456b4e commit 6ceefeb6d142b995d9a0fe578aac88105d2a0917 @tilgovi tilgovi committed Jun 8, 2011
Showing with 33 additions and 44 deletions.
  1. +7 −13 configure.ac
  2. +5 −12 src/couchdb/priv/Makefile.am
  3. +21 −19 src/couchdb/priv/icu_driver/couch_icu_driver.c
View
20 configure.ac
@@ -167,8 +167,6 @@ case "$(uname -s)" in
*)
# XP_UNIX required for jsapi.h and has been tested to work on Linux and Darwin.
JS_CLAGS="-DXP_UNIX $JS_CFLAGS"
- # manually linking libm is requred for FreeBSD 7.0
- LDFLAGS="-lm $LDFLAGS"
;;
esac
@@ -261,21 +259,17 @@ AC_LANG_POP(C)
AC_ARG_WITH([win32-icu-binaries], [AC_HELP_STRING([--with-win32-icu-binaries=PATH],
[set PATH to the Win32 native ICU binaries directory])], [
- ICU_CONFIG="" # supposed to be a command to query options...
- ICU_LOCAL_CFLAGS="-I$withval/include"
- ICU_LOCAL_LDFLAGS="-L$withval/lib"
- ICU_LOCAL_BIN=$withval/bin
+ ICU_CFLAGS="-I$withval/include"
+ ICU_LIBS="-L$withval/lib -licuuc -licudt -licuin"
+ ICU_BIN=$withval/bin
], [
AC_CHECK_ICU([3.4.1])
- ICU_LOCAL_CFLAGS=`$ICU_CONFIG --cppflags-searchpath`
- ICU_LOCAL_LDFLAGS=`$ICU_CONFIG --ldflags-searchpath`
- ICU_LOCAL_BIN=
+ ICU_BIN=
])
-AC_SUBST(ICU_CONFIG)
-AC_SUBST(ICU_LOCAL_CFLAGS)
-AC_SUBST(ICU_LOCAL_LDFLAGS)
-AC_SUBST(ICU_LOCAL_BIN)
+AC_SUBST(ICU_CFLAGS)
+AC_SUBST(ICU_LIBS)
+AC_SUBST(ICU_BIN)
use_curl=yes
AC_ARG_WITH([win32-curl], [AC_HELP_STRING([--with-win32-curl=PATH],
View
17 src/couchdb/priv/Makefile.am
@@ -20,18 +20,11 @@ EXTRA_DIST = \
CLEANFILES = stat_descriptions.cfg
-ICU_LOCAL_FLAGS = $(ICU_LOCAL_CFLAGS) $(ICU_LOCAL_LDFLAGS)
-if WINDOWS
-ICU_LOCAL_LIBS=-licuuc -licudt -licuin
-else
-ICU_LOCAL_LIBS=-licuuc -licudata -licui18n
-endif
-
couchprivlib_LTLIBRARIES = couch_icu_driver.la
couch_icu_driver_la_SOURCES = icu_driver/couch_icu_driver.c
couch_icu_driver_la_LDFLAGS = -module -avoid-version
-couch_icu_driver_la_CFLAGS = $(ICU_LOCAL_FLAGS) $(ERLANG_FLAGS)
-couch_icu_driver_la_LIBADD = $(ICU_LOCAL_LIBS)
+couch_icu_driver_la_CFLAGS = $(ICU_CFLAGS) $(ERLANG_FLAGS)
+couch_icu_driver_la_LIBADD = $(ICU_LIBS)
if WINDOWS
couch_icu_driver_la_LDFLAGS += -no-undefined
@@ -78,9 +71,9 @@ install-data-hook:
$(LN_S) couch_icu_driver couch_icu_driver.so; \
fi
if WINDOWS
- $(INSTALL) $(ICU_LOCAL_BIN)/icuuc42.dll $(bindir)
- $(INSTALL) $(ICU_LOCAL_BIN)/icudt42.dll $(bindir)
- $(INSTALL) $(ICU_LOCAL_BIN)/icuin42.dll $(bindir)
+ $(INSTALL) $(ICU_BIN)/icuuc42.dll $(bindir)
+ $(INSTALL) $(ICU_BIN)/icudt42.dll $(bindir)
+ $(INSTALL) $(ICU_BIN)/icuin42.dll $(bindir)
$(INSTALL) $(JS_LIB_BINARY) $(bindir)
$(INSTALL) .libs/couchspawnkillable.exe \
"$(DESTDIR)$(couchprivdir)/couchspawnkillable.exe"
View
40 src/couchdb/priv/icu_driver/couch_icu_driver.c
@@ -13,9 +13,10 @@ specific language governing permissions and limitations under the License.
*/
-// This file is the C port driver for Erlang. It provides a low overhead
-// means of calling into C code, however coding errors in this module can
-// crash the entire Erlang server.
+/* This file is the C port driver for Erlang. It provides a low overhead
+ * means of calling into C code, however coding errors in this module can
+ * crash the entire Erlang server.
+ */
#ifdef DARWIN
#define U_HIDE_DRAFT_API 1
@@ -26,7 +27,7 @@ specific language governing permissions and limitations under the License.
#include "unicode/ucol.h"
#include "unicode/ucasemap.h"
#ifndef WIN32
-#include <string.h> // for memcpy
+#include <string.h> /* for memcpy */
#endif
typedef struct {
@@ -96,8 +97,8 @@ static int couch_drv_control(ErlDrvData drv_data, unsigned int command, char *pB
couch_drv_data* pData = (couch_drv_data*)drv_data;
switch(command) {
- case 0: // COLLATE
- case 1: // COLLATE_NO_CASE:
+ case 0: /* COLLATE */
+ case 1: /* COLLATE_NO_CASE: */
{
UErrorCode status = U_ZERO_ERROR;
int collResult;
@@ -106,37 +107,38 @@ static int couch_drv_control(ErlDrvData drv_data, unsigned int command, char *pB
UCharIterator iterB;
int32_t length;
- // 2 strings are in the buffer, consecutively
- // The strings begin first with a 32 bit integer byte length, then the actual
- // string bytes follow.
+ /* 2 strings are in the buffer, consecutively
+ * The strings begin first with a 32 bit integer byte length, then the actual
+ * string bytes follow.
+ */
- // first 32bits are the length
+ /* first 32bits are the length */
memcpy(&length, pBuf, sizeof(length));
pBuf += sizeof(length);
- // point the iterator at it.
+ /* point the iterator at it. */
uiter_setUTF8(&iterA, pBuf, length);
- pBuf += length; // now on to string b
+ pBuf += length; /* now on to string b */
- // first 32bits are the length
+ /* first 32bits are the length */
memcpy(&length, pBuf, sizeof(length));
pBuf += sizeof(length);
- // point the iterator at it.
+ /* point the iterator at it. */
uiter_setUTF8(&iterB, pBuf, length);
- if (command == 0) // COLLATE
+ if (command == 0) /* COLLATE */
collResult = ucol_strcollIter(pData->coll, &iterA, &iterB, &status);
- else // COLLATE_NO_CASE
+ else /* COLLATE_NO_CASE */
collResult = ucol_strcollIter(pData->collNoCase, &iterA, &iterB, &status);
if (collResult < 0)
- response = 0; //lt
+ response = 0; /*lt*/
else if (collResult > 0)
- response = 2; //gt
+ response = 2; /*gt*/
else
- response = 1; //eq
+ response = 1; /*eq*/
return return_control_result(&response, sizeof(response), rbuf, rlen);
}

0 comments on commit 6ceefeb

Please sign in to comment.