Skip to content

Commit 908a306

Browse files
committed
clean up headers, boost is really optional to avoid dependencies
1 parent 24b378d commit 908a306

File tree

5 files changed

+29
-36
lines changed

5 files changed

+29
-36
lines changed

configure.ac

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
m4_define([numbertext_version_major],[1])
22
m4_define([numbertext_version_minor],[0])
33
m4_define([numbertext_version_micro],[1])
4-
m4_define([numbertext_version],[numbertext_version_major.numbertext_version_minor.numbertext_version_micro])
4+
m4_define([numbertext_version],[numbertext_version_major.numbertext_version_minor.numbertext_version_micro-3])
55

66
AC_PREREQ([2.68])
77

88
AC_INIT([libnumbertext],[numbertext_version])
99
AC_CONFIG_MACRO_DIR([m4])
10-
AC_LANG([C])
1110

1211
AM_INIT_AUTOMAKE([1.11 foreign dist-xz dist-bzip2])
1312
AM_MAINTAINER_MODE
@@ -21,29 +20,24 @@ AC_PROG_INSTALL
2120
AC_PROG_LN_S
2221
AC_PROG_LIBTOOL
2322

24-
dnl Checks for headers
25-
AC_HEADER_STDC
26-
AC_CHECK_HEADERS([inttypes.h stdint.h string.h])
27-
28-
2923
dnl Checks for typedefs, structures, and compiler characteristics.
3024
AC_LANG([C++])
3125
CXXFLAGS='-Wall -std=c++11'
3226

3327
AC_CHECK_HEADERS([codecvt regex])
3428

35-
AS_IF([test "x$with_boost" != x], [
36-
AC_DEFINE([BOOST_ALL_NO_LIB], [], [Disable boost autolink.])
37-
BOOST_REQUIRE
38-
BOOST_LOCALE
39-
BOOST_REGEX
40-
])
29+
#AS_IF([test "x$with_boost" != x], [
30+
# AC_DEFINE([BOOST_ALL_NO_LIB], [], [Disable boost autolink.])
31+
# BOOST_REQUIRE
32+
# BOOST_LOCALE
33+
# BOOST_REGEX
34+
#])
4135

4236
AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
4337
[
44-
AS_IF([test "x$with_boost" == x], [
38+
# AS_IF([test "x$with_boost" == x], [
4539
AC_MSG_ERROR([Missing std::codecvt or std::regex support, use GCC 4.9 (or greater) or --with-boost.])
46-
])
40+
# ])
4741
])
4842

4943
dnl Checks for functions

src/Numbertext.cxx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@
44

55
#include <sstream>
66
#include <fstream>
7-
#include "config.h"
7+
8+
#include "Numbertext.hxx"
89

910
#ifdef HAVE_BOOST_REGEX_HPP
1011
#include <boost/locale/encoding_utf.hpp>
11-
#include <boost/regex.hpp>
1212
using namespace boost;
1313
#else
1414
#include <codecvt>
15-
#include <regex>
15+
#include <locale>
1616
using namespace std;
1717
#endif
1818

19-
#include <locale>
20-
#include "Numbertext.hxx"
21-
2219
#define MODULE_DIR ""
2320
#define SOROS_EXT ".sor"
2421

src/Soros.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
#include "Soros.hxx"
66

7+
#ifdef HAVE_BOOST_REGEX_HPP
8+
using namespace boost;
9+
#else
10+
using namespace std;
11+
#endif
12+
713
#define ITERATION_LIMIT 250
814
#define SEP L"\uE00A"
915

src/Soros.hxx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
#include <iterator>
1010
#include <string>
1111

12+
#ifndef _MSC_VER
1213
#include "config.h"
14+
#endif
1315

1416
#ifdef HAVE_BOOST_REGEX_HPP
1517
#include <boost/regex.hpp>
16-
using namespace boost;
1718
#else
1819
#include <regex>
19-
using namespace std;
2020
#endif
2121

2222
class Soros {
@@ -31,13 +31,18 @@ private:
3131
static void replace(std::wstring& s, const std::wstring& search,
3232
const std::wstring& replace);
3333

34-
std::vector<wregex> patterns;
34+
#ifdef HAVE_BOOST_REGEX_HPP
35+
std::vector<boost::wregex> patterns;
36+
static const boost::wregex func;
37+
#else
38+
std::vector<std::wregex> patterns;
39+
static const std::wregex func;
40+
#endif
3541
std::vector<std::wstring> values;
3642
std::vector<bool> begins;
3743
std::vector<bool> ends;
3844

3945
static const std::wstring m, m2, c, c2, slash, pipe;
40-
static const wregex func;
4146
};
4247

4348
#endif

src/spellout.cxx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22
#include "numbertext-version.h"
33
#include <cstring>
44

5-
#ifdef _MSC_VER
6-
#define HAVE_CODECVT
7-
8-
#else
9-
#include "config.h"
10-
#endif
11-
125
#ifdef HAVE_BOOST_REGEX_HPP
13-
#include <boost/regex.hpp>
14-
using namespace boost;
6+
using namespace boost;
157
#else
16-
#include <regex>
17-
using namespace std;
8+
using namespace std;
189
#endif
1910

2011
#define LANG "LANG"

0 commit comments

Comments
 (0)