gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Add long long checking to build systems (#230)
0 5 1
default
6 files changed with 17 insertions and 2 deletions:
↑ Collapse diff ↑
Ignore white space 48 line context
1
#cmakedefine HAVE_LONG_LONG 1
... ...
 No newline at end of file
Ignore white space 6 line context
1 1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 2

	
3 3
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
4 4
  INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake)
5 5
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
6 6
  SET(PROJECT_NAME "LEMON")
7 7
  SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.")
8 8
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
9 9

	
10 10
PROJECT(${PROJECT_NAME})
11 11

	
12 12
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
13 13

	
14 14
INCLUDE(FindDoxygen)
15 15
INCLUDE(FindGhostscript)
16 16

	
17
INCLUDE(CheckTypeSize)
18
CHECK_TYPE_SIZE("long long" LONG_LONG)
19

	
17 20
ENABLE_TESTING()
18 21

	
19 22
ADD_SUBDIRECTORY(lemon)
20 23
ADD_SUBDIRECTORY(demo)
21 24
ADD_SUBDIRECTORY(doc)
22 25
ADD_SUBDIRECTORY(test)
23 26

	
24 27
IF(WIN32)
25 28
  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
26 29
  SET(CPACK_PACKAGE_VENDOR "EGRES")
27 30
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
28 31
    "LEMON - Library of Efficient Models and Optimization in Networks")
29 32
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
30 33

	
31 34
  SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
32 35

	
33 36
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY
34 37
    "${PROJECT_NAME} ${PROJECT_VERSION}")
35 38
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
36 39
    "${PROJECT_NAME} ${PROJECT_VERSION}")
37 40

	
38 41
  SET(CPACK_COMPONENTS_ALL headers library html_documentation)
39 42

	
40 43
  SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
Ignore white space 6 line context
... ...
@@ -3,48 +3,54 @@
3 3
dnl Version information.
4 4
m4_define([lemon_version_number],
5 5
	[m4_normalize(esyscmd([echo ${LEMON_VERSION}]))])
6 6
dnl m4_define([lemon_version_number], [])
7 7
m4_define([lemon_hg_path], [m4_normalize(esyscmd([./scripts/chg-len.py]))])
8 8
m4_define([lemon_hg_revision], [m4_normalize(esyscmd([hg id -i]))])
9 9
m4_define([lemon_version], [ifelse(lemon_version_number(),
10 10
			   [],
11 11
			   [lemon_hg_path().lemon_hg_revision()],
12 12
			   [lemon_version_number()])])
13 13

	
14 14
AC_PREREQ([2.59])
15 15
AC_INIT([LEMON], [lemon_version()], [lemon-user@lemon.cs.elte.hu], [lemon])
16 16
AC_CONFIG_AUX_DIR([build-aux])
17 17
AC_CONFIG_MACRO_DIR([m4])
18 18
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc])
19 19
AC_CONFIG_SRCDIR([lemon/list_graph.h])
20 20
AC_CONFIG_HEADERS([config.h lemon/config.h])
21 21

	
22 22
lx_cmdline_cxxflags_set=${CXXFLAGS+set}
23 23

	
24 24
dnl Do compilation tests using the C++ compiler.
25 25
AC_LANG([C++])
26 26

	
27
dnl Check the existence of long long type.
28
AC_CHECK_TYPE(long long, [long_long_found=yes], [long_long_found=no])
29
if test x"$long_long_found" = x"yes"; then
30
  AC_DEFINE([HAVE_LONG_LONG], [1], [Define to 1 if you have long long.])
31
fi
32

	
27 33
dnl Checks for programs.
28 34
AC_PROG_CXX
29 35
AC_PROG_CXXCPP
30 36
AC_PROG_INSTALL
31 37
AC_DISABLE_SHARED
32 38
AC_PROG_LIBTOOL
33 39

	
34 40
AC_CHECK_PROG([doxygen_found],[doxygen],[yes],[no])
35 41
AC_CHECK_PROG([gs_found],[gs],[yes],[no])
36 42

	
37 43
dnl Detect Intel compiler.
38 44
AC_MSG_CHECKING([whether we are using the Intel C++ compiler])
39 45
AC_COMPILE_IFELSE([#ifndef __INTEL_COMPILER
40 46
choke me
41 47
#endif], [ICC=[yes]], [ICC=[no]])
42 48
if test x"$ICC" = x"yes"; then
43 49
  AC_MSG_RESULT([yes])
44 50
else
45 51
  AC_MSG_RESULT([no])
46 52
fi
47 53

	
48 54
dnl Set custom compiler flags when using g++.
49 55
if test x"$lx_cmdline_cxxflags_set" != x"set" -a "$GXX" = yes -a "$ICC" = no; then
50 56
  CXXFLAGS="$CXXFLAGS -Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
... ...
@@ -95,40 +101,42 @@
95 101
AC_HEADER_STDC
96 102
AC_CHECK_FUNCS(gettimeofday times ctime_r)
97 103

	
98 104
dnl Add dependencies on files generated by configure.
99 105
AC_SUBST([CONFIG_STATUS_DEPENDENCIES],
100 106
  ['$(top_srcdir)/doc/Doxyfile.in $(top_srcdir)/lemon/lemon.pc.in $(top_srcdir)/cmake/version.cmake.in'])
101 107

	
102 108
AC_CONFIG_FILES([
103 109
Makefile
104 110
cmake/version.cmake
105 111
doc/Doxyfile
106 112
lemon/lemon.pc
107 113
])
108 114

	
109 115
AC_OUTPUT
110 116

	
111 117
echo
112 118
echo '****************************** SUMMARY ******************************'
113 119
echo
114 120
echo Package version............... : $PACKAGE-$VERSION
115 121
echo
116 122
echo C++ compiler.................. : $CXX
117 123
echo C++ compiles flags............ : $CXXFLAGS
118 124
echo
125
echo Compiler supports long long... : $long_long_found
126
echo
119 127
#echo GLPK support.................. : $lx_glpk_found
120 128
#echo CPLEX support................. : $lx_cplex_found
121 129
#echo SOPLEX support................ : $lx_soplex_found
122 130
#echo
123 131
echo Build demo programs........... : $enable_demo
124 132
echo Build additional tools........ : $enable_tools
125 133
echo
126 134
echo The packace will be installed in
127 135
echo -n '  '
128 136
echo $prefix.
129 137
echo
130 138
echo '*********************************************************************'
131 139

	
132 140
echo
133 141
echo Configure complete, now type \'make\' and then \'make install\'.
134 142
echo
Ignore white space 6 line context
... ...
@@ -75,49 +75,49 @@
75 75
  // short
76 76
  template <typename _Graph, typename _Item>
77 77
  struct DefaultMapSelector<_Graph, _Item, signed short> {
78 78
    typedef VectorMap<_Graph, _Item, signed short> Map;
79 79
  };
80 80

	
81 81
  template <typename _Graph, typename _Item>
82 82
  struct DefaultMapSelector<_Graph, _Item, unsigned short> {
83 83
    typedef VectorMap<_Graph, _Item, unsigned short> Map;
84 84
  };
85 85

	
86 86

	
87 87
  // long
88 88
  template <typename _Graph, typename _Item>
89 89
  struct DefaultMapSelector<_Graph, _Item, signed long> {
90 90
    typedef VectorMap<_Graph, _Item, signed long> Map;
91 91
  };
92 92

	
93 93
  template <typename _Graph, typename _Item>
94 94
  struct DefaultMapSelector<_Graph, _Item, unsigned long> {
95 95
    typedef VectorMap<_Graph, _Item, unsigned long> Map;
96 96
  };
97 97

	
98 98

	
99
#if defined __GNUC__ && !defined __STRICT_ANSI__
99
#if defined HAVE_LONG_LONG
100 100

	
101 101
  // long long
102 102
  template <typename _Graph, typename _Item>
103 103
  struct DefaultMapSelector<_Graph, _Item, signed long long> {
104 104
    typedef VectorMap<_Graph, _Item, signed long long> Map;
105 105
  };
106 106

	
107 107
  template <typename _Graph, typename _Item>
108 108
  struct DefaultMapSelector<_Graph, _Item, unsigned long long> {
109 109
    typedef VectorMap<_Graph, _Item, unsigned long long> Map;
110 110
  };
111 111

	
112 112
#endif
113 113

	
114 114

	
115 115
  // float
116 116
  template <typename _Graph, typename _Item>
117 117
  struct DefaultMapSelector<_Graph, _Item, float> {
118 118
    typedef VectorMap<_Graph, _Item, float> Map;
119 119
  };
120 120

	
121 121

	
122 122
  // double
123 123
  template <typename _Graph, typename _Item>
Ignore white space 6 line context
1 1
/* Define to 1 if you have CPLEX. */
2 2
#undef HAVE_CPLEX
3 3

	
4 4
/* Define to 1 if you have GLPK. */
5 5
#undef HAVE_GLPK
6

	
7
/* Define to 1 if you have long long */
8
#undef HAVE_LONG_LONG
Ignore white space 6 line context
... ...
@@ -350,49 +350,49 @@
350 350
    typedef unsigned long int Value;
351 351

	
352 352
    ///\name Comparisons
353 353
    ///See \ref lemon::Tolerance "Tolerance" for more details.
354 354

	
355 355
    ///@{
356 356

	
357 357
    ///Returns \c true if \c a is \e surely strictly less than \c b
358 358
    static bool less(Value a,Value b) { return a<b;}
359 359
    ///Returns \c true if \c a is \e surely different from \c b
360 360
    static bool different(Value a,Value b) { return a!=b; }
361 361
    ///Returns \c true if \c a is \e surely positive
362 362
    static bool positive(Value a) { return 0<a; }
363 363
    ///Returns \c true if \c a is \e surely negative
364 364
    static bool negative(Value) { return false; }
365 365
    ///Returns \c true if \c a is \e surely non-zero
366 366
    static bool nonZero(Value a) { return a!=0;}
367 367

	
368 368
    ///@}
369 369

	
370 370
    ///Returns zero
371 371
    static Value zero() {return 0;}
372 372
  };
373 373

	
374
#if defined __GNUC__ && !defined __STRICT_ANSI__
374
#if HAVE_LONG_LONG 
375 375

	
376 376
  ///Long long integer specialization of Tolerance.
377 377

	
378 378
  ///Long long integer specialization of Tolerance.
379 379
  ///\warning This class (more exactly, type <tt>long long</tt>)
380 380
  ///is not ansi compatible.
381 381
  ///\sa Tolerance
382 382
  template<>
383 383
  class Tolerance<long long int>
384 384
  {
385 385
  public:
386 386
    ///\e
387 387
    typedef long long int Value;
388 388

	
389 389
    ///\name Comparisons
390 390
    ///See \ref lemon::Tolerance "Tolerance" for more details.
391 391

	
392 392
    ///@{
393 393

	
394 394
    ///Returns \c true if \c a is \e surely strictly less than \c b
395 395
    static bool less(Value a,Value b) { return a<b;}
396 396
    ///Returns \c true if \c a is \e surely different from \c b
397 397
    static bool different(Value a,Value b) { return a!=b; }
398 398
    ///Returns \c true if \c a is \e surely positive
0 comments (0 inline)