source: m4/ax_codepatterns.m4@ f08ae7

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since f08ae7 was f08ae7, checked in by Frederik Heber <heber@…>, 13 years ago

Extension of usage of Tsuna's boost.m4 macro.

  • boost.m4 from https://github.com/tsuna/boost.m4.git (serial 16 + updates).
  • LinearAlgebra does not depend on any boost libs only two headers and CodePatterns.
  • Presence and Usability of every boost header and lib is now checked.
  • Using updated ax_codepatterns.m4.
  • FIX: boost has not been possible to link with if not residing under some default path. This is now possible.
  • Property mode set to 100644
File size: 8.4 KB
Line 
1dnl
2dnl AM_PATH_CODEPATTERNS(MINIMUM-VERSION, [HAVE_DEBUG=no,yes,full], [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
3dnl
4
5AC_DEFUN([AM_PATH_CODEPATTERNS],
6[
7AC_REQUIRE([BOOST_THREADS])
8AC_REQUIRE([BOOST_REQUIRE])
9
10AC_ARG_WITH(codepatterns,[ --with-codepatterns=PFX Prefix where CodePatterns is installed (optional)],
11 codepatterns_prefix="$withval", codepatterns_prefix="")
12AC_ARG_WITH(codepatterns_include,[ --with-codepatterns_include=INCLUDE Where CodePatterns' includes are installed (optional)],
13 codepatterns_include_prefix="$withval", codepatterns_include_prefix="")
14AC_ARG_WITH(cp_cv_codepatterns_libs,[ --with-cp_cv_codepatterns_libs=LIBPATH Where CodePatterns' libs are installed (optional)],
15 cp_cv_codepatterns_libs_prefix="$withval", cp_cv_codepatterns_libs_prefix="")
16
17 codepatterns_version_min=$1
18 codepatterns_debug=$2
19
20 CodePatterns_CFLAGS=""
21 CodePatterns_LIBS=""
22 CodePatterns_LDFLAGS=""
23
24
25 codepatterns_pkgconfig=""
26 # try to set PKG_CONFIG_PATH
27 if test x$codepatterns_prefix != xno; then
28 if test -z $PKG_CONFIG_PATH; then
29 export PKG_CONFIG_PATH="$codepatterns_prefix/lib/pkgconfig/"
30 else
31 export PKG_CONFIG_PATH="$codepatterns_prefix/lib/pkgconfig/:$PKG_CONFIG_PATH"
32 fi
33 fi
34 # 1. test whether pkg-config works
35 CodePatterns_CONFIG="no"
36 #AC_MSG_NOTICE([PKG_CONFIG_PATH is $PKG_CONFIG_PATH.])
37 if test x$codepatterns_debug != xno; then
38 codepatterns_libname="CodePatterns-debug"
39 PKG_CHECK_MODULES([CodePatterns_debug], [CodePatterns >= $codepatterns_version_min], [
40 codepatterns_pkgconfig=yes
41 CodePatterns_CONFIG="pkg-config $codepatterns_libname"
42 ], [
43 # 2. if failed, test for binary codepatterns-config
44 AC_PATH_PROG(CodePatterns_CONFIG, codepatterns-config, no)
45 if test "x$CodePatterns_CONFIG" = xno && test x$codepatterns_prefix != x ; then
46 if test -e $codepatterns_prefix/bin/codepatterns-config; then
47 codepatterns_pkgconfig=no
48 CodePatterns_CONFIG="$codepatterns_prefix/bin/codepatterns-config"
49 fi
50 fi
51 ])
52
53 else
54 codepatterns_libname="CodePatterns"
55 PKG_CHECK_MODULES([CodePatterns], [CodePatterns >= $codepatterns_version_min], [
56 codepatterns_pkgconfig=yes
57 CodePatterns_CONFIG="pkg-config $codepatterns_libname"
58 ], [
59 # 2. if failed, test for binary codepatterns-config
60 AC_PATH_PROG(CodePatterns_CONFIG, codepatterns-config, no)
61 if test "x$CodePatterns_CONFIG" = xno && test x$codepatterns_prefix != x ; then
62 AC_MSG_CHECKING([for alternative codepatterns-config location])
63 if test -e $codepatterns_prefix/bin/codepatterns-config; then
64 codepatterns_pkgconfig=no
65 CodePatterns_CONFIG="$codepatterns_prefix/bin/codepatterns-config"
66 AC_MSG_RESULT([yes])
67 else
68 AC_MSG_RESULT([no])
69 fi
70 fi
71 ])
72
73 fi
74
75 # try to set values via CodePatterns_CONFIG
76 if test "x$CodePatterns_CONFIG" != xno; then
77 CodePatterns_CFLAGS=`$CodePatterns_CONFIG --cflags`
78 if test x$codepatterns_pkgconfig = xno; then
79 CodePatterns_LIBS=`$CodePatterns_CONFIG --ldflags --libs`
80 else
81 CodePatterns_LIBS=`$CodePatterns_CONFIG --libs`
82 fi
83 #AC_MSG_NOTICE([codepatterns-config found and used.])
84 fi
85
86 # else set by hand (or rather by --with..)
87 if test x$codepatterns_include_prefix != x ; then
88 if test -e $codepatterns_include_prefix/include; then
89 CodePatterns_CFLAGS="$codepatterns_include_prefix/include"
90 #AC_MSG_NOTICE([codepatterns include found and used.])
91 else
92 AC_MSG_WARN([codepatterns include not found at $codepatterns_include_prefix/include.])
93 fi
94 fi
95 if test x$cp_cv_codepatterns_libs_prefix != x ; then
96 if test -e "$cp_cv_codepatterns_libs_prefix/lib/lib$codepatterns_libname.so"; then
97 CodePatterns_LIBS="-L$cp_cv_codepatterns_libs_prefix/lib -l$codepatterns_libname"
98 #AC_MSG_NOTICE([codepatterns libs found and used.])
99 else
100 AC_MSG_WARN([codepatterns libs not found at $cp_cv_codepatterns_libs_prefix.])
101 fi
102 fi
103
104 codepatterns="no"
105 if test "x$CodePatterns_CFLAGS" != "x"; then
106 if test "x$CodePatterns_LIBS" != "x"; then
107 codepatterns="yes"
108 fi
109 fi
110
111
112 if test x$codepatterns_pkgconfig != xyes; then
113 # check version of lib
114 no_codepatterns=""
115 codepatterns_version=no
116 if test x$codepatterns = xyes; then
117 AC_MSG_CHECKING(for $codepatterns_libname - version >= $codepatterns_version_min)
118 if test "x$CodePatterns_CONFIG" != xno; then
119 codepatterns_version=`$CodePatterns_CONFIG --version`
120 else
121 codepatterns_version=""
122 fi
123
124 codepatterns_major_version=`echo $codepatterns_version | \
125 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
126 codepatterns_minor_version=`echo $codepatterns_version | \
127 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
128 codepatterns_micro_version=`echo $codepatterns_version | \
129 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
130
131 #AC_MSG_NOTICE([Version found is: $codepatterns_major_version.$codepatterns_minor_version.$codepatterns_micro_version])
132 #AC_MSG_NOTICE([Version required is: $codepatterns_version_min])
133
134 codepatterns_major_min=`echo $codepatterns_version_min | \
135 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
136 if test "x${codepatterns_major_min}" = "x" ; then
137 codepatterns_major_min=0
138 fi
139
140 codepatterns_minor_min=`echo $codepatterns_version_min | \
141 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
142 if test "x${codepatterns_minor_min}" = "x" ; then
143 codepatterns_minor_min=0
144 fi
145
146 codepatterns_micro_min=`echo $codepatterns_version_min | \
147 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
148 if test "x${codepatterns_micro_min}" = "x" ; then
149 codepatterns_micro_min=0
150 fi
151
152 if test $codepatterns_major_version -lt $codepatterns_major_min; then
153 codepatterns_version_proper=0
154 fi
155 if test $codepatterns_major_version -gt $codepatterns_major_min; then
156 codepatterns_version_proper=1
157 else
158 if test $codepatterns_minor_version -lt $codepatterns_minor_min; then
159 codepatterns_version_proper=0
160 fi
161 if test $codepatterns_minor_version -gt $codepatterns_minor_min; then
162 codepatterns_version_proper=1
163 else
164 if test $codepatterns_micro_version -ge $codepatterns_micro_min; then
165 codepatterns_version_proper=1
166 else
167 codepatterns_version_proper=0
168 fi
169 fi
170 fi
171 #AC_MSG_NOTICE([$codepatterns_version_proper])
172
173 if test $codepatterns_version_proper = 1 ; then
174 codepatterns_version=yes
175 AC_MSG_RESULT([$codepatterns_major_version.$codepatterns_minor_version.$codepatterns_micro_version])
176 else
177 AC_MSG_RESULT(no)
178 codepatterns_version=no
179 fi
180 fi
181 else
182 # with pkg-config version is checked
183 codepatterns_version=yes
184 fi
185 # check presence of lib
186 SAVE_CPPFLAGS="$CPPFLAGS"
187 SAVE_LIBS="$LIBS"
188 CPPFLAGS="$CodePatterns_CFLAGS"
189 LIBS="$CodePatterns_LIBS -lboost_thread"
190 if test x$codepatterns_version = xyes; then
191 AC_CACHE_CHECK(for $codepatterns_libname lib, cp_cv_codepatterns_lib, [
192 AC_LANG_PUSH([C++])
193 AC_LINK_IFELSE(
194 [
195 AC_LANG_PROGRAM([
196#include "CodePatterns/Singleton.hpp"
197#include "CodePatterns/Singleton_impl.hpp"
198
199// some necessary stubs
200class SingletonStub : public Singleton <SingletonStub>{
201 friend class Singleton<SingletonStub>;
202private:
203 SingletonStub(){
204 count1++;
205 }
206 // explicit copy constructor to catch if this is ever called
207 SingletonStub(const SingletonStub&){}
208 virtual ~SingletonStub(){
209 count2++;
210 }
211public:
212 static int count1;
213 static int count2;
214};
215
216int SingletonStub::count1 = 0;
217int SingletonStub::count2 = 0;
218
219CONSTRUCT_SINGLETON(SingletonStub);
220
221], [
222SingletonStub::getInstance();
223])
224 ],[
225 cp_cv_codepatterns_lib="yes"
226 ], [
227 cp_cv_codepatterns_lib="no"
228 ]
229 )
230 AC_LANG_POP([C++])
231 ])
232 fi
233 CPPFLAGS="$SAVE_CPPFLAGS"
234 LIBS="$SAVE_LIBS"
235
236 if test "x$cp_cv_codepatterns_lib" = xyes ; then
237 ifelse([$3], , :, [$3])
238 else
239 CodePatterns_CFLAGS=""
240 CodePatterns_LDFLAGS=""
241 CodePatterns_LIBS=""
242 ifelse([$4], , :, [$4])
243 fi
244
245 AC_SUBST(CodePatterns_CFLAGS)
246 AC_SUBST(CodePatterns_LDFLAGS)
247 AC_SUBST(CodePatterns_LIBS)
248])
249
Note: See TracBrowser for help on using the repository browser.