c.m4 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031
  1. # This file is part of Autoconf. -*- Autoconf -*-
  2. # Programming languages support.
  3. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
  4. # This file is part of Autoconf. This program is free
  5. # software; you can redistribute it and/or modify it under the
  6. # terms of the GNU General Public License as published by the
  7. # Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # Under Section 7 of GPL version 3, you are granted additional
  16. # permissions described in the Autoconf Configure Script Exception,
  17. # version 3.0, as published by the Free Software Foundation.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # and a copy of the Autoconf Configure Script Exception along with
  21. # this program; see the files COPYINGv3 and COPYING.EXCEPTION
  22. # respectively. If not, see <http://www.gnu.org/licenses/>.
  23. # Written by David MacKenzie, with help from
  24. # Akim Demaille, Paul Eggert,
  25. # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
  26. # Roland McGrath, Noah Friedman, david d zuhn, and many others.
  27. # Table of Contents:
  28. #
  29. # 1. Language selection
  30. # 2. and routines to produce programs in a given language.
  31. # 1a. C 2a. C
  32. # 1b. C++
  33. # 1c. Objective C
  34. # 1d. Objective C++
  35. #
  36. # 3. Looking for a compiler
  37. # And possibly the associated preprocessor.
  38. # 3a. C 3b. C++ 3c. Objective C 3d. Objective C++
  39. #
  40. # 4. Compilers' characteristics.
  41. # 4a. C
  42. ## ----------------------- ##
  43. ## 1a/2a. The C language. ##
  44. ## ----------------------- ##
  45. # ------------------------ #
  46. # 1a. Language selection. #
  47. # ------------------------ #
  48. # AC_LANG(C)
  49. # ----------
  50. # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  51. AC_LANG_DEFINE([C], [c], [C], [CC], [],
  52. [ac_ext=c
  53. ac_cpp='$CPP $CPPFLAGS'
  54. ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
  55. ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
  56. ac_compiler_gnu=$ac_cv_c_compiler_gnu
  57. ])
  58. # AC_LANG_C
  59. # ---------
  60. AU_DEFUN([AC_LANG_C], [AC_LANG(C)])
  61. # ------------------------ #
  62. # 2a. Producing programs. #
  63. # ------------------------ #
  64. # AC_LANG_CONFTEST(C)(BODY)
  65. # -------------------------
  66. # We can't use '#line $LINENO "configure"' here, since
  67. # Sun c89 (Sun WorkShop 6 update 2 C 5.3 Patch 111679-08 2002/05/09)
  68. # rejects $LINENO greater than 32767, and some configure scripts
  69. # are longer than 32767 lines.
  70. m4_define([AC_LANG_CONFTEST(C)],
  71. [cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  72. /* end confdefs.h. */
  73. $1
  74. _ACEOF])
  75. # AC_LANG_PROGRAM(C)([PROLOGUE], [BODY])
  76. # --------------------------------------
  77. m4_define([AC_LANG_PROGRAM(C)],
  78. [$1
  79. m4_ifdef([_AC_LANG_PROGRAM_C_F77_HOOKS], [_AC_LANG_PROGRAM_C_F77_HOOKS])[]dnl
  80. m4_ifdef([_AC_LANG_PROGRAM_C_FC_HOOKS], [_AC_LANG_PROGRAM_C_FC_HOOKS])[]dnl
  81. int
  82. main ()
  83. {
  84. dnl Do *not* indent the following line: there may be CPP directives.
  85. dnl Don't move the `;' right after for the same reason.
  86. $2
  87. ;
  88. return 0;
  89. }])
  90. # _AC_LANG_IO_PROGRAM(C)
  91. # ----------------------
  92. # Produce source that performs I/O, necessary for proper
  93. # cross-compiler detection.
  94. m4_define([_AC_LANG_IO_PROGRAM(C)],
  95. [AC_LANG_PROGRAM([@%:@include <stdio.h>],
  96. [FILE *f = fopen ("conftest.out", "w");
  97. return ferror (f) || fclose (f) != 0;
  98. ])])
  99. # AC_LANG_CALL(C)(PROLOGUE, FUNCTION)
  100. # -----------------------------------
  101. # Avoid conflicting decl of main.
  102. m4_define([AC_LANG_CALL(C)],
  103. [AC_LANG_PROGRAM([$1
  104. m4_if([$2], [main], ,
  105. [/* Override any GCC internal prototype to avoid an error.
  106. Use char because int might match the return type of a GCC
  107. builtin and then its argument prototype would still apply. */
  108. #ifdef __cplusplus
  109. extern "C"
  110. #endif
  111. char $2 ();])], [return $2 ();])])
  112. # AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
  113. # ----------------------------------
  114. # Don't include <ctype.h> because on OSF/1 3.0 it includes
  115. # <sys/types.h> which includes <sys/select.h> which contains a
  116. # prototype for select. Similarly for bzero.
  117. #
  118. # This test used to merely assign f=$1 in main(), but that was
  119. # optimized away by HP unbundled cc A.05.36 for ia64 under +O3,
  120. # presumably on the basis that there's no need to do that store if the
  121. # program is about to exit. Conversely, the AIX linker optimizes an
  122. # unused external declaration that initializes f=$1. So this test
  123. # program has both an external initialization of f, and a use of f in
  124. # main that affects the exit status.
  125. #
  126. m4_define([AC_LANG_FUNC_LINK_TRY(C)],
  127. [AC_LANG_PROGRAM(
  128. [/* Define $1 to an innocuous variant, in case <limits.h> declares $1.
  129. For example, HP-UX 11i <limits.h> declares gettimeofday. */
  130. #define $1 innocuous_$1
  131. /* System header to define __stub macros and hopefully few prototypes,
  132. which can conflict with char $1 (); below.
  133. Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  134. <limits.h> exists even on freestanding compilers. */
  135. #ifdef __STDC__
  136. # include <limits.h>
  137. #else
  138. # include <assert.h>
  139. #endif
  140. #undef $1
  141. /* Override any GCC internal prototype to avoid an error.
  142. Use char because int might match the return type of a GCC
  143. builtin and then its argument prototype would still apply. */
  144. #ifdef __cplusplus
  145. extern "C"
  146. #endif
  147. char $1 ();
  148. /* The GNU C library defines this for functions which it implements
  149. to always fail with ENOSYS. Some functions are actually named
  150. something starting with __ and the normal name is an alias. */
  151. #if defined __stub_$1 || defined __stub___$1
  152. choke me
  153. #endif
  154. ], [return $1 ();])])
  155. # AC_LANG_BOOL_COMPILE_TRY(C)(PROLOGUE, EXPRESSION)
  156. # -------------------------------------------------
  157. # Return a program that is valid if EXPRESSION is nonzero.
  158. # EXPRESSION must be an integer constant expression.
  159. # Be sure to use this array to avoid `unused' warnings, which are even
  160. # errors with `-W error'.
  161. m4_define([AC_LANG_BOOL_COMPILE_TRY(C)],
  162. [AC_LANG_PROGRAM([$1], [static int test_array @<:@1 - 2 * !($2)@:>@;
  163. test_array @<:@0@:>@ = 0;
  164. return test_array @<:@0@:>@;
  165. ])])
  166. # AC_LANG_INT_SAVE(C)(PROLOGUE, EXPRESSION)
  167. # -----------------------------------------
  168. # We need `stdio.h' to open a `FILE' and `stdlib.h' for `exit'.
  169. # But we include them only after the EXPRESSION has been evaluated.
  170. m4_define([AC_LANG_INT_SAVE(C)],
  171. [AC_LANG_PROGRAM([$1
  172. static long int longval () { return $2; }
  173. static unsigned long int ulongval () { return $2; }
  174. @%:@include <stdio.h>
  175. @%:@include <stdlib.h>],
  176. [
  177. FILE *f = fopen ("conftest.val", "w");
  178. if (! f)
  179. return 1;
  180. if (($2) < 0)
  181. {
  182. long int i = longval ();
  183. if (i != ($2))
  184. return 1;
  185. fprintf (f, "%ld", i);
  186. }
  187. else
  188. {
  189. unsigned long int i = ulongval ();
  190. if (i != ($2))
  191. return 1;
  192. fprintf (f, "%lu", i);
  193. }
  194. /* Do not output a trailing newline, as this causes \r\n confusion
  195. on some platforms. */
  196. return ferror (f) || fclose (f) != 0;
  197. ])])
  198. ## ---------------------- ##
  199. ## 1b. The C++ language. ##
  200. ## ---------------------- ##
  201. # AC_LANG(C++)
  202. # ------------
  203. # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
  204. AC_LANG_DEFINE([C++], [cxx], [CXX], [CXX], [C],
  205. [ac_ext=cpp
  206. ac_cpp='$CXXCPP $CPPFLAGS'
  207. ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
  208. ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
  209. ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
  210. ])
  211. # AC_LANG_CPLUSPLUS
  212. # -----------------
  213. AU_DEFUN([AC_LANG_CPLUSPLUS], [AC_LANG(C++)])
  214. ## ------------------------------ ##
  215. ## 1c. The Objective C language. ##
  216. ## ------------------------------ ##
  217. # AC_LANG(Objective C)
  218. # --------------------
  219. AC_LANG_DEFINE([Objective C], [objc], [OBJC], [OBJC], [C],
  220. [ac_ext=m
  221. ac_cpp='$OBJCPP $CPPFLAGS'
  222. ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
  223. ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
  224. ac_compiler_gnu=$ac_cv_objc_compiler_gnu
  225. ])
  226. # AC_LANG_OBJC
  227. # ------------
  228. AU_DEFUN([AC_LANG_OBJC], [AC_LANG(Objective C)])
  229. ## -------------------------------- ##
  230. ## 1d. The Objective C++ language. ##
  231. ## -------------------------------- ##
  232. # AC_LANG(Objective C++)
  233. # ----------------------
  234. AC_LANG_DEFINE([Objective C++], [objcxx], [OBJCXX], [OBJCXX], [C++],
  235. [ac_ext=mm
  236. ac_cpp='$OBJCXXCPP $CPPFLAGS'
  237. ac_compile='$OBJCXX -c $OBJCXXFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
  238. ac_link='$OBJCXX -o conftest$ac_exeext $OBJCXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
  239. ac_compiler_gnu=$ac_cv_objcxx_compiler_gnu
  240. ])
  241. ## -------------------------------------------- ##
  242. ## 3. Looking for Compilers and Preprocessors. ##
  243. ## -------------------------------------------- ##
  244. # -------------------- #
  245. # 3a. The C compiler. #
  246. # -------------------- #
  247. # _AC_ARG_VAR_CPPFLAGS
  248. # --------------------
  249. # Document and register CPPFLAGS, which is used by
  250. # AC_PROG_{CC, CPP, CXX, CXXCPP, OBJC, OBJCPP, OBJCXX, OBJCXXCPP}.
  251. AC_DEFUN([_AC_ARG_VAR_CPPFLAGS],
  252. [AC_ARG_VAR([CPPFLAGS],
  253. [(Objective) C/C++ preprocessor flags, e.g. -I<include dir>
  254. if you have headers in a nonstandard directory <include dir>])])
  255. # _AC_ARG_VAR_LDFLAGS
  256. # -------------------
  257. # Document and register LDFLAGS, which is used by
  258. # AC_PROG_{CC, CXX, F77, FC, OBJC, OBJCXX}.
  259. AC_DEFUN([_AC_ARG_VAR_LDFLAGS],
  260. [AC_ARG_VAR([LDFLAGS],
  261. [linker flags, e.g. -L<lib dir> if you have libraries in a
  262. nonstandard directory <lib dir>])])
  263. # _AC_ARG_VAR_LIBS
  264. # ----------------
  265. # Document and register LIBS, which is used by
  266. # AC_PROG_{CC, CXX, F77, FC, OBJC, OBJCXX}.
  267. AC_DEFUN([_AC_ARG_VAR_LIBS],
  268. [AC_ARG_VAR([LIBS],
  269. [libraries to pass to the linker, e.g. -l<library>])])
  270. # AC_LANG_PREPROC(C)
  271. # ------------------
  272. # Find the C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
  273. AC_DEFUN([AC_LANG_PREPROC(C)],
  274. [AC_REQUIRE([AC_PROG_CPP])])
  275. # _AC_PROG_PREPROC_WORKS_IFELSE(IF-WORKS, IF-NOT)
  276. # -----------------------------------------------
  277. # Check if $ac_cpp is a working preprocessor that can flag absent
  278. # includes either by the exit status or by warnings.
  279. # This macro is for all languages, not only C.
  280. AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE],
  281. [ac_preproc_ok=false
  282. for ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in '' yes
  283. do
  284. # Use a header file that comes with gcc, so configuring glibc
  285. # with a fresh cross-compiler works.
  286. # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  287. # <limits.h> exists even on freestanding compilers.
  288. # On the NeXT, cc -E runs the code through the compiler's parser,
  289. # not just through cpp. "Syntax error" is here to catch this case.
  290. _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@ifdef __STDC__
  291. @%:@ include <limits.h>
  292. @%:@else
  293. @%:@ include <assert.h>
  294. @%:@endif
  295. Syntax error]])],
  296. [],
  297. [# Broken: fails on valid input.
  298. continue])
  299. # OK, works on sane cases. Now check whether nonexistent headers
  300. # can be detected and how.
  301. _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <ac_nonexistent.h>]])],
  302. [# Broken: success on invalid input.
  303. continue],
  304. [# Passes both tests.
  305. ac_preproc_ok=:
  306. break])
  307. done
  308. # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
  309. rm -f conftest.i conftest.err conftest.$ac_ext
  310. AS_IF([$ac_preproc_ok], [$1], [$2])
  311. ])# _AC_PROG_PREPROC_WORKS_IFELSE
  312. # AC_PROG_CPP
  313. # -----------
  314. # Find a working C preprocessor.
  315. # We shouldn't have to require AC_PROG_CC, but this is due to the concurrency
  316. # between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_CC.
  317. AN_MAKEVAR([CPP], [AC_PROG_CPP])
  318. AN_PROGRAM([cpp], [AC_PROG_CPP])
  319. AC_DEFUN([AC_PROG_CPP],
  320. [AC_REQUIRE([AC_PROG_CC])dnl
  321. AC_ARG_VAR([CPP], [C preprocessor])dnl
  322. _AC_ARG_VAR_CPPFLAGS()dnl
  323. AC_LANG_PUSH(C)dnl
  324. AC_MSG_CHECKING([how to run the C preprocessor])
  325. # On Suns, sometimes $CPP names a directory.
  326. if test -n "$CPP" && test -d "$CPP"; then
  327. CPP=
  328. fi
  329. if test -z "$CPP"; then
  330. AC_CACHE_VAL([ac_cv_prog_CPP],
  331. [dnl
  332. # Double quotes because CPP needs to be expanded
  333. for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
  334. do
  335. _AC_PROG_PREPROC_WORKS_IFELSE([break])
  336. done
  337. ac_cv_prog_CPP=$CPP
  338. ])dnl
  339. CPP=$ac_cv_prog_CPP
  340. else
  341. ac_cv_prog_CPP=$CPP
  342. fi
  343. AC_MSG_RESULT([$CPP])
  344. _AC_PROG_PREPROC_WORKS_IFELSE([],
  345. [AC_MSG_FAILURE([C preprocessor "$CPP" fails sanity check])])
  346. AC_SUBST(CPP)dnl
  347. AC_LANG_POP(C)dnl
  348. ])# AC_PROG_CPP
  349. # AC_PROG_CPP_WERROR
  350. # ------------------
  351. # Treat warnings from the preprocessor as errors.
  352. AC_DEFUN([AC_PROG_CPP_WERROR],
  353. [AC_REQUIRE([AC_PROG_CPP])dnl
  354. ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR
  355. # AC_LANG_COMPILER(C)
  356. # -------------------
  357. # Find the C compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
  358. AC_DEFUN([AC_LANG_COMPILER(C)],
  359. [AC_REQUIRE([AC_PROG_CC])])
  360. # ac_cv_prog_gcc
  361. # --------------
  362. # We used to name the cache variable this way.
  363. AU_DEFUN([ac_cv_prog_gcc],
  364. [ac_cv_c_compiler_gnu])
  365. # AC_PROG_CC([COMPILER ...])
  366. # --------------------------
  367. # COMPILER ... is a space separated list of C compilers to search for.
  368. # This just gives the user an opportunity to specify an alternative
  369. # search list for the C compiler.
  370. AN_MAKEVAR([CC], [AC_PROG_CC])
  371. AN_PROGRAM([cc], [AC_PROG_CC])
  372. AN_PROGRAM([gcc], [AC_PROG_CC])
  373. AC_DEFUN([AC_PROG_CC],
  374. [AC_LANG_PUSH(C)dnl
  375. AC_ARG_VAR([CC], [C compiler command])dnl
  376. AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
  377. _AC_ARG_VAR_LDFLAGS()dnl
  378. _AC_ARG_VAR_LIBS()dnl
  379. _AC_ARG_VAR_CPPFLAGS()dnl
  380. m4_ifval([$1],
  381. [AC_CHECK_TOOLS(CC, [$1])],
  382. [AC_CHECK_TOOL(CC, gcc)
  383. if test -z "$CC"; then
  384. dnl Here we want:
  385. dnl AC_CHECK_TOOL(CC, cc)
  386. dnl but without the check for a tool without the prefix.
  387. dnl Until the check is removed from there, copy the code:
  388. if test -n "$ac_tool_prefix"; then
  389. AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc])
  390. fi
  391. fi
  392. if test -z "$CC"; then
  393. AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
  394. fi
  395. if test -z "$CC"; then
  396. AC_CHECK_TOOLS(CC, cl.exe)
  397. fi
  398. ])
  399. test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
  400. # Provide some information about the compiler.
  401. _AS_ECHO_LOG([checking for _AC_LANG compiler version])
  402. set X $ac_compile
  403. ac_compiler=$[2]
  404. for ac_option in --version -v -V -qversion; do
  405. _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
  406. done
  407. m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
  408. m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
  409. _AC_LANG_COMPILER_GNU
  410. if test $ac_compiler_gnu = yes; then
  411. GCC=yes
  412. else
  413. GCC=
  414. fi
  415. _AC_PROG_CC_G
  416. _AC_PROG_CC_C89
  417. AC_LANG_POP(C)dnl
  418. ])# AC_PROG_CC
  419. # _AC_PROG_CC_G
  420. # -------------
  421. # Check whether -g works, even if CFLAGS is set, in case the package
  422. # plays around with CFLAGS (such as to build both debugging and normal
  423. # versions of a library), tasteless as that idea is.
  424. # Don't consider -g to work if it generates warnings when plain compiles don't.
  425. m4_define([_AC_PROG_CC_G],
  426. [ac_test_CFLAGS=${CFLAGS+set}
  427. ac_save_CFLAGS=$CFLAGS
  428. AC_CACHE_CHECK(whether $CC accepts -g, ac_cv_prog_cc_g,
  429. [ac_save_c_werror_flag=$ac_c_werror_flag
  430. ac_c_werror_flag=yes
  431. ac_cv_prog_cc_g=no
  432. CFLAGS="-g"
  433. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  434. [ac_cv_prog_cc_g=yes],
  435. [CFLAGS=""
  436. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  437. [],
  438. [ac_c_werror_flag=$ac_save_c_werror_flag
  439. CFLAGS="-g"
  440. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  441. [ac_cv_prog_cc_g=yes])])])
  442. ac_c_werror_flag=$ac_save_c_werror_flag])
  443. if test "$ac_test_CFLAGS" = set; then
  444. CFLAGS=$ac_save_CFLAGS
  445. elif test $ac_cv_prog_cc_g = yes; then
  446. if test "$GCC" = yes; then
  447. CFLAGS="-g -O2"
  448. else
  449. CFLAGS="-g"
  450. fi
  451. else
  452. if test "$GCC" = yes; then
  453. CFLAGS="-O2"
  454. else
  455. CFLAGS=
  456. fi
  457. fi[]dnl
  458. ])# _AC_PROG_CC_G
  459. # AC_PROG_GCC_TRADITIONAL
  460. # -----------------------
  461. AC_DEFUN([AC_PROG_GCC_TRADITIONAL],
  462. [AC_REQUIRE([AC_PROG_CC])dnl
  463. if test $ac_cv_c_compiler_gnu = yes; then
  464. AC_CACHE_CHECK(whether $CC needs -traditional,
  465. ac_cv_prog_gcc_traditional,
  466. [ ac_pattern="Autoconf.*'x'"
  467. AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
  468. Autoconf TIOCGETP],
  469. ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
  470. if test $ac_cv_prog_gcc_traditional = no; then
  471. AC_EGREP_CPP($ac_pattern, [#include <termio.h>
  472. Autoconf TCGETA],
  473. ac_cv_prog_gcc_traditional=yes)
  474. fi])
  475. if test $ac_cv_prog_gcc_traditional = yes; then
  476. CC="$CC -traditional"
  477. fi
  478. fi
  479. ])# AC_PROG_GCC_TRADITIONAL
  480. # AC_PROG_CC_C_O
  481. # --------------
  482. AC_DEFUN([AC_PROG_CC_C_O],
  483. [AC_REQUIRE([AC_PROG_CC])dnl
  484. if test "x$CC" != xcc; then
  485. AC_MSG_CHECKING([whether $CC and cc understand -c and -o together])
  486. else
  487. AC_MSG_CHECKING([whether cc understands -c and -o together])
  488. fi
  489. set dummy $CC; ac_cc=`AS_ECHO(["$[2]"]) |
  490. sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
  491. AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
  492. [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
  493. # Make sure it works both with $CC and with simple cc.
  494. # We do the test twice because some compilers refuse to overwrite an
  495. # existing .o file with -o, though they will create one.
  496. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
  497. rm -f conftest2.*
  498. if _AC_DO_VAR(ac_try) &&
  499. test -f conftest2.$ac_objext && _AC_DO_VAR(ac_try);
  500. then
  501. eval ac_cv_prog_cc_${ac_cc}_c_o=yes
  502. if test "x$CC" != xcc; then
  503. # Test first that cc exists at all.
  504. if _AC_DO_TOKENS(cc -c conftest.$ac_ext >&AS_MESSAGE_LOG_FD); then
  505. ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
  506. rm -f conftest2.*
  507. if _AC_DO_VAR(ac_try) &&
  508. test -f conftest2.$ac_objext && _AC_DO_VAR(ac_try);
  509. then
  510. # cc works too.
  511. :
  512. else
  513. # cc exists but doesn't like -o.
  514. eval ac_cv_prog_cc_${ac_cc}_c_o=no
  515. fi
  516. fi
  517. fi
  518. else
  519. eval ac_cv_prog_cc_${ac_cc}_c_o=no
  520. fi
  521. rm -f core conftest*
  522. ])dnl
  523. if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
  524. AC_MSG_RESULT([yes])
  525. else
  526. AC_MSG_RESULT([no])
  527. AC_DEFINE(NO_MINUS_C_MINUS_O, 1,
  528. [Define to 1 if your C compiler doesn't accept -c and -o together.])
  529. fi
  530. ])# AC_PROG_CC_C_O
  531. # ---------------------- #
  532. # 3b. The C++ compiler. #
  533. # ---------------------- #
  534. # AC_LANG_PREPROC(C++)
  535. # --------------------
  536. # Find the C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
  537. AC_DEFUN([AC_LANG_PREPROC(C++)],
  538. [AC_REQUIRE([AC_PROG_CXXCPP])])
  539. # AC_PROG_CXXCPP
  540. # --------------
  541. # Find a working C++ preprocessor.
  542. # We shouldn't have to require AC_PROG_CC, but this is due to the concurrency
  543. # between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_CXX.
  544. AC_DEFUN([AC_PROG_CXXCPP],
  545. [AC_REQUIRE([AC_PROG_CXX])dnl
  546. AC_ARG_VAR([CXXCPP], [C++ preprocessor])dnl
  547. _AC_ARG_VAR_CPPFLAGS()dnl
  548. AC_LANG_PUSH(C++)dnl
  549. AC_MSG_CHECKING([how to run the C++ preprocessor])
  550. if test -z "$CXXCPP"; then
  551. AC_CACHE_VAL(ac_cv_prog_CXXCPP,
  552. [dnl
  553. # Double quotes because CXXCPP needs to be expanded
  554. for CXXCPP in "$CXX -E" "/lib/cpp"
  555. do
  556. _AC_PROG_PREPROC_WORKS_IFELSE([break])
  557. done
  558. ac_cv_prog_CXXCPP=$CXXCPP
  559. ])dnl
  560. CXXCPP=$ac_cv_prog_CXXCPP
  561. else
  562. ac_cv_prog_CXXCPP=$CXXCPP
  563. fi
  564. AC_MSG_RESULT([$CXXCPP])
  565. _AC_PROG_PREPROC_WORKS_IFELSE([],
  566. [AC_MSG_FAILURE([C++ preprocessor "$CXXCPP" fails sanity check])])
  567. AC_SUBST(CXXCPP)dnl
  568. AC_LANG_POP(C++)dnl
  569. ])# AC_PROG_CXXCPP
  570. # AC_LANG_COMPILER(C++)
  571. # ---------------------
  572. # Find the C++ compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
  573. AC_DEFUN([AC_LANG_COMPILER(C++)],
  574. [AC_REQUIRE([AC_PROG_CXX])])
  575. # ac_cv_prog_gxx
  576. # --------------
  577. # We used to name the cache variable this way.
  578. AU_DEFUN([ac_cv_prog_gxx],
  579. [ac_cv_cxx_compiler_gnu])
  580. # AC_PROG_CXX([LIST-OF-COMPILERS])
  581. # --------------------------------
  582. # LIST-OF-COMPILERS is a space separated list of C++ compilers to search
  583. # for (if not specified, a default list is used). This just gives the
  584. # user an opportunity to specify an alternative search list for the C++
  585. # compiler.
  586. # aCC HP-UX C++ compiler much better than `CC', so test before.
  587. # FCC Fujitsu C++ compiler
  588. # KCC KAI C++ compiler
  589. # RCC Rational C++
  590. # xlC_r AIX C Set++ (with support for reentrant code)
  591. # xlC AIX C Set++
  592. AN_MAKEVAR([CXX], [AC_PROG_CXX])
  593. AN_PROGRAM([CC], [AC_PROG_CXX])
  594. AN_PROGRAM([c++], [AC_PROG_CXX])
  595. AN_PROGRAM([g++], [AC_PROG_CXX])
  596. AC_DEFUN([AC_PROG_CXX],
  597. [AC_LANG_PUSH(C++)dnl
  598. AC_ARG_VAR([CXX], [C++ compiler command])dnl
  599. AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl
  600. _AC_ARG_VAR_LDFLAGS()dnl
  601. _AC_ARG_VAR_LIBS()dnl
  602. _AC_ARG_VAR_CPPFLAGS()dnl
  603. _AC_ARG_VAR_PRECIOUS([CCC])dnl
  604. if test -z "$CXX"; then
  605. if test -n "$CCC"; then
  606. CXX=$CCC
  607. else
  608. AC_CHECK_TOOLS(CXX,
  609. [m4_default([$1],
  610. [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC])],
  611. g++)
  612. fi
  613. fi
  614. # Provide some information about the compiler.
  615. _AS_ECHO_LOG([checking for _AC_LANG compiler version])
  616. set X $ac_compile
  617. ac_compiler=$[2]
  618. for ac_option in --version -v -V -qversion; do
  619. _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
  620. done
  621. m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
  622. m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
  623. _AC_LANG_COMPILER_GNU
  624. if test $ac_compiler_gnu = yes; then
  625. GXX=yes
  626. else
  627. GXX=
  628. fi
  629. _AC_PROG_CXX_G
  630. AC_LANG_POP(C++)dnl
  631. ])# AC_PROG_CXX
  632. # _AC_PROG_CXX_G
  633. # --------------
  634. # Check whether -g works, even if CXXFLAGS is set, in case the package
  635. # plays around with CXXFLAGS (such as to build both debugging and
  636. # normal versions of a library), tasteless as that idea is.
  637. # Don't consider -g to work if it generates warnings when plain compiles don't.
  638. m4_define([_AC_PROG_CXX_G],
  639. [ac_test_CXXFLAGS=${CXXFLAGS+set}
  640. ac_save_CXXFLAGS=$CXXFLAGS
  641. AC_CACHE_CHECK(whether $CXX accepts -g, ac_cv_prog_cxx_g,
  642. [ac_save_cxx_werror_flag=$ac_cxx_werror_flag
  643. ac_cxx_werror_flag=yes
  644. ac_cv_prog_cxx_g=no
  645. CXXFLAGS="-g"
  646. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  647. [ac_cv_prog_cxx_g=yes],
  648. [CXXFLAGS=""
  649. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  650. [],
  651. [ac_cxx_werror_flag=$ac_save_cxx_werror_flag
  652. CXXFLAGS="-g"
  653. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  654. [ac_cv_prog_cxx_g=yes])])])
  655. ac_cxx_werror_flag=$ac_save_cxx_werror_flag])
  656. if test "$ac_test_CXXFLAGS" = set; then
  657. CXXFLAGS=$ac_save_CXXFLAGS
  658. elif test $ac_cv_prog_cxx_g = yes; then
  659. if test "$GXX" = yes; then
  660. CXXFLAGS="-g -O2"
  661. else
  662. CXXFLAGS="-g"
  663. fi
  664. else
  665. if test "$GXX" = yes; then
  666. CXXFLAGS="-O2"
  667. else
  668. CXXFLAGS=
  669. fi
  670. fi[]dnl
  671. ])# _AC_PROG_CXX_G
  672. # AC_PROG_CXX_C_O
  673. # ---------------
  674. # Test if the C++ compiler accepts the options `-c' and `-o'
  675. # simultaneously, and define `CXX_NO_MINUS_C_MINUS_O' if it does not.
  676. AC_DEFUN([AC_PROG_CXX_C_O],
  677. [AC_REQUIRE([AC_PROG_CXX])dnl
  678. AC_LANG_PUSH([C++])dnl
  679. AC_CACHE_CHECK([whether $CXX understands -c and -o together],
  680. [ac_cv_prog_cxx_c_o],
  681. [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
  682. # We test twice because some compilers refuse to overwrite an existing
  683. # `.o' file with `-o', although they will create one.
  684. ac_try='$CXX $CXXFLAGS -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
  685. rm -f conftest2.*
  686. if _AC_DO_VAR(ac_try) &&
  687. test -f conftest2.$ac_objext &&
  688. _AC_DO_VAR(ac_try); then
  689. ac_cv_prog_cxx_c_o=yes
  690. else
  691. ac_cv_prog_cxx_c_o=no
  692. fi
  693. rm -f conftest*])
  694. if test $ac_cv_prog_cxx_c_o = no; then
  695. AC_DEFINE(CXX_NO_MINUS_C_MINUS_O, 1,
  696. [Define to 1 if your C++ compiler doesn't accept
  697. -c and -o together.])
  698. fi
  699. AC_LANG_POP([C++])dnl
  700. ])# AC_PROG_CXX_C_O
  701. # ------------------------------ #
  702. # 3c. The Objective C compiler. #
  703. # ------------------------------ #
  704. # AC_LANG_PREPROC(Objective C)
  705. # ----------------------------
  706. # Find the Objective C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
  707. AC_DEFUN([AC_LANG_PREPROC(Objective C)],
  708. [AC_REQUIRE([AC_PROG_OBJCPP])])
  709. # AC_PROG_OBJCPP
  710. # --------------
  711. # Find a working Objective C preprocessor.
  712. AC_DEFUN([AC_PROG_OBJCPP],
  713. [AC_REQUIRE([AC_PROG_OBJC])dnl
  714. AC_ARG_VAR([OBJCPP], [Objective C preprocessor])dnl
  715. _AC_ARG_VAR_CPPFLAGS()dnl
  716. AC_LANG_PUSH(Objective C)dnl
  717. AC_MSG_CHECKING([how to run the Objective C preprocessor])
  718. if test -z "$OBJCPP"; then
  719. AC_CACHE_VAL(ac_cv_prog_OBJCPP,
  720. [dnl
  721. # Double quotes because OBJCPP needs to be expanded
  722. for OBJCPP in "$OBJC -E" "/lib/cpp"
  723. do
  724. _AC_PROG_PREPROC_WORKS_IFELSE([break])
  725. done
  726. ac_cv_prog_OBJCPP=$OBJCPP
  727. ])dnl
  728. OBJCPP=$ac_cv_prog_OBJCPP
  729. else
  730. ac_cv_prog_OBJCPP=$OBJCPP
  731. fi
  732. AC_MSG_RESULT([$OBJCPP])
  733. _AC_PROG_PREPROC_WORKS_IFELSE([],
  734. [AC_MSG_FAILURE([Objective C preprocessor "$OBJCPP" fails sanity check])])
  735. AC_SUBST(OBJCPP)dnl
  736. AC_LANG_POP(Objective C)dnl
  737. ])# AC_PROG_OBJCPP
  738. # AC_LANG_COMPILER(Objective C)
  739. # -----------------------------
  740. # Find the Objective C compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
  741. AC_DEFUN([AC_LANG_COMPILER(Objective C)],
  742. [AC_REQUIRE([AC_PROG_OBJC])])
  743. # AC_PROG_OBJC([LIST-OF-COMPILERS])
  744. # ---------------------------------
  745. # LIST-OF-COMPILERS is a space separated list of Objective C compilers to
  746. # search for (if not specified, a default list is used). This just gives
  747. # the user an opportunity to specify an alternative search list for the
  748. # Objective C compiler.
  749. # objcc StepStone Objective-C compiler (also "standard" name for OBJC)
  750. # objc David Stes' POC. If you installed this, you likely want it.
  751. # cc Native C compiler (for instance, Apple).
  752. # CC You never know.
  753. AN_MAKEVAR([OBJC], [AC_PROG_OBJC])
  754. AN_PROGRAM([objcc], [AC_PROG_OBJC])
  755. AN_PROGRAM([objc], [AC_PROG_OBJC])
  756. AC_DEFUN([AC_PROG_OBJC],
  757. [AC_LANG_PUSH(Objective C)dnl
  758. AC_ARG_VAR([OBJC], [Objective C compiler command])dnl
  759. AC_ARG_VAR([OBJCFLAGS], [Objective C compiler flags])dnl
  760. _AC_ARG_VAR_LDFLAGS()dnl
  761. _AC_ARG_VAR_LIBS()dnl
  762. _AC_ARG_VAR_CPPFLAGS()dnl
  763. _AC_ARG_VAR_PRECIOUS([OBJC])dnl
  764. AC_CHECK_TOOLS(OBJC,
  765. [m4_default([$1], [gcc objcc objc cc CC])],
  766. gcc)
  767. # Provide some information about the compiler.
  768. _AS_ECHO_LOG([checking for _AC_LANG compiler version])
  769. set X $ac_compile
  770. ac_compiler=$[2]
  771. for ac_option in --version -v -V -qversion; do
  772. _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
  773. done
  774. m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
  775. m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
  776. _AC_LANG_COMPILER_GNU
  777. if test $ac_compiler_gnu = yes; then
  778. GOBJC=yes
  779. else
  780. GOBJC=
  781. fi
  782. _AC_PROG_OBJC_G
  783. AC_LANG_POP(Objective C)dnl
  784. ])# AC_PROG_OBJC
  785. # _AC_PROG_OBJC_G
  786. # ---------------
  787. # Check whether -g works, even if OBJCFLAGS is set, in case the package
  788. # plays around with OBJCFLAGS (such as to build both debugging and
  789. # normal versions of a library), tasteless as that idea is.
  790. # Don't consider -g to work if it generates warnings when plain compiles don't.
  791. m4_define([_AC_PROG_OBJC_G],
  792. [ac_test_OBJCFLAGS=${OBJCFLAGS+set}
  793. ac_save_OBJCFLAGS=$OBJCFLAGS
  794. AC_CACHE_CHECK(whether $OBJC accepts -g, ac_cv_prog_objc_g,
  795. [ac_save_objc_werror_flag=$ac_objc_werror_flag
  796. ac_objc_werror_flag=yes
  797. ac_cv_prog_objc_g=no
  798. OBJCFLAGS="-g"
  799. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  800. [ac_cv_prog_objc_g=yes],
  801. [OBJCFLAGS=""
  802. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  803. [],
  804. [ac_objc_werror_flag=$ac_save_objc_werror_flag
  805. OBJCFLAGS="-g"
  806. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  807. [ac_cv_prog_objc_g=yes])])])
  808. ac_objc_werror_flag=$ac_save_objc_werror_flag])
  809. if test "$ac_test_OBJCFLAGS" = set; then
  810. OBJCFLAGS=$ac_save_OBJCFLAGS
  811. elif test $ac_cv_prog_objc_g = yes; then
  812. if test "$GOBJC" = yes; then
  813. OBJCFLAGS="-g -O2"
  814. else
  815. OBJCFLAGS="-g"
  816. fi
  817. else
  818. if test "$GOBJC" = yes; then
  819. OBJCFLAGS="-O2"
  820. else
  821. OBJCFLAGS=
  822. fi
  823. fi[]dnl
  824. ])# _AC_PROG_OBJC_G
  825. # -------------------------------- #
  826. # 3d. The Objective C++ compiler. #
  827. # -------------------------------- #
  828. # AC_LANG_PREPROC(Objective C++)
  829. # ------------------------------
  830. # Find the Objective C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
  831. AC_DEFUN([AC_LANG_PREPROC(Objective C++)],
  832. [AC_REQUIRE([AC_PROG_OBJCXXCPP])])
  833. # AC_PROG_OBJCXXCPP
  834. # -----------------
  835. # Find a working Objective C++ preprocessor.
  836. AC_DEFUN([AC_PROG_OBJCXXCPP],
  837. [AC_REQUIRE([AC_PROG_OBJCXX])dnl
  838. AC_ARG_VAR([OBJCXXCPP], [Objective C++ preprocessor])dnl
  839. _AC_ARG_VAR_CPPFLAGS()dnl
  840. AC_LANG_PUSH(Objective C++)dnl
  841. AC_MSG_CHECKING([how to run the Objective C++ preprocessor])
  842. if test -z "$OBJCXXCPP"; then
  843. AC_CACHE_VAL(ac_cv_prog_OBJCXXCPP,
  844. [dnl
  845. # Double quotes because OBJCXXCPP needs to be expanded
  846. for OBJCXXCPP in "$OBJCXX -E" "/lib/cpp"
  847. do
  848. _AC_PROG_PREPROC_WORKS_IFELSE([break])
  849. done
  850. ac_cv_prog_OBJCXXCPP=$OBJCXXCPP
  851. ])dnl
  852. OBJCXXCPP=$ac_cv_prog_OBJCXXCPP
  853. else
  854. ac_cv_prog_OBJCXXCPP=$OBJCXXCPP
  855. fi
  856. AC_MSG_RESULT([$OBJCXXCPP])
  857. _AC_PROG_PREPROC_WORKS_IFELSE([],
  858. [AC_MSG_FAILURE([Objective C++ preprocessor "$OBJCXXCPP" fails sanity check])])
  859. AC_SUBST(OBJCXXCPP)dnl
  860. AC_LANG_POP(Objective C++)dnl
  861. ])# AC_PROG_OBJCXXCPP
  862. # AC_LANG_COMPILER(Objective C++)
  863. # -------------------------------
  864. # Find the Objective C++ compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
  865. AC_DEFUN([AC_LANG_COMPILER(Objective C++)],
  866. [AC_REQUIRE([AC_PROG_OBJCXX])])
  867. # AC_PROG_OBJCXX([LIST-OF-COMPILERS])
  868. # -----------------------------------
  869. # LIST-OF-COMPILERS is a space separated list of Objective C++ compilers to
  870. # search for (if not specified, a default list is used). This just gives
  871. # the user an opportunity to specify an alternative search list for the
  872. # Objective C++ compiler.
  873. # FIXME: this list is pure guesswork
  874. # objc++ StepStone Objective-C++ compiler (also "standard" name for OBJCXX)
  875. # objcxx David Stes' POC. If you installed this, you likely want it.
  876. # c++ Native C++ compiler (for instance, Apple).
  877. # CXX You never know.
  878. AN_MAKEVAR([OBJCXX], [AC_PROG_OBJCXX])
  879. AN_PROGRAM([objcxx], [AC_PROG_OBJCXX])
  880. AC_DEFUN([AC_PROG_OBJCXX],
  881. [AC_LANG_PUSH(Objective C++)dnl
  882. AC_ARG_VAR([OBJCXX], [Objective C++ compiler command])dnl
  883. AC_ARG_VAR([OBJCXXFLAGS], [Objective C++ compiler flags])dnl
  884. _AC_ARG_VAR_LDFLAGS()dnl
  885. _AC_ARG_VAR_LIBS()dnl
  886. _AC_ARG_VAR_CPPFLAGS()dnl
  887. _AC_ARG_VAR_PRECIOUS([OBJCXX])dnl
  888. AC_CHECK_TOOLS(OBJCXX,
  889. [m4_default([$1], [g++ objc++ objcxx c++ CXX])],
  890. g++)
  891. # Provide some information about the compiler.
  892. _AS_ECHO_LOG([checking for _AC_LANG compiler version])
  893. set X $ac_compile
  894. ac_compiler=$[2]
  895. for ac_option in --version -v -V -qversion; do
  896. _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
  897. done
  898. m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
  899. m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
  900. _AC_LANG_COMPILER_GNU
  901. if test $ac_compiler_gnu = yes; then
  902. GOBJCXX=yes
  903. else
  904. GOBJCXX=
  905. fi
  906. _AC_PROG_OBJCXX_G
  907. AC_LANG_POP(Objective C++)dnl
  908. ])# AC_PROG_OBJCXX
  909. # _AC_PROG_OBJCXX_G
  910. # -----------------
  911. # Check whether -g works, even if OBJCFLAGS is set, in case the package
  912. # plays around with OBJCFLAGS (such as to build both debugging and
  913. # normal versions of a library), tasteless as that idea is.
  914. # Don't consider -g to work if it generates warnings when plain compiles don't.
  915. m4_define([_AC_PROG_OBJCXX_G],
  916. [ac_test_OBJCXXFLAGS=${OBJCXXFLAGS+set}
  917. ac_save_OBJCXXFLAGS=$OBJCXXFLAGS
  918. AC_CACHE_CHECK(whether $OBJCXX accepts -g, ac_cv_prog_objcxx_g,
  919. [ac_save_objcxx_werror_flag=$ac_objcxx_werror_flag
  920. ac_objcxx_werror_flag=yes
  921. ac_cv_prog_objcxx_g=no
  922. OBJCXXFLAGS="-g"
  923. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  924. [ac_cv_prog_objcxx_g=yes],
  925. [OBJCXXFLAGS=""
  926. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  927. [],
  928. [ac_objcxx_werror_flag=$ac_save_objcxx_werror_flag
  929. OBJCXXFLAGS="-g"
  930. _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  931. [ac_cv_prog_objcxx_g=yes])])])
  932. ac_objcxx_werror_flag=$ac_save_objcx_werror_flag])
  933. if test "$ac_test_OBJCXXFLAGS" = set; then
  934. OBJCXXFLAGS=$ac_save_OBJCXXFLAGS
  935. elif test $ac_cv_prog_objcxx_g = yes; then
  936. if test "$GOBJCXX" = yes; then
  937. OBJCXXFLAGS="-g -O2"
  938. else
  939. OBJCXXFLAGS="-g"
  940. fi
  941. else
  942. if test "$GOBJCXX" = yes; then
  943. OBJCXXFLAGS="-O2"
  944. else
  945. OBJCXXFLAGS=
  946. fi
  947. fi[]dnl
  948. ])# _AC_PROG_OBJCXX_G
  949. ## ------------------------------- ##
  950. ## 4. Compilers' characteristics. ##
  951. ## ------------------------------- ##
  952. # -------------------------------- #
  953. # 4a. C compiler characteristics. #
  954. # -------------------------------- #
  955. # _AC_PROG_CC_C89 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
  956. # ----------------------------------------------------------------
  957. # If the C compiler is not in ANSI C89 (ISO C90) mode by default, try
  958. # to add an option to output variable CC to make it so. This macro
  959. # tries various options that select ANSI C89 on some system or
  960. # another. It considers the compiler to be in ANSI C89 mode if it
  961. # handles function prototypes correctly.
  962. AC_DEFUN([_AC_PROG_CC_C89],
  963. [_AC_C_STD_TRY([c89],
  964. [[#include <stdarg.h>
  965. #include <stdio.h>
  966. struct stat;
  967. /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
  968. struct buf { int x; };
  969. FILE * (*rcsopen) (struct buf *, struct stat *, int);
  970. static char *e (p, i)
  971. char **p;
  972. int i;
  973. {
  974. return p[i];
  975. }
  976. static char *f (char * (*g) (char **, int), char **p, ...)
  977. {
  978. char *s;
  979. va_list v;
  980. va_start (v,p);
  981. s = g (p, va_arg (v,int));
  982. va_end (v);
  983. return s;
  984. }
  985. /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
  986. function prototypes and stuff, but not '\xHH' hex character constants.
  987. These don't provoke an error unfortunately, instead are silently treated
  988. as 'x'. The following induces an error, until -std is added to get
  989. proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
  990. array size at least. It's necessary to write '\x00'==0 to get something
  991. that's true only with -std. */
  992. int osf4_cc_array ['\x00' == 0 ? 1 : -1];
  993. /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
  994. inside strings and character constants. */
  995. #define FOO(x) 'x'
  996. int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
  997. int test (int i, double x);
  998. struct s1 {int (*f) (int a);};
  999. struct s2 {int (*f) (double a);};
  1000. int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
  1001. int argc;
  1002. char **argv;]],
  1003. [[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];]],
  1004. dnl Don't try gcc -ansi; that turns off useful extensions and
  1005. dnl breaks some systems' header files.
  1006. dnl AIX circa 2003 -qlanglvl=extc89
  1007. dnl old AIX -qlanglvl=ansi
  1008. dnl Ultrix, OSF/1, Tru64 -std
  1009. dnl HP-UX 10.20 and later -Ae
  1010. dnl HP-UX older versions -Aa -D_HPUX_SOURCE
  1011. dnl SVR4 -Xc -D__EXTENSIONS__
  1012. [-qlanglvl=extc89 -qlanglvl=ansi -std \
  1013. -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"], [$1], [$2])[]dnl
  1014. ])# _AC_PROG_CC_C89
  1015. # _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
  1016. # ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
  1017. # --------------------------------------------------------------
  1018. # Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
  1019. # by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails,
  1020. # try again with each compiler option in the space-separated OPTION-LIST; if one
  1021. # helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE,
  1022. # else ACTION-IF-UNAVAILABLE.
  1023. AC_DEFUN([_AC_C_STD_TRY],
  1024. [AC_MSG_CHECKING([for $CC option to accept ISO ]m4_translit($1, [c], [C]))
  1025. AC_CACHE_VAL(ac_cv_prog_cc_$1,
  1026. [ac_cv_prog_cc_$1=no
  1027. ac_save_CC=$CC
  1028. AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
  1029. for ac_arg in '' $4
  1030. do
  1031. CC="$ac_save_CC $ac_arg"
  1032. _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
  1033. test "x$ac_cv_prog_cc_$1" != "xno" && break
  1034. done
  1035. rm -f conftest.$ac_ext
  1036. CC=$ac_save_CC
  1037. ])# AC_CACHE_VAL
  1038. case "x$ac_cv_prog_cc_$1" in
  1039. x)
  1040. AC_MSG_RESULT([none needed]) ;;
  1041. xno)
  1042. AC_MSG_RESULT([unsupported]) ;;
  1043. *)
  1044. CC="$CC $ac_cv_prog_cc_$1"
  1045. AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
  1046. esac
  1047. AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
  1048. ])# _AC_C_STD_TRY
  1049. # _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
  1050. # ----------------------------------------------------------------
  1051. # If the C compiler is not in ISO C99 mode by default, try to add an
  1052. # option to output variable CC to make it so. This macro tries
  1053. # various options that select ISO C99 on some system or another. It
  1054. # considers the compiler to be in ISO C99 mode if it handles _Bool,
  1055. # // comments, flexible array members, inline, long long int, mixed
  1056. # code and declarations, named initialization of structs, restrict,
  1057. # va_copy, varargs macros, variable declarations in for loops and
  1058. # variable length arrays.
  1059. AC_DEFUN([_AC_PROG_CC_C99],
  1060. [_AC_C_STD_TRY([c99],
  1061. [[#include <stdarg.h>
  1062. #include <stdbool.h>
  1063. #include <stdlib.h>
  1064. #include <wchar.h>
  1065. #include <stdio.h>
  1066. // Check varargs macros. These examples are taken from C99 6.10.3.5.
  1067. #define debug(...) fprintf (stderr, __VA_ARGS__)
  1068. #define showlist(...) puts (#__VA_ARGS__)
  1069. #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
  1070. static void
  1071. test_varargs_macros (void)
  1072. {
  1073. int x = 1234;
  1074. int y = 5678;
  1075. debug ("Flag");
  1076. debug ("X = %d\n", x);
  1077. showlist (The first, second, and third items.);
  1078. report (x>y, "x is %d but y is %d", x, y);
  1079. }
  1080. // Check long long types.
  1081. #define BIG64 18446744073709551615ull
  1082. #define BIG32 4294967295ul
  1083. #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
  1084. #if !BIG_OK
  1085. your preprocessor is broken;
  1086. #endif
  1087. #if BIG_OK
  1088. #else
  1089. your preprocessor is broken;
  1090. #endif
  1091. static long long int bignum = -9223372036854775807LL;
  1092. static unsigned long long int ubignum = BIG64;
  1093. struct incomplete_array
  1094. {
  1095. int datasize;
  1096. double data[];
  1097. };
  1098. struct named_init {
  1099. int number;
  1100. const wchar_t *name;
  1101. double average;
  1102. };
  1103. typedef const char *ccp;
  1104. static inline int
  1105. test_restrict (ccp restrict text)
  1106. {
  1107. // See if C++-style comments work.
  1108. // Iterate through items via the restricted pointer.
  1109. // Also check for declarations in for loops.
  1110. for (unsigned int i = 0; *(text+i) != '\0'; ++i)
  1111. continue;
  1112. return 0;
  1113. }
  1114. // Check varargs and va_copy.
  1115. static void
  1116. test_varargs (const char *format, ...)
  1117. {
  1118. va_list args;
  1119. va_start (args, format);
  1120. va_list args_copy;
  1121. va_copy (args_copy, args);
  1122. const char *str;
  1123. int number;
  1124. float fnumber;
  1125. while (*format)
  1126. {
  1127. switch (*format++)
  1128. {
  1129. case 's': // string
  1130. str = va_arg (args_copy, const char *);
  1131. break;
  1132. case 'd': // int
  1133. number = va_arg (args_copy, int);
  1134. break;
  1135. case 'f': // float
  1136. fnumber = va_arg (args_copy, double);
  1137. break;
  1138. default:
  1139. break;
  1140. }
  1141. }
  1142. va_end (args_copy);
  1143. va_end (args);
  1144. }
  1145. ]],
  1146. [[
  1147. // Check bool.
  1148. _Bool success = false;
  1149. // Check restrict.
  1150. if (test_restrict ("String literal") == 0)
  1151. success = true;
  1152. char *restrict newvar = "Another string";
  1153. // Check varargs.
  1154. test_varargs ("s, d' f .", "string", 65, 34.234);
  1155. test_varargs_macros ();
  1156. // Check flexible array members.
  1157. struct incomplete_array *ia =
  1158. malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
  1159. ia->datasize = 10;
  1160. for (int i = 0; i < ia->datasize; ++i)
  1161. ia->data[i] = i * 1.234;
  1162. // Check named initializers.
  1163. struct named_init ni = {
  1164. .number = 34,
  1165. .name = L"Test wide string",
  1166. .average = 543.34343,
  1167. };
  1168. ni.number = 58;
  1169. int dynamic_array[ni.number];
  1170. dynamic_array[ni.number - 1] = 543;
  1171. // work around unused variable warnings
  1172. return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
  1173. || dynamic_array[ni.number - 1] != 543);
  1174. ]],
  1175. dnl Try
  1176. dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
  1177. dnl AIX -qlanglvl=extc99 (unused restrictive mode: -qlanglvl=stdc99)
  1178. dnl HP cc -AC99
  1179. dnl Intel ICC -std=c99, -c99 (deprecated)
  1180. dnl IRIX -c99
  1181. dnl Solaris -D_STDC_C99=
  1182. dnl cc's -xc99 option uses linker magic to define the external
  1183. dnl symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99
  1184. dnl behavior for C library functions. This is not wanted here,
  1185. dnl because it means that a single module compiled with -xc99
  1186. dnl alters C runtime behavior for the entire program, not for
  1187. dnl just the module. Instead, define the (private) symbol
  1188. dnl _STDC_C99, which suppresses a bogus failure in <stdbool.h>.
  1189. dnl The resulting compiler passes the test case here, and that's
  1190. dnl good enough. For more, please see the thread starting at:
  1191. dnl http://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html
  1192. dnl Tru64 -c99
  1193. dnl with extended modes being tried first.
  1194. [[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99]], [$1], [$2])[]dnl
  1195. ])# _AC_PROG_CC_C99
  1196. # AC_PROG_CC_C89
  1197. # --------------
  1198. AC_DEFUN([AC_PROG_CC_C89],
  1199. [ AC_REQUIRE([AC_PROG_CC])dnl
  1200. _AC_PROG_CC_C89
  1201. ])
  1202. # AC_PROG_CC_C99
  1203. # --------------
  1204. AC_DEFUN([AC_PROG_CC_C99],
  1205. [ AC_REQUIRE([AC_PROG_CC])dnl
  1206. _AC_PROG_CC_C99
  1207. ])
  1208. # AC_PROG_CC_STDC
  1209. # ---------------
  1210. AC_DEFUN([AC_PROG_CC_STDC],
  1211. [ AC_REQUIRE([AC_PROG_CC])dnl
  1212. AS_CASE([$ac_cv_prog_cc_stdc],
  1213. [no], [ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no],
  1214. [_AC_PROG_CC_C99([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],
  1215. [_AC_PROG_CC_C89([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],
  1216. [ac_cv_prog_cc_stdc=no])])])
  1217. AC_MSG_CHECKING([for $CC option to accept ISO Standard C])
  1218. AC_CACHE_VAL([ac_cv_prog_cc_stdc], [])
  1219. AS_CASE([$ac_cv_prog_cc_stdc],
  1220. [no], [AC_MSG_RESULT([unsupported])],
  1221. [''], [AC_MSG_RESULT([none needed])],
  1222. [AC_MSG_RESULT([$ac_cv_prog_cc_stdc])])
  1223. ])
  1224. # AC_C_BACKSLASH_A
  1225. # ----------------
  1226. AC_DEFUN([AC_C_BACKSLASH_A],
  1227. [
  1228. AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
  1229. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
  1230. [[
  1231. #if '\a' == 'a'
  1232. syntax error;
  1233. #endif
  1234. char buf['\a' == 'a' ? -1 : 1];
  1235. buf[0] = '\a';
  1236. return buf[0] != "\a"[0];
  1237. ]])],
  1238. [ac_cv_c_backslash_a=yes],
  1239. [ac_cv_c_backslash_a=no])])
  1240. if test $ac_cv_c_backslash_a = yes; then
  1241. AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
  1242. [Define if backslash-a works in C strings.])
  1243. fi
  1244. ])
  1245. # AC_C_CROSS
  1246. # ----------
  1247. # Has been merged into AC_PROG_CC.
  1248. AU_DEFUN([AC_C_CROSS], [])
  1249. # AC_C_CHAR_UNSIGNED
  1250. # ------------------
  1251. AC_DEFUN([AC_C_CHAR_UNSIGNED],
  1252. [AH_VERBATIM([__CHAR_UNSIGNED__],
  1253. [/* Define to 1 if type `char' is unsigned and you are not using gcc. */
  1254. #ifndef __CHAR_UNSIGNED__
  1255. # undef __CHAR_UNSIGNED__
  1256. #endif])dnl
  1257. AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned,
  1258. [AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([])],
  1259. [((char) -1) < 0])],
  1260. ac_cv_c_char_unsigned=no, ac_cv_c_char_unsigned=yes)])
  1261. if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
  1262. AC_DEFINE(__CHAR_UNSIGNED__)
  1263. fi
  1264. ])# AC_C_CHAR_UNSIGNED
  1265. # AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN],
  1266. # [ACTION-IF-UNIVERSAL])
  1267. # -------------------------------------------------------------------------
  1268. AC_DEFUN([AC_C_BIGENDIAN],
  1269. [AH_VERBATIM([WORDS_BIGENDIAN],
  1270. [/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
  1271. significant byte first (like Motorola and SPARC, unlike Intel). */
  1272. #if defined AC_APPLE_UNIVERSAL_BUILD
  1273. # if defined __BIG_ENDIAN__
  1274. # define WORDS_BIGENDIAN 1
  1275. # endif
  1276. #else
  1277. # ifndef WORDS_BIGENDIAN
  1278. # undef WORDS_BIGENDIAN
  1279. # endif
  1280. #endif])dnl
  1281. AC_CACHE_CHECK([whether byte ordering is bigendian], [ac_cv_c_bigendian],
  1282. [ac_cv_c_bigendian=unknown
  1283. # See if we're dealing with a universal compiler.
  1284. AC_COMPILE_IFELSE(
  1285. [AC_LANG_SOURCE(
  1286. [[#ifndef __APPLE_CC__
  1287. not a universal capable compiler
  1288. #endif
  1289. typedef int dummy;
  1290. ]])],
  1291. [
  1292. # Check for potential -arch flags. It is not universal unless
  1293. # there are at least two -arch flags with different values.
  1294. ac_arch=
  1295. ac_prev=
  1296. for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
  1297. if test -n "$ac_prev"; then
  1298. case $ac_word in
  1299. i?86 | x86_64 | ppc | ppc64)
  1300. if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
  1301. ac_arch=$ac_word
  1302. else
  1303. ac_cv_c_bigendian=universal
  1304. break
  1305. fi
  1306. ;;
  1307. esac
  1308. ac_prev=
  1309. elif test "x$ac_word" = "x-arch"; then
  1310. ac_prev=arch
  1311. fi
  1312. done])
  1313. if test $ac_cv_c_bigendian = unknown; then
  1314. # See if sys/param.h defines the BYTE_ORDER macro.
  1315. AC_COMPILE_IFELSE(
  1316. [AC_LANG_PROGRAM(
  1317. [[#include <sys/types.h>
  1318. #include <sys/param.h>
  1319. ]],
  1320. [[#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
  1321. && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
  1322. && LITTLE_ENDIAN)
  1323. bogus endian macros
  1324. #endif
  1325. ]])],
  1326. [# It does; now see whether it defined to BIG_ENDIAN or not.
  1327. AC_COMPILE_IFELSE(
  1328. [AC_LANG_PROGRAM(
  1329. [[#include <sys/types.h>
  1330. #include <sys/param.h>
  1331. ]],
  1332. [[#if BYTE_ORDER != BIG_ENDIAN
  1333. not big endian
  1334. #endif
  1335. ]])],
  1336. [ac_cv_c_bigendian=yes],
  1337. [ac_cv_c_bigendian=no])])
  1338. fi
  1339. if test $ac_cv_c_bigendian = unknown; then
  1340. # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
  1341. AC_COMPILE_IFELSE(
  1342. [AC_LANG_PROGRAM(
  1343. [[#include <limits.h>
  1344. ]],
  1345. [[#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
  1346. bogus endian macros
  1347. #endif
  1348. ]])],
  1349. [# It does; now see whether it defined to _BIG_ENDIAN or not.
  1350. AC_COMPILE_IFELSE(
  1351. [AC_LANG_PROGRAM(
  1352. [[#include <limits.h>
  1353. ]],
  1354. [[#ifndef _BIG_ENDIAN
  1355. not big endian
  1356. #endif
  1357. ]])],
  1358. [ac_cv_c_bigendian=yes],
  1359. [ac_cv_c_bigendian=no])])
  1360. fi
  1361. if test $ac_cv_c_bigendian = unknown; then
  1362. # Compile a test program.
  1363. AC_RUN_IFELSE(
  1364. [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  1365. [[
  1366. /* Are we little or big endian? From Harbison&Steele. */
  1367. union
  1368. {
  1369. long int l;
  1370. char c[sizeof (long int)];
  1371. } u;
  1372. u.l = 1;
  1373. return u.c[sizeof (long int) - 1] == 1;
  1374. ]])],
  1375. [ac_cv_c_bigendian=no],
  1376. [ac_cv_c_bigendian=yes],
  1377. [# Try to guess by grepping values from an object file.
  1378. AC_COMPILE_IFELSE(
  1379. [AC_LANG_PROGRAM(
  1380. [[short int ascii_mm[] =
  1381. { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
  1382. short int ascii_ii[] =
  1383. { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
  1384. int use_ascii (int i) {
  1385. return ascii_mm[i] + ascii_ii[i];
  1386. }
  1387. short int ebcdic_ii[] =
  1388. { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
  1389. short int ebcdic_mm[] =
  1390. { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
  1391. int use_ebcdic (int i) {
  1392. return ebcdic_mm[i] + ebcdic_ii[i];
  1393. }
  1394. extern int foo;
  1395. ]],
  1396. [[return use_ascii (foo) == use_ebcdic (foo);]])],
  1397. [if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
  1398. ac_cv_c_bigendian=yes
  1399. fi
  1400. if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
  1401. if test "$ac_cv_c_bigendian" = unknown; then
  1402. ac_cv_c_bigendian=no
  1403. else
  1404. # finding both strings is unlikely to happen, but who knows?
  1405. ac_cv_c_bigendian=unknown
  1406. fi
  1407. fi])])
  1408. fi])
  1409. case $ac_cv_c_bigendian in #(
  1410. yes)
  1411. m4_default([$1],
  1412. [AC_DEFINE([WORDS_BIGENDIAN], 1)]);; #(
  1413. no)
  1414. $2 ;; #(
  1415. universal)
  1416. dnl Note that AC_APPLE_UNIVERSAL_BUILD sorts less than WORDS_BIGENDIAN;
  1417. dnl this is a necessity for proper config header operation. Warn if
  1418. dnl the user did not specify a config header but is relying on the
  1419. dnl default behavior for universal builds.
  1420. m4_default([$4],
  1421. [AC_CONFIG_COMMANDS_PRE([m4_ifset([AH_HEADER], [],
  1422. [AC_DIAGNOSE([obsolete],
  1423. [AC_C_BIGENDIAN should be used with AC_CONFIG_HEADERS])])])dnl
  1424. AC_DEFINE([AC_APPLE_UNIVERSAL_BUILD],1,
  1425. [Define if building universal (internal helper macro)])])
  1426. ;; #(
  1427. *)
  1428. m4_default([$3],
  1429. [AC_MSG_ERROR([unknown endianness
  1430. presetting ac_cv_c_bigendian=no (or yes) will help])]) ;;
  1431. esac
  1432. ])# AC_C_BIGENDIAN
  1433. # AC_C_INLINE
  1434. # -----------
  1435. # Do nothing if the compiler accepts the inline keyword.
  1436. # Otherwise define inline to __inline__ or __inline if one of those work,
  1437. # otherwise define inline to be empty.
  1438. #
  1439. # HP C version B.11.11.04 doesn't allow a typedef as the return value for an
  1440. # inline function, only builtin types.
  1441. #
  1442. AN_IDENTIFIER([inline], [AC_C_INLINE])
  1443. AC_DEFUN([AC_C_INLINE],
  1444. [AC_CACHE_CHECK([for inline], ac_cv_c_inline,
  1445. [ac_cv_c_inline=no
  1446. for ac_kw in inline __inline__ __inline; do
  1447. AC_COMPILE_IFELSE([AC_LANG_SOURCE(
  1448. [#ifndef __cplusplus
  1449. typedef int foo_t;
  1450. static $ac_kw foo_t static_foo () {return 0; }
  1451. $ac_kw foo_t foo () {return 0; }
  1452. #endif
  1453. ])],
  1454. [ac_cv_c_inline=$ac_kw])
  1455. test "$ac_cv_c_inline" != no && break
  1456. done
  1457. ])
  1458. AH_VERBATIM([inline],
  1459. [/* Define to `__inline__' or `__inline' if that's what the C compiler
  1460. calls it, or to nothing if 'inline' is not supported under any name. */
  1461. #ifndef __cplusplus
  1462. #undef inline
  1463. #endif])
  1464. case $ac_cv_c_inline in
  1465. inline | yes) ;;
  1466. *)
  1467. case $ac_cv_c_inline in
  1468. no) ac_val=;;
  1469. *) ac_val=$ac_cv_c_inline;;
  1470. esac
  1471. cat >>confdefs.h <<_ACEOF
  1472. #ifndef __cplusplus
  1473. #define inline $ac_val
  1474. #endif
  1475. _ACEOF
  1476. ;;
  1477. esac
  1478. ])# AC_C_INLINE
  1479. # AC_C_CONST
  1480. # ----------
  1481. AC_DEFUN([AC_C_CONST],
  1482. [AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
  1483. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
  1484. [[
  1485. #ifndef __cplusplus
  1486. /* Ultrix mips cc rejects this sort of thing. */
  1487. typedef int charset[2];
  1488. const charset cs = { 0, 0 };
  1489. /* SunOS 4.1.1 cc rejects this. */
  1490. char const *const *pcpcc;
  1491. char **ppc;
  1492. /* NEC SVR4.0.2 mips cc rejects this. */
  1493. struct point {int x, y;};
  1494. static struct point const zero = {0,0};
  1495. /* AIX XL C 1.02.0.0 rejects this.
  1496. It does not let you subtract one const X* pointer from another in
  1497. an arm of an if-expression whose if-part is not a constant
  1498. expression */
  1499. const char *g = "string";
  1500. pcpcc = &g + (g ? g-g : 0);
  1501. /* HPUX 7.0 cc rejects these. */
  1502. ++pcpcc;
  1503. ppc = (char**) pcpcc;
  1504. pcpcc = (char const *const *) ppc;
  1505. { /* SCO 3.2v4 cc rejects this sort of thing. */
  1506. char tx;
  1507. char *t = &tx;
  1508. char const *s = 0 ? (char *) 0 : (char const *) 0;
  1509. *t++ = 0;
  1510. if (s) return 0;
  1511. }
  1512. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
  1513. int x[] = {25, 17};
  1514. const int *foo = &x[0];
  1515. ++foo;
  1516. }
  1517. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  1518. typedef const int *iptr;
  1519. iptr p = 0;
  1520. ++p;
  1521. }
  1522. { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
  1523. "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  1524. struct s { int j; const int *ap[3]; } bx;
  1525. struct s *b = &bx; b->j = 5;
  1526. }
  1527. { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  1528. const int foo = 10;
  1529. if (!foo) return 0;
  1530. }
  1531. return !cs[0] && !zero.x;
  1532. #endif
  1533. ]])],
  1534. [ac_cv_c_const=yes],
  1535. [ac_cv_c_const=no])])
  1536. if test $ac_cv_c_const = no; then
  1537. AC_DEFINE(const,,
  1538. [Define to empty if `const' does not conform to ANSI C.])
  1539. fi
  1540. ])# AC_C_CONST
  1541. # AC_C_RESTRICT
  1542. # -------------
  1543. # based on acx_restrict.m4, from the GNU Autoconf Macro Archive at:
  1544. # http://autoconf-archive.cryp.to/acx_restrict.html
  1545. #
  1546. # Determine whether the C/C++ compiler supports the "restrict" keyword
  1547. # introduced in ANSI C99, or an equivalent. Define "restrict" to the alternate
  1548. # spelling, if any; these are more likely to work in both C and C++ compilers of
  1549. # the same family, and in the presence of varying compiler options. If only
  1550. # plain "restrict" works, do nothing. Here are some variants:
  1551. # - GCC supports both __restrict and __restrict__
  1552. # - older DEC Alpha C compilers support only __restrict
  1553. # - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
  1554. # Otherwise, define "restrict" to be empty.
  1555. AN_IDENTIFIER([restrict], [AC_C_RESTRICT])
  1556. AC_DEFUN([AC_C_RESTRICT],
  1557. [AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
  1558. [ac_cv_c_restrict=no
  1559. # The order here caters to the fact that C++ does not require restrict.
  1560. for ac_kw in __restrict __restrict__ _Restrict restrict; do
  1561. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  1562. [[typedef int * int_ptr;
  1563. int foo (int_ptr $ac_kw ip) {
  1564. return ip[0];
  1565. }]],
  1566. [[int s[1];
  1567. int * $ac_kw t = s;
  1568. t[0] = 0;
  1569. return foo(t)]])],
  1570. [ac_cv_c_restrict=$ac_kw])
  1571. test "$ac_cv_c_restrict" != no && break
  1572. done
  1573. ])
  1574. AH_VERBATIM([restrict],
  1575. [/* Define to the equivalent of the C99 'restrict' keyword, or to
  1576. nothing if this is not supported. Do not define if restrict is
  1577. supported directly. */
  1578. #undef restrict
  1579. /* Work around a bug in Sun C++: it does not support _Restrict or
  1580. __restrict__, even though the corresponding Sun C compiler ends up with
  1581. "#define restrict _Restrict" or "#define restrict __restrict__" in the
  1582. previous line. Perhaps some future version of Sun C++ will work with
  1583. restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
  1584. #if defined __SUNPRO_CC && !defined __RESTRICT
  1585. # define _Restrict
  1586. # define __restrict__
  1587. #endif])
  1588. case $ac_cv_c_restrict in
  1589. restrict) ;;
  1590. no) AC_DEFINE([restrict], []) ;;
  1591. *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
  1592. esac
  1593. ])# AC_C_RESTRICT
  1594. # AC_C_VOLATILE
  1595. # -------------
  1596. # Note that, unlike const, #defining volatile to be the empty string can
  1597. # actually turn a correct program into an incorrect one, since removing
  1598. # uses of volatile actually grants the compiler permission to perform
  1599. # optimizations that could break the user's code. So, do not #define
  1600. # volatile away unless it is really necessary to allow the user's code
  1601. # to compile cleanly. Benign compiler failures should be tolerated.
  1602. AC_DEFUN([AC_C_VOLATILE],
  1603. [AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
  1604. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
  1605. volatile int x;
  1606. int * volatile y = (int *) 0;
  1607. return !x && !y;])],
  1608. [ac_cv_c_volatile=yes],
  1609. [ac_cv_c_volatile=no])])
  1610. if test $ac_cv_c_volatile = no; then
  1611. AC_DEFINE(volatile,,
  1612. [Define to empty if the keyword `volatile' does not work.
  1613. Warning: valid code using `volatile' can become incorrect
  1614. without. Disable with care.])
  1615. fi
  1616. ])# AC_C_VOLATILE
  1617. # AC_C_STRINGIZE
  1618. # --------------
  1619. # Checks if `#' can be used to glue strings together at the CPP level.
  1620. # Defines HAVE_STRINGIZE if positive.
  1621. AC_DEFUN([AC_C_STRINGIZE],
  1622. [AC_CACHE_CHECK([for preprocessor stringizing operator],
  1623. [ac_cv_c_stringize],
  1624. [AC_EGREP_CPP([@%:@teststring],
  1625. [@%:@define x(y) #y
  1626. char *s = x(teststring);],
  1627. [ac_cv_c_stringize=no],
  1628. [ac_cv_c_stringize=yes])])
  1629. if test $ac_cv_c_stringize = yes; then
  1630. AC_DEFINE(HAVE_STRINGIZE, 1,
  1631. [Define to 1 if cpp supports the ANSI @%:@ stringizing operator.])
  1632. fi
  1633. ])# AC_C_STRINGIZE
  1634. # AC_C_PROTOTYPES
  1635. # ---------------
  1636. # Check if the C compiler supports prototypes, included if it needs
  1637. # options.
  1638. AC_DEFUN([AC_C_PROTOTYPES],
  1639. [AC_REQUIRE([AC_PROG_CC])dnl
  1640. AC_MSG_CHECKING([for function prototypes])
  1641. if test "$ac_cv_prog_cc_c89" != no; then
  1642. AC_MSG_RESULT([yes])
  1643. AC_DEFINE(PROTOTYPES, 1,
  1644. [Define to 1 if the C compiler supports function prototypes.])
  1645. AC_DEFINE(__PROTOTYPES, 1,
  1646. [Define like PROTOTYPES; this can be used by system headers.])
  1647. else
  1648. AC_MSG_RESULT([no])
  1649. fi
  1650. ])# AC_C_PROTOTYPES
  1651. # AC_C_FLEXIBLE_ARRAY_MEMBER
  1652. # --------------------------
  1653. # Check whether the C compiler supports flexible array members.
  1654. AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER],
  1655. [
  1656. AC_CACHE_CHECK([for flexible array members],
  1657. ac_cv_c_flexmember,
  1658. [AC_COMPILE_IFELSE(
  1659. [AC_LANG_PROGRAM(
  1660. [[#include <stdlib.h>
  1661. #include <stdio.h>
  1662. #include <stddef.h>
  1663. struct s { int n; double d[]; };]],
  1664. [[int m = getchar ();
  1665. struct s *p = malloc (offsetof (struct s, d)
  1666. + m * sizeof (double));
  1667. p->d[0] = 0.0;
  1668. return p->d != (double *) NULL;]])],
  1669. [ac_cv_c_flexmember=yes],
  1670. [ac_cv_c_flexmember=no])])
  1671. if test $ac_cv_c_flexmember = yes; then
  1672. AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [],
  1673. [Define to nothing if C supports flexible array members, and to
  1674. 1 if it does not. That way, with a declaration like `struct s
  1675. { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack
  1676. can be used with pre-C99 compilers.
  1677. When computing the size of such an object, don't use 'sizeof (struct s)'
  1678. as it overestimates the size. Use 'offsetof (struct s, d)' instead.
  1679. Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with
  1680. MSVC and with C++ compilers.])
  1681. else
  1682. AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], 1)
  1683. fi
  1684. ])
  1685. # AC_C_VARARRAYS
  1686. # --------------
  1687. # Check whether the C compiler supports variable-length arrays.
  1688. AC_DEFUN([AC_C_VARARRAYS],
  1689. [
  1690. AC_CACHE_CHECK([for variable-length arrays],
  1691. ac_cv_c_vararrays,
  1692. [AC_COMPILE_IFELSE(
  1693. [AC_LANG_PROGRAM([],
  1694. [[static int x; char a[++x]; a[sizeof a - 1] = 0; return a[0];]])],
  1695. [ac_cv_c_vararrays=yes],
  1696. [ac_cv_c_vararrays=no])])
  1697. if test $ac_cv_c_vararrays = yes; then
  1698. AC_DEFINE([HAVE_C_VARARRAYS], 1,
  1699. [Define to 1 if C supports variable-length arrays.])
  1700. fi
  1701. ])
  1702. # AC_C_TYPEOF
  1703. # -----------
  1704. # Check if the C compiler supports GCC's typeof syntax.
  1705. # The test case provokes incompatibilities in the Sun C compilers
  1706. # (both Solaris 8 and Solaris 10).
  1707. AC_DEFUN([AC_C_TYPEOF],
  1708. [
  1709. AC_CACHE_CHECK([for typeof syntax and keyword spelling], ac_cv_c_typeof,
  1710. [ac_cv_c_typeof=no
  1711. for ac_kw in typeof __typeof__ no; do
  1712. test $ac_kw = no && break
  1713. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
  1714. [[
  1715. int value;
  1716. typedef struct {
  1717. char a [1
  1718. + ! (($ac_kw (value))
  1719. (($ac_kw (value)) 0 < ($ac_kw (value)) -1
  1720. ? ($ac_kw (value)) - 1
  1721. : ~ (~ ($ac_kw (value)) 0
  1722. << sizeof ($ac_kw (value)))))]; }
  1723. ac__typeof_type_;
  1724. return
  1725. (! ((void) ((ac__typeof_type_ *) 0), 0));
  1726. ]])],
  1727. [ac_cv_c_typeof=$ac_kw])
  1728. test $ac_cv_c_typeof != no && break
  1729. done])
  1730. if test $ac_cv_c_typeof != no; then
  1731. AC_DEFINE([HAVE_TYPEOF], 1,
  1732. [Define to 1 if typeof works with your compiler.])
  1733. if test $ac_cv_c_typeof != typeof; then
  1734. AC_DEFINE_UNQUOTED([typeof], [$ac_cv_c_typeof],
  1735. [Define to __typeof__ if your compiler spells it that way.])
  1736. fi
  1737. fi
  1738. ])
  1739. # _AC_LANG_OPENMP
  1740. # ---------------
  1741. # Expands to some language dependent source code for testing the presence of
  1742. # OpenMP.
  1743. AC_DEFUN([_AC_LANG_OPENMP],
  1744. [AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
  1745. # _AC_LANG_OPENMP(C)
  1746. # ------------------
  1747. m4_define([_AC_LANG_OPENMP(C)],
  1748. [
  1749. #ifndef _OPENMP
  1750. choke me
  1751. #endif
  1752. #include <omp.h>
  1753. int main () { return omp_get_num_threads (); }
  1754. ])
  1755. # _AC_LANG_OPENMP(C++)
  1756. # --------------------
  1757. m4_copy([_AC_LANG_OPENMP(C)], [_AC_LANG_OPENMP(C++)])
  1758. # _AC_LANG_OPENMP(Fortran 77)
  1759. # ---------------------------
  1760. m4_define([_AC_LANG_OPENMP(Fortran 77)],
  1761. [
  1762. program main
  1763. implicit none
  1764. !$ integer tid
  1765. tid = 42
  1766. call omp_set_num_threads(2)
  1767. end
  1768. ])
  1769. # _AC_LANG_OPENMP(Fortran)
  1770. # ------------------------
  1771. m4_copy([_AC_LANG_OPENMP(Fortran 77)], [_AC_LANG_OPENMP(Fortran)])
  1772. # AC_OPENMP
  1773. # ---------
  1774. # Check which options need to be passed to the C compiler to support OpenMP.
  1775. # Set the OPENMP_CFLAGS / OPENMP_CXXFLAGS / OPENMP_FFLAGS variable to these
  1776. # options.
  1777. # The options are necessary at compile time (so the #pragmas are understood)
  1778. # and at link time (so the appropriate library is linked with).
  1779. # This macro takes care to not produce redundant options if $CC $CFLAGS already
  1780. # supports OpenMP. It also is careful to not pass options to compilers that
  1781. # misinterpret them; for example, most compilers accept "-openmp" and create
  1782. # an output file called 'penmp' rather than activating OpenMP support.
  1783. AC_DEFUN([AC_OPENMP],
  1784. [
  1785. OPENMP_[]_AC_LANG_PREFIX[]FLAGS=
  1786. AC_ARG_ENABLE([openmp],
  1787. [AS_HELP_STRING([--disable-openmp], [do not use OpenMP])])
  1788. if test "$enable_openmp" != no; then
  1789. AC_CACHE_CHECK([for $[]_AC_CC[] option to support OpenMP],
  1790. [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp],
  1791. [AC_LINK_IFELSE([_AC_LANG_OPENMP],
  1792. [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'],
  1793. [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported'
  1794. dnl Try these flags:
  1795. dnl GCC >= 4.2 -fopenmp
  1796. dnl SunPRO C -xopenmp
  1797. dnl Intel C -openmp
  1798. dnl SGI C, PGI C -mp
  1799. dnl Tru64 Compaq C -omp
  1800. dnl IBM C (AIX, Linux) -qsmp=omp
  1801. dnl Cray CCE -homp
  1802. dnl NEC SX -Popenmp
  1803. dnl Lahey Fortran (Linux) --openmp
  1804. dnl If in this loop a compiler is passed an option that it doesn't
  1805. dnl understand or that it misinterprets, the AC_LINK_IFELSE test
  1806. dnl will fail (since we know that it failed without the option),
  1807. dnl therefore the loop will continue searching for an option, and
  1808. dnl no output file called 'penmp' or 'mp' is created.
  1809. for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
  1810. -Popenmp --openmp; do
  1811. ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
  1812. _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
  1813. AC_LINK_IFELSE([_AC_LANG_OPENMP],
  1814. [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option])
  1815. _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
  1816. if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then
  1817. break
  1818. fi
  1819. done])])
  1820. case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #(
  1821. "none needed" | unsupported)
  1822. ;; #(
  1823. *)
  1824. OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp ;;
  1825. esac
  1826. fi
  1827. AC_SUBST([OPENMP_]_AC_LANG_PREFIX[FLAGS])
  1828. ])