@@ -63,16 +63,24 @@ function get_pkg_config_cflags {
6363 echo " $PKGCONFIG "
6464}
6565
66+ function cc_syntax {
67+ ${CC} " ${CC_OPT[@]} " " $@ "
68+ }
69+
70+ function cxx_syntax {
71+ ${CXX} " ${CXX_OPT[@]} " " $@ "
72+ }
73+
6674# posix.c
6775function posix_fn {
6876 echo " POSIX assumed to be present, checking syntax with ${CC} now."
69- ${CC} " ${CC_OPT[@]} " ${DIR} posix.c
77+ cc_syntax ${DIR} posix.c
7078}
7179
7280# gnu.c
7381function gnu_fn {
7482 echo " GNU assumed to be present, checking syntax with ${CC} now."
75- ${CC} " ${CC_OPT[@]} " ${DIR} gnu.c
83+ cc_syntax ${DIR} gnu.c
7684}
7785
7886# qt.cpp
@@ -92,7 +100,7 @@ function qt_fn {
92100 exit_if_strict
93101 else
94102 echo " Qt found and working, checking syntax with ${CXX} now."
95- ${CXX} " ${CXX_OPT[@]} " ${QTCONFIG} ${DIR} qt.cpp
103+ cxx_syntax ${QTCONFIG} ${DIR} qt.cpp
96104 fi
97105 else
98106 echo " Qt not present, skipping syntax check with ${CXX} ."
@@ -110,19 +118,19 @@ function bsd_fn {
110118# std.c
111119function std_c_fn {
112120 echo " C standard library assumed to be present, checking syntax with ${CC} now."
113- ${CC} " ${CC_OPT[@]} " " ${DIR} " std.c
121+ cc_syntax " ${DIR} " std.c
114122}
115123
116124# std.cpp
117125function std_cpp_fn {
118126 echo " C++ standard library assumed to be present, checking syntax with ${CXX} now."
119- ${CXX} " ${CXX_OPT[@]} " " ${DIR} " std.cpp
127+ cxx_syntax " ${DIR} " std.cpp
120128}
121129
122130# windows.cpp
123131function windows_fn {
124132 # TODO: Syntax check via g++ does not work because it can not find a valid windows.h
125- # ${CXX} "${CXX_OPT[@]}" ${DIR}windows.cpp
133+ # cxx_syntax ${DIR}windows.cpp
126134 true
127135}
128136
@@ -153,7 +161,7 @@ function wxwidgets_fn {
153161 exit_if_strict
154162 else
155163 echo " wxWidgets found, checking syntax with ${CXX} now."
156- ${CXX} " ${CXX_OPT[@]} " ${WXCONFIG} -Wno-deprecated-declarations " ${DIR} " wxwidgets.cpp
164+ cxx_syntax ${WXCONFIG} -Wno-deprecated-declarations " ${DIR} " wxwidgets.cpp
157165 fi
158166 fi
159167}
@@ -172,14 +180,14 @@ function gtk_fn {
172180 GTKCHECK_RETURNCODE=$?
173181 set -e
174182 if [ $GTKCHECK_RETURNCODE -ne 0 ]; then
175- echo " GTK+ not completely present or not working, skipping syntax check with ${CXX } ."
183+ echo " GTK+ not completely present or not working, skipping syntax check with ${CC } ."
176184 exit_if_strict
177185 else
178- echo " GTK+ found and working, checking syntax with ${CXX } now."
179- ${CC} " ${CC_OPT[@]} " ${GTKCONFIG} " ${DIR} " gtk.c
186+ echo " GTK+ found and working, checking syntax with ${CC } now."
187+ cc_syntax ${GTKCONFIG} " ${DIR} " gtk.c
180188 fi
181189 else
182- echo " GTK+ not present, skipping syntax check with ${CXX } ."
190+ echo " GTK+ not present, skipping syntax check with ${CC } ."
183191 exit_if_strict
184192 fi
185193 fi
@@ -197,7 +205,7 @@ function boost_fn {
197205 exit_if_strict
198206 else
199207 echo " Boost found and working, checking syntax with ${CXX} now."
200- ${CXX} " ${CXX_OPT[@]} " " ${DIR} " boost.cpp
208+ cxx_syntax " ${DIR} " boost.cpp
201209 fi
202210}
203211
@@ -216,7 +224,7 @@ function sqlite3_fn {
216224 exit_if_strict
217225 else
218226 echo " SQLite3 found and working, checking syntax with ${CC} now."
219- ${CC} " ${CC_OPT[@]} " ${SQLITE3CONFIG} " ${DIR} " sqlite3.c
227+ cc_syntax ${SQLITE3CONFIG} " ${DIR} " sqlite3.c
220228 fi
221229 else
222230 echo " SQLite3 not present, skipping syntax check with ${CC} ."
@@ -230,7 +238,7 @@ function openmp_fn {
230238 # MacOS compiler has no OpenMP by default
231239 if ! command -v sw_vers; then
232240 echo " OpenMP assumed to be present, checking syntax with ${CC} now."
233- ${CC} " ${CC_OPT[@]} " -fopenmp ${DIR} openmp.c
241+ cc_syntax -fopenmp ${DIR} openmp.c
234242 fi
235243}
236244
@@ -249,7 +257,7 @@ function python_fn {
249257 exit_if_strict
250258 else
251259 echo " Python 3 found and working, checking syntax with ${CC} now."
252- ${CC} " ${CC_OPT[@]} " ${PYTHON3CONFIG} " ${DIR} " python.c
260+ cc_syntax ${PYTHON3CONFIG} " ${DIR} " python.c
253261 fi
254262 else
255263 echo " Python 3 not present, skipping syntax check with ${CC} ."
@@ -273,7 +281,7 @@ function lua_fn {
273281 exit_if_strict
274282 else
275283 echo " Lua found and working, checking syntax with ${CC} now."
276- ${CC} " ${CC_OPT[@]} " ${LUACONFIG} " ${DIR} " lua.c
284+ cc_syntax ${LUACONFIG} " ${DIR} " lua.c
277285 fi
278286 else
279287 echo " Lua not present, skipping syntax check with ${CC} ."
@@ -297,7 +305,7 @@ function libcurl_fn {
297305 exit_if_strict
298306 else
299307 echo " libcurl found and working, checking syntax with ${CC} now."
300- ${CC} " ${CC_OPT[@]} " ${LIBCURLCONFIG} " ${DIR} " libcurl.c
308+ cc_syntax ${LIBCURLCONFIG} " ${DIR} " libcurl.c
301309 fi
302310 else
303311 echo " libcurl not present, skipping syntax check with ${CC} ."
@@ -321,7 +329,7 @@ function cairo_fn {
321329 exit_if_strict
322330 else
323331 echo " cairo found and working, checking syntax with ${CC} now."
324- ${CC} " ${CC_OPT[@]} " ${CAIROCONFIG} " ${DIR} " cairo.c
332+ cc_syntax ${CAIROCONFIG} " ${DIR} " cairo.c
325333 fi
326334 else
327335 echo " cairo not present, skipping syntax check with ${CC} ."
@@ -354,15 +362,15 @@ function kde_fn {
354362 else
355363 # TODO: get rid of the error enabling/disabling?
356364 set +e
357- echo -e " #include <KDE/KGlobal>\n" | ${CXX} " ${CXX_OPT[@]} " -I ${KDECONFIG} ${KDEQTCONFIG} -x c++ -
365+ echo -e " #include <KDE/KGlobal>\n" | ${CXX} " ${CXX_OPT[@]} " -isystem ${KDECONFIG} ${KDEQTCONFIG} -x c++ -
358366 KDECHECK_RETURNCODE=$?
359367 set -e
360368 if [ $KDECHECK_RETURNCODE -ne 0 ]; then
361369 echo " KDE headers not completely present or not working, skipping syntax check with ${CXX} ."
362370 exit_if_strict
363371 else
364372 echo " KDE found, checking syntax with ${CXX} now."
365- ${CXX} " ${CXX_OPT[@]} " -I ${KDECONFIG} ${KDEQTCONFIG} " ${DIR} " kde.cpp
373+ cxx_syntax -isystem ${KDECONFIG} ${KDEQTCONFIG} " ${DIR} " kde.cpp
366374 fi
367375 fi
368376 fi
@@ -383,7 +391,7 @@ function libsigcpp_fn {
383391 exit_if_strict
384392 else
385393 echo " libsigc++ found and working, checking syntax with ${CXX} now."
386- ${CXX} " ${CXX_OPT[@]} " ${LIBSIGCPPCONFIG} " ${DIR} " libsigc++.cpp
394+ cxx_syntax ${LIBSIGCPPCONFIG} " ${DIR} " libsigc++.cpp
387395 fi
388396 else
389397 echo " libsigc++ not present, skipping syntax check with ${CXX} ."
@@ -407,7 +415,7 @@ function openssl_fn {
407415 exit_if_strict
408416 else
409417 echo " OpenSSL found and working, checking syntax with ${CC} now."
410- ${CC} " ${CC_OPT[@]} " ${OPENSSLCONFIG} " ${DIR} " openssl.c
418+ cc_syntax ${OPENSSLCONFIG} " ${DIR} " openssl.c
411419 fi
412420 else
413421 echo " OpenSSL not present, skipping syntax check with ${CC} ."
@@ -431,7 +439,7 @@ function opencv2_fn {
431439 exit_if_strict
432440 else
433441 echo " OpenCV found and working, checking syntax with ${CXX} now."
434- ${CXX} " ${CXX_OPT[@]} " ${OPENCVCONFIG} " ${DIR} " opencv2.cpp
442+ cxx_syntax ${OPENCVCONFIG} " ${DIR} " opencv2.cpp
435443 fi
436444 else
437445 echo " OpenCV not present, skipping syntax check with ${CXX} ."
@@ -448,15 +456,15 @@ function cppunit_fn {
448456 exit_if_strict
449457 else
450458 echo " cppunit found, checking syntax with ${CXX} now."
451- ${CXX} " ${CXX_OPT[@]} " -Wno-deprecated-declarations " ${DIR} " cppunit.cpp
459+ cxx_syntax -Wno-deprecated-declarations " ${DIR} " cppunit.cpp
452460 fi
453461 fi
454462}
455463
456464# emscripten.cpp
457465function emscripten_fn {
458466 # TODO: Syntax check via g++ does not work because it can not find a valid emscripten.h
459- # ${CXX} "${CXX_OPT[@]}" ${DIR}emscripten.cpp
467+ # cxx_syntax ${DIR}emscripten.cpp
460468 true
461469}
462470
0 commit comments