source: m4/ax_codepatterns.m4@ dcbb5d

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 dcbb5d was 22db89, checked in by Frederik Heber <heber@…>, 13 years ago

Using new version of CodePatterns 1.1.7.

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