clean up autoconf of unordered_xx, prepare change to shared_ptr
This commit is contained in:
parent
e37284f05f
commit
bf4116faae
11 changed files with 69 additions and 32 deletions
|
@ -48,6 +48,12 @@
|
||||||
/* Define to 1 if you have the `setrlimit' function. */
|
/* Define to 1 if you have the `setrlimit' function. */
|
||||||
#undef HAVE_SETRLIMIT
|
#undef HAVE_SETRLIMIT
|
||||||
|
|
||||||
|
/* Has std::shared_ptr */
|
||||||
|
#undef HAVE_SHARED_PTR_STD
|
||||||
|
|
||||||
|
/* Has std::tr1::shared_ptr */
|
||||||
|
#undef HAVE_SHARED_PTR_TR1
|
||||||
|
|
||||||
/* Define to 1 if you have the <spawn.h> header file. */
|
/* Define to 1 if you have the <spawn.h> header file. */
|
||||||
#undef HAVE_SPAWN_H
|
#undef HAVE_SPAWN_H
|
||||||
|
|
||||||
|
@ -171,3 +177,5 @@
|
||||||
|
|
||||||
/* Define for large files, on AIX-style hosts. */
|
/* Define for large files, on AIX-style hosts. */
|
||||||
#undef _LARGE_FILES
|
#undef _LARGE_FILES
|
||||||
|
|
||||||
|
#include "conf_post.h"
|
||||||
|
|
28
src/common/conf_post.h
Normal file
28
src/common/conf_post.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#ifdef HAVE_CXX0X_UNORDERED
|
||||||
|
# define UNORDERED_MAP_INCLUDE <unordered_map>
|
||||||
|
# define UNORDERED_SET_INCLUDE <unordered_set>
|
||||||
|
# define STD_UNORDERED_MAP std::unordered_map
|
||||||
|
# define STD_UNORDERED_SET std::unordered_set
|
||||||
|
#elif defined(HAVE_TR1_UNORDERED)
|
||||||
|
# define UNORDERED_MAP_INCLUDE <tr1/unordered_map>
|
||||||
|
# define UNORDERED_SET_INCLUDE <tr1/unordered_set>
|
||||||
|
# define STD_UNORDERED_MAP std::tr1::unordered_map
|
||||||
|
# define STD_UNORDERED_SET std::tr1::unordered_set
|
||||||
|
#else
|
||||||
|
# define UNORDERED_MAP_INCLUDE <map>
|
||||||
|
# define UNORDERED_SET_INCLUDE <set>
|
||||||
|
# define STD_UNORDERED_MAP std::map
|
||||||
|
# define STD_UNORDERED_SET std::set
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SHARED_PTR_STD
|
||||||
|
# define MEMORY_INCLUDE <memory>
|
||||||
|
# define STD_SHARED_PTR std::shared_ptr
|
||||||
|
#elif defined(HAVE_SHARED_PTR_TR1)
|
||||||
|
# define MEMORY_INCLUDE <tr1/memory>
|
||||||
|
# define STD_SHARED_PTR std::tr1::shared_ptr
|
||||||
|
#else
|
||||||
|
# define MEMORY_INCLUDE "refcntr.h"
|
||||||
|
# define STD_SHARED_PTR RefCntr
|
||||||
|
#endif
|
||||||
|
|
|
@ -16,13 +16,14 @@
|
||||||
*/
|
*/
|
||||||
#ifndef _RCLCONFIG_H_INCLUDED_
|
#ifndef _RCLCONFIG_H_INCLUDED_
|
||||||
#define _RCLCONFIG_H_INCLUDED_
|
#define _RCLCONFIG_H_INCLUDED_
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "unordered_defs.h"
|
#include UNORDERED_SET_INCLUDE
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
@ -30,7 +31,6 @@ using std::pair;
|
||||||
using std::set;
|
using std::set;
|
||||||
using std::map;
|
using std::map;
|
||||||
|
|
||||||
|
|
||||||
#include "conftree.h"
|
#include "conftree.h"
|
||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "unordered_defs.h"
|
#include UNORDERED_SET_INCLUDE
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "textsplit.h"
|
#include "textsplit.h"
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
|
@ -33,6 +32,7 @@ using namespace std;
|
||||||
#include "utf8iter.h"
|
#include "utf8iter.h"
|
||||||
#include "uproplist.h"
|
#include "uproplist.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splitting a text into words. The code in this file works with utf-8
|
* Splitting a text into words. The code in this file works with utf-8
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
|
|
||||||
#include "autoconfig.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_CXX0X_UNORDERED
|
|
||||||
# include <unordered_map>
|
|
||||||
# include <unordered_set>
|
|
||||||
# define STD_UNORDERED_MAP std::unordered_map
|
|
||||||
# define STD_UNORDERED_SET std::unordered_set
|
|
||||||
#elif defined(HAVE_TR1_UNORDERED)
|
|
||||||
# include <tr1/unordered_map>
|
|
||||||
# include <tr1/unordered_set>
|
|
||||||
# define STD_UNORDERED_MAP std::tr1::unordered_map
|
|
||||||
# define STD_UNORDERED_SET std::tr1::unordered_set
|
|
||||||
#else
|
|
||||||
# include <map>
|
|
||||||
# include <set>
|
|
||||||
# define STD_UNORDERED_MAP std::map
|
|
||||||
# define STD_UNORDERED_SET std::set
|
|
||||||
#endif
|
|
|
@ -1,5 +1,6 @@
|
||||||
AC_INIT([Recoll], m4_esyscmd_s(cat VERSION))
|
AC_INIT([Recoll], m4_esyscmd_s(cat VERSION))
|
||||||
AC_CONFIG_HEADERS([common/autoconfig.h])
|
AC_CONFIG_HEADERS([common/autoconfig.h])
|
||||||
|
AH_BOTTOM([#include "conf_post.h"])
|
||||||
AC_PREREQ(2.53)
|
AC_PREREQ(2.53)
|
||||||
AC_CONFIG_SRCDIR(index/recollindex.cpp)
|
AC_CONFIG_SRCDIR(index/recollindex.cpp)
|
||||||
|
|
||||||
|
@ -41,6 +42,21 @@ AC_CHECK_HEADER(tr1/unordered_map,[AC_DEFINE([HAVE_TR1_UNORDERED],
|
||||||
[],["Have tr1"])],[])
|
[],["Have tr1"])],[])
|
||||||
AC_CHECK_HEADER(unordered_map,[AC_DEFINE([HAVE_CXX0X_UNORDERED],
|
AC_CHECK_HEADER(unordered_map,[AC_DEFINE([HAVE_CXX0X_UNORDERED],
|
||||||
[],["Have C++0x"])],[])
|
[],["Have C++0x"])],[])
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#include <memory>
|
||||||
|
],[
|
||||||
|
std::shared_ptr<int> ptr;
|
||||||
|
], rcl_shared_ptr_std="1", rcl_shared_ptr_std="0")
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#include <tr1/memory>
|
||||||
|
],[
|
||||||
|
std::tr1::shared_ptr<int> ptr;
|
||||||
|
], rcl_shared_ptr_tr1="1", rcl_shared_ptr_tr1="0")
|
||||||
|
if test X$rcl_shared_ptr_std = X1; then
|
||||||
|
AC_DEFINE(HAVE_SHARED_PTR_STD, [], [Has std::shared_ptr])
|
||||||
|
elif test X$rcl_shared_ptr_tr1 = X1; then
|
||||||
|
AC_DEFINE(HAVE_SHARED_PTR_TR1, [], [Has std::tr1::shared_ptr])
|
||||||
|
fi
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
|
|
||||||
AC_CHECK_HEADERS([sys/mount.h sys/statfs.h sys/statvfs.h sys/vfs.h], [], [],
|
AC_CHECK_HEADERS([sys/mount.h sys/statfs.h sys/statvfs.h sys/vfs.h], [], [],
|
||||||
|
|
|
@ -19,9 +19,6 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "unordered_defs.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
|
@ -33,6 +30,8 @@ using namespace std;
|
||||||
#include "utf8iter.h"
|
#include "utf8iter.h"
|
||||||
#include "hldata.h"
|
#include "hldata.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
namespace Rcl {
|
namespace Rcl {
|
||||||
// This is used as a marker inside the abstract frag lists, but
|
// This is used as a marker inside the abstract frag lists, but
|
||||||
// normally doesn't remain in final output (which is built with a
|
// normally doesn't remain in final output (which is built with a
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
* Free Software Foundation, Inc.,
|
* Free Software Foundation, Inc.,
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -21,7 +22,6 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include "xapian.h"
|
#include "xapian.h"
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ using namespace std;
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
#include "unacpp.h"
|
#include "unacpp.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
namespace Rcl {
|
namespace Rcl {
|
||||||
// This is used as a marker inside the abstract frag lists, but
|
// This is used as a marker inside the abstract frag lists, but
|
||||||
// normally doesn't remain in final output (which is built with a
|
// normally doesn't remain in final output (which is built with a
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "unordered_defs.h"
|
#include UNORDERED_MAP_INCLUDE
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define _REFCNTR_H_
|
#define _REFCNTR_H_
|
||||||
|
|
||||||
// See Stroustrup C++ 3rd ed, p. 783
|
// See Stroustrup C++ 3rd ed, p. 783
|
||||||
|
// This is only used if std::shared_ptr is not available
|
||||||
template <class X> class RefCntr {
|
template <class X> class RefCntr {
|
||||||
X *rep;
|
X *rep;
|
||||||
int *pcount;
|
int *pcount;
|
||||||
|
|
|
@ -16,9 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TEST_SMALLUT
|
#ifndef TEST_SMALLUT
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -34,14 +33,16 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "unordered_defs.h"
|
#include UNORDERED_MAP_INCLUDE
|
||||||
using namespace std;
|
#include UNORDERED_SET_INCLUDE
|
||||||
|
|
||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
#include "utf8iter.h"
|
#include "utf8iter.h"
|
||||||
#include "hldata.h"
|
#include "hldata.h"
|
||||||
#include "cstr.h"
|
#include "cstr.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
void map_ss_cp_noshr(const map<string,string> s, map<string,string> *d)
|
void map_ss_cp_noshr(const map<string,string> s, map<string,string> *d)
|
||||||
{
|
{
|
||||||
for (map<string,string>::const_iterator it= s.begin();
|
for (map<string,string>::const_iterator it= s.begin();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue