source: branches/dp2mp-move/base/objc.m4 @ 26175

Last change on this file since 26175 was 26175, checked in by jmpp@…, 13 years ago

Merging landonf's r26135: Autoconf support for objc, foundation, and optionally-enabled -Werror.

File size: 27.4 KB
Line 
1# objc.m4
2# Based on c.m4 from GNU Autoconf
3# The Objective C support, added by Landon Fuller <landonf@opendarwin.org>
4# on March 10th, 2004, is heavily based on Autoconf's existing C++ support.
5#
6########### Copyright and Licensing terms ##########
7#
8# This file is part of Autoconf.                       -*- Autoconf -*-
9# Programming languages support.
10# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2, or (at your option)
15# any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25# 02111-1307, USA.
26#
27# As a special exception, the Free Software Foundation gives unlimited
28# permission to copy, distribute and modify the configure scripts that
29# are the output of Autoconf.  You need not follow the terms of the GNU
30# General Public License when using or distributing such scripts, even
31# though portions of the text of Autoconf appear in them.  The GNU
32# General Public License (GPL) does govern all other use of the material
33# that constitutes the Autoconf program.
34#
35# Certain portions of the Autoconf source text are designed to be copied
36# (in certain cases, depending on the input) into the output of
37# Autoconf.  We call these the "data" portions.  The rest of the Autoconf
38# source text consists of comments plus executable code that decides which
39# of the data portions to output in any given case.  We call these
40# comments and executable code the "non-data" portions.  Autoconf never
41# copies any of the non-data portions into its output.
42#
43# This special exception to the GPL applies to versions of Autoconf
44# released by the Free Software Foundation.  When you make and
45# distribute a modified version of Autoconf, you may extend this special
46# exception to the GPL to apply to your modified version as well, *unless*
47# your modified version has the potential to copy into its output some
48# of the text that was the non-data portion of the version that you started
49# with.  (In other words, unless your change moves or copies text from
50# the non-data portions to the data portions.)  If your modification has
51# such potential, you must delete any notice of this special exception
52# to the GPL from your modified version.
53#
54# Written by David MacKenzie, with help from
55# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
56# Roland McGrath, Noah Friedman, david d zuhn, and many others.
57#
58########## GNU General Public License (GPL), version 2  ##########
59#
60#                   GNU GENERAL PUBLIC LICENSE
61#                      Version 2, June 1991
62#
63#  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
64#      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
65#  Everyone is permitted to copy and distribute verbatim copies
66#  of this license document, but changing it is not allowed.
67#
68#                           Preamble
69#
70#  The licenses for most software are designed to take away your
71# freedom to share and change it.  By contrast, the GNU General Public
72# License is intended to guarantee your freedom to share and change free
73# software--to make sure the software is free for all its users.  This
74# General Public License applies to most of the Free Software
75# Foundation's software and to any other program whose authors commit to
76# using it.  (Some other Free Software Foundation software is covered by
77# the GNU Library General Public License instead.)  You can apply it to
78# your programs, too.
79#
80#  When we speak of free software, we are referring to freedom, not
81# price.  Our General Public Licenses are designed to make sure that you
82# have the freedom to distribute copies of free software (and charge for
83# this service if you wish), that you receive source code or can get it
84# if you want it, that you can change the software or use pieces of it
85# in new free programs; and that you know you can do these things.
86#
87#  To protect your rights, we need to make restrictions that forbid
88# anyone to deny you these rights or to ask you to surrender the rights.
89# These restrictions translate to certain responsibilities for you if you
90# distribute copies of the software, or if you modify it.
91#
92#  For example, if you distribute copies of such a program, whether
93# gratis or for a fee, you must give the recipients all the rights that
94# you have.  You must make sure that they, too, receive or can get the
95# source code.  And you must show them these terms so they know their
96# rights.
97#
98#  We protect your rights with two steps: (1) copyright the software, and
99# (2) offer you this license which gives you legal permission to copy,
100# distribute and/or modify the software.
101#
102#  Also, for each author's protection and ours, we want to make certain
103# that everyone understands that there is no warranty for this free
104# software.  If the software is modified by someone else and passed on, we
105# want its recipients to know that what they have is not the original, so
106# that any problems introduced by others will not reflect on the original
107# authors' reputations.
108#
109#  Finally, any free program is threatened constantly by software
110# patents.  We wish to avoid the danger that redistributors of a free
111# program will individually obtain patent licenses, in effect making the
112# program proprietary.  To prevent this, we have made it clear that any
113# patent must be licensed for everyone's free use or not licensed at all.
114#
115#  The precise terms and conditions for copying, distribution and
116# modification follow.
117#
118#                   GNU GENERAL PUBLIC LICENSE
119#  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
120#
121#  0. This License applies to any program or other work which contains
122# a notice placed by the copyright holder saying it may be distributed
123# under the terms of this General Public License.  The "Program", below,
124# refers to any such program or work, and a "work based on the Program"
125# means either the Program or any derivative work under copyright law:
126# that is to say, a work containing the Program or a portion of it,
127# either verbatim or with modifications and/or translated into another
128# language.  (Hereinafter, translation is included without limitation in
129# the term "modification".)  Each licensee is addressed as "you".
130#
131# Activities other than copying, distribution and modification are not
132# covered by this License; they are outside its scope.  The act of
133# running the Program is not restricted, and the output from the Program
134# is covered only if its contents constitute a work based on the
135# Program (independent of having been made by running the Program).
136# Whether that is true depends on what the Program does.
137#
138#  1. You may copy and distribute verbatim copies of the Program's
139# source code as you receive it, in any medium, provided that you
140# conspicuously and appropriately publish on each copy an appropriate
141# copyright notice and disclaimer of warranty; keep intact all the
142# notices that refer to this License and to the absence of any warranty;
143# and give any other recipients of the Program a copy of this License
144# along with the Program.
145#
146# You may charge a fee for the physical act of transferring a copy, and
147# you may at your option offer warranty protection in exchange for a fee.
148#
149#  2. You may modify your copy or copies of the Program or any portion
150# of it, thus forming a work based on the Program, and copy and
151# distribute such modifications or work under the terms of Section 1
152# above, provided that you also meet all of these conditions:
153#
154#    a) You must cause the modified files to carry prominent notices
155#    stating that you changed the files and the date of any change.
156#
157#    b) You must cause any work that you distribute or publish, that in
158#    whole or in part contains or is derived from the Program or any
159#    part thereof, to be licensed as a whole at no charge to all third
160#    parties under the terms of this License.
161#
162#    c) If the modified program normally reads commands interactively
163#    when run, you must cause it, when started running for such
164#    interactive use in the most ordinary way, to print or display an
165#    announcement including an appropriate copyright notice and a
166#    notice that there is no warranty (or else, saying that you provide
167#    a warranty) and that users may redistribute the program under
168#    these conditions, and telling the user how to view a copy of this
169#    License.  (Exception: if the Program itself is interactive but
170#    does not normally print such an announcement, your work based on
171#    the Program is not required to print an announcement.)
172#
173# These requirements apply to the modified work as a whole.  If
174# identifiable sections of that work are not derived from the Program,
175# and can be reasonably considered independent and separate works in
176# themselves, then this License, and its terms, do not apply to those
177# sections when you distribute them as separate works.  But when you
178# distribute the same sections as part of a whole which is a work based
179# on the Program, the distribution of the whole must be on the terms of
180# this License, whose permissions for other licensees extend to the
181# entire whole, and thus to each and every part regardless of who wrote it.
182#
183# Thus, it is not the intent of this section to claim rights or contest
184# your rights to work written entirely by you; rather, the intent is to
185# exercise the right to control the distribution of derivative or
186# collective works based on the Program.
187#
188# In addition, mere aggregation of another work not based on the Program
189# with the Program (or with a work based on the Program) on a volume of
190# a storage or distribution medium does not bring the other work under
191# the scope of this License.
192#
193#  3. You may copy and distribute the Program (or a work based on it,
194# under Section 2) in object code or executable form under the terms of
195# Sections 1 and 2 above provided that you also do one of the following:
196#
197#    a) Accompany it with the complete corresponding machine-readable
198#    source code, which must be distributed under the terms of Sections
199#    1 and 2 above on a medium customarily used for software interchange; or,
200#
201#    b) Accompany it with a written offer, valid for at least three
202#    years, to give any third party, for a charge no more than your
203#    cost of physically performing source distribution, a complete
204#    machine-readable copy of the corresponding source code, to be
205#    distributed under the terms of Sections 1 and 2 above on a medium
206#    customarily used for software interchange; or,
207#
208#    c) Accompany it with the information you received as to the offer
209#    to distribute corresponding source code.  (This alternative is
210#    allowed only for noncommercial distribution and only if you
211#    received the program in object code or executable form with such
212#    an offer, in accord with Subsection b above.)
213#
214# The source code for a work means the preferred form of the work for
215# making modifications to it.  For an executable work, complete source
216# code means all the source code for all modules it contains, plus any
217# associated interface definition files, plus the scripts used to
218# control compilation and installation of the executable.  However, as a
219# special exception, the source code distributed need not include
220# anything that is normally distributed (in either source or binary
221# form) with the major components (compiler, kernel, and so on) of the
222# operating system on which the executable runs, unless that component
223# itself accompanies the executable.
224#
225# If distribution of executable or object code is made by offering
226# access to copy from a designated place, then offering equivalent
227# access to copy the source code from the same place counts as
228# distribution of the source code, even though third parties are not
229# compelled to copy the source along with the object code.
230#
231#  4. You may not copy, modify, sublicense, or distribute the Program
232# except as expressly provided under this License.  Any attempt
233# otherwise to copy, modify, sublicense or distribute the Program is
234# void, and will automatically terminate your rights under this License.
235# However, parties who have received copies, or rights, from you under
236# this License will not have their licenses terminated so long as such
237# parties remain in full compliance.
238#
239#  5. You are not required to accept this License, since you have not
240# signed it.  However, nothing else grants you permission to modify or
241# distribute the Program or its derivative works.  These actions are
242# prohibited by law if you do not accept this License.  Therefore, by
243# modifying or distributing the Program (or any work based on the
244# Program), you indicate your acceptance of this License to do so, and
245# all its terms and conditions for copying, distributing or modifying
246# the Program or works based on it.
247
248#  6. Each time you redistribute the Program (or any work based on the
249# Program), the recipient automatically receives a license from the
250# original licensor to copy, distribute or modify the Program subject to
251# these terms and conditions.  You may not impose any further
252# restrictions on the recipients' exercise of the rights granted herein.
253# You are not responsible for enforcing compliance by third parties to
254# this License.
255#
256#  7. If, as a consequence of a court judgment or allegation of patent
257# infringement or for any other reason (not limited to patent issues),
258# conditions are imposed on you (whether by court order, agreement or
259# otherwise) that contradict the conditions of this License, they do not
260# excuse you from the conditions of this License.  If you cannot
261# distribute so as to satisfy simultaneously your obligations under this
262# License and any other pertinent obligations, then as a consequence you
263# may not distribute the Program at all.  For example, if a patent
264# license would not permit royalty-free redistribution of the Program by
265# all those who receive copies directly or indirectly through you, then
266# the only way you could satisfy both it and this License would be to
267# refrain entirely from distribution of the Program.
268#
269# If any portion of this section is held invalid or unenforceable under
270# any particular circumstance, the balance of the section is intended to
271# apply and the section as a whole is intended to apply in other
272# circumstances.
273#
274# It is not the purpose of this section to induce you to infringe any
275# patents or other property right claims or to contest validity of any
276# such claims; this section has the sole purpose of protecting the
277# integrity of the free software distribution system, which is
278# implemented by public license practices.  Many people have made
279# generous contributions to the wide range of software distributed
280# through that system in reliance on consistent application of that
281# system; it is up to the author/donor to decide if he or she is willing
282# to distribute software through any other system and a licensee cannot
283# impose that choice.
284#
285# This section is intended to make thoroughly clear what is believed to
286# be a consequence of the rest of this License.
287#
288#  8. If the distribution and/or use of the Program is restricted in
289# certain countries either by patents or by copyrighted interfaces, the
290# original copyright holder who places the Program under this License
291# may add an explicit geographical distribution limitation excluding
292# those countries, so that distribution is permitted only in or among
293# countries not thus excluded.  In such case, this License incorporates
294# the limitation as if written in the body of this License.
295#
296#  9. The Free Software Foundation may publish revised and/or new versions
297# of the General Public License from time to time.  Such new versions will
298# be similar in spirit to the present version, but may differ in detail to
299# address new problems or concerns.
300#
301# Each version is given a distinguishing version number.  If the Program
302# specifies a version number of this License which applies to it and "any
303# later version", you have the option of following the terms and conditions
304# either of that version or of any later version published by the Free
305# Software Foundation.  If the Program does not specify a version number of
306# this License, you may choose any version ever published by the Free Software
307# Foundation.
308#
309#  10. If you wish to incorporate parts of the Program into other free
310# programs whose distribution conditions are different, write to the author
311# to ask for permission.  For software which is copyrighted by the Free
312# Software Foundation, write to the Free Software Foundation; we sometimes
313# make exceptions for this.  Our decision will be guided by the two goals
314# of preserving the free status of all derivatives of our free software and
315# of promoting the sharing and reuse of software generally.
316#
317#                           NO WARRANTY
318#
319#  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
320# FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
321# OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
322# PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
323# OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
324# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
325# TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
326# PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
327# REPAIR OR CORRECTION.
328#
329#  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
330# WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
331# REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
332# INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
333# OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
334# TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
335# YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
336# PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
337# POSSIBILITY OF SUCH DAMAGES.
338#
339#                    END OF TERMS AND CONDITIONS
340#
341#           How to Apply These Terms to Your New Programs
342#
343#  If you develop a new program, and you want it to be of the greatest
344# possible use to the public, the best way to achieve this is to make it
345# free software which everyone can redistribute and change under these terms.
346#
347#  To do so, attach the following notices to the program.  It is safest
348# to attach them to the start of each source file to most effectively
349# convey the exclusion of warranty; and each file should have at least
350# the "copyright" line and a pointer to where the full notice is found.
351#
352#    <one line to give the program's name and a brief idea of what it does.>
353#    Copyright (C) <year>  <name of author>
354#
355#    This program is free software; you can redistribute it and/or modify
356#    it under the terms of the GNU General Public License as published by
357#    the Free Software Foundation; either version 2 of the License, or
358#    (at your option) any later version.
359#
360#    This program is distributed in the hope that it will be useful,
361#    but WITHOUT ANY WARRANTY; without even the implied warranty of
362#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
363#    GNU General Public License for more details.
364#
365#    You should have received a copy of the GNU General Public License
366#    along with this program; if not, write to the Free Software
367#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
368#
369#
370# Also add information on how to contact you by electronic and paper mail.
371#
372# If the program is interactive, make it output a short notice like this
373# when it starts in an interactive mode:
374#
375#    Gnomovision version 69, Copyright (C) year  name of author
376#    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
377#    This is free software, and you are welcome to redistribute it
378#    under certain conditions; type `show c' for details.
379#
380# The hypothetical commands `show w' and `show c' should show the appropriate
381# parts of the General Public License.  Of course, the commands you use may
382# be called something other than `show w' and `show c'; they could even be
383# mouse-clicks or menu items--whatever suits your program.
384#
385# You should also get your employer (if you work as a programmer) or your
386# school, if any, to sign a "copyright disclaimer" for the program, if
387# necessary.  Here is a sample; alter the names:
388#
389#  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
390#  `Gnomovision' (which makes passes at compilers) written by James Hacker.
391#
392#  <signature of Ty Coon>, 1 April 1989
393#  Ty Coon, President of Vice
394#
395# This General Public License does not permit incorporating your program into
396# proprietary programs.  If your program is a subroutine library, you may
397# consider it more useful to permit linking proprietary applications with the
398# library.  If this is what you want to do, use the GNU Library General
399# Public License instead of this License.
400#
401########## End of GNU General Public License (GPL), version 2 ##########
402
403## ----------------------- ##
404## 1. Language selection.  ##
405## ----------------------- ##
406
407
408# ------------------------------ #
409# 1d. The Objective C language.  #
410# ------------------------------ #
411
412# AC_LANG(Objective C)
413# --------------------
414# OBJCFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
415m4_define([AC_LANG(Objective C)],
416[ac_ext=m
417ac_cpp='$OBJCPP $CPPFLAGS'
418ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
419ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
420ac_compiler_gnu=$ac_cv_objc_compiler_gnu
421])
422
423
424# AC_LANG_OBJC
425# -------------------------
426AU_DEFUN([AC_LANG_OBJC], [AC_LANG(Objective C)])
427
428
429# _AC_LANG_ABBREV(Objective C)
430# ----------------------------
431m4_define([_AC_LANG_ABBREV(Objective C)], [objc])
432
433
434# _AC_LANG_PREFIX(Objective C)
435# ----------------------------
436m4_define([_AC_LANG_PREFIX(Objective C)], [OBJC])
437
438
439
440## ---------------------- ##
441## 2.Producing programs.  ##
442## ---------------------- ##
443
444
445# ------------------------- #
446# 2d. Objective C sources.  #
447# ------------------------- #
448
449# AC_LANG_SOURCE(Objective C)(BODY)
450# ---------------------------------
451m4_copy([AC_LANG_SOURCE(C)], [AC_LANG_SOURCE(Objective C)])
452
453
454# AC_LANG_PROGRAM(Objective C)([PROLOGUE], [BODY])
455# ------------------------------------------------
456m4_copy([AC_LANG_PROGRAM(C)], [AC_LANG_PROGRAM(Objective C)])
457
458
459# AC_LANG_CALL(Objective C)(PROLOGUE, FUNCTION)
460# ---------------------------------------------
461m4_copy([AC_LANG_CALL(C)], [AC_LANG_CALL(Objective C)])
462
463
464# AC_LANG_FUNC_LINK_TRY(Objective C)(FUNCTION)
465# --------------------------------------------
466m4_copy([AC_LANG_FUNC_LINK_TRY(C)], [AC_LANG_FUNC_LINK_TRY(Objective C)])
467
468
469# AC_LANG_BOOL_COMPILE_TRY(Objective C)(PROLOGUE, EXPRESSION)
470# -----------------------------------------------------------
471m4_copy([AC_LANG_BOOL_COMPILE_TRY(C)], [AC_LANG_BOOL_COMPILE_TRY(Objective C)])
472
473
474# AC_LANG_INT_SAVE(Objective C)(PROLOGUE, EXPRESSION)
475# ---------------------------------------------------
476m4_copy([AC_LANG_INT_SAVE(C)], [AC_LANG_INT_SAVE(Objective C)])
477
478
479
480## -------------------------------------------- ##
481## 3. Looking for Compilers and Preprocessors.  ##
482## -------------------------------------------- ##
483
484
485# ------------------------------ #
486# 3d. The Objective C compiler.  #
487# ------------------------------ #
488
489
490# AC_LANG_PREPROC(Objecitve C)
491# ----------------------------
492# Find the Objective C preprocessor.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
493AC_DEFUN([AC_LANG_PREPROC(Objective C)],
494[AC_REQUIRE([AC_PROG_OBJCPP])])
495
496
497# AC_PROG_OBJCPP
498# --------------
499# Find a working Objective C preprocessor.
500# We shouldn't have to require AC_PROG_CC, but this is due to the concurrency
501# between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_OBJC.
502AC_DEFUN([AC_PROG_OBJCPP],
503[AC_REQUIRE([AC_PROG_OBJC])dnl
504AC_ARG_VAR([OBJCPP],   [Objective C preprocessor])dnl
505_AC_ARG_VAR_CPPFLAGS()dnl
506AC_LANG_PUSH(Objective C)dnl
507AC_MSG_CHECKING([how to run the Objective C preprocessor])
508if test -z "$OBJCPP"; then
509  AC_CACHE_VAL(ac_cv_prog_OBJCPP,
510  [dnl
511    # Double quotes because OBJCPP needs to be expanded
512    for OBJCPP in "$OBJC -E" "/lib/cpp"
513    do
514      _AC_PROG_PREPROC_WORKS_IFELSE([break])
515    done
516    ac_cv_prog_OBJCPP=$OBJCPP
517  ])dnl
518  OBJCPP=$ac_cv_prog_OBJCPP
519else
520  ac_cv_prog_OBJCPP=$OBJCPP
521fi
522AC_MSG_RESULT([$OBJCPP])
523_AC_PROG_PREPROC_WORKS_IFELSE([],
524          [AC_MSG_FAILURE([Objective C preprocessor "$OBJCPP" fails sanity check])])
525AC_SUBST(OBJCPP)dnl
526AC_LANG_POP(Objective C)dnl
527])# AC_PROG_OBJCPP
528
529
530# AC_LANG_COMPILER(Objective C)
531# -----------------------------
532# Find the Objective C compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
533AC_DEFUN([AC_LANG_COMPILER(Objective C)],
534[AC_REQUIRE([AC_PROG_OBJC])])
535
536
537# ac_cv_prog_objc
538# ---------------
539# We used to name the cache variable this way.
540AU_DEFUN([ac_cv_prog_objc],
541[ac_cv_objc_compiler_gnu])
542
543
544# AC_PROG_OBJC([LIST-OF-COMPILERS])
545# ---------------------------------
546# LIST-OF-COMPILERS is a space separated list of Objective C compilers
547# to search for (if not specified, a default list is used).  This just gives
548# the user an opportunity to specify an alternative search list for the
549# Objective C compiler.
550# cc    Native compiler
551# objc  David Stes' Portable Object Compiler
552AN_MAKEVAR([OBJC],  [AC_PROG_OBJC])
553AN_PROGRAM([gcc],   [AC_PROG_OBJC])
554AN_PROGRAM([cc],    [AC_PROG_OBJC])
555AC_DEFUN([AC_PROG_OBJC],
556[AC_LANG_PUSH(Objective C)dnl
557AC_ARG_VAR([OBJC],      [Objective C compiler command])dnl
558AC_ARG_VAR([OBJCFLAGS], [Objective C compiler flags])dnl
559_AC_ARG_VAR_LDFLAGS()dnl
560_AC_ARG_VAR_CPPFLAGS()dnl
561AC_CHECK_TOOLS(OBJC,
562               [$CCC m4_default([$1],
563                          [gcc cc objc])],
564               gcc)
565
566# Provide some information about the compiler.
567echo "$as_me:$LINENO:" \
568     "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD
569ac_compiler=`set X $ac_compile; echo $[2]`
570_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])
571_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD])
572_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD])
573
574m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
575m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
576_AC_LANG_COMPILER_GNU
577GOBJC=`test $ac_compiler_gnu = yes && echo yes`
578_AC_PROG_OBJC_G
579AC_LANG_POP(Objective C)dnl
580])# AC_PROG_OBJC
581
582
583# _AC_PROG_OBJC_G
584# ---------------
585# Check whether -g works, even if OBJCFLAGS is set, in case the package
586# plays around with OBJCFLAGS (such as to build both debugging and
587# normal versions of a library), tasteless as that idea is.
588m4_define([_AC_PROG_OBJC_G],
589[ac_test_OBJCFLAGS=${OBJCFLAGS+set}
590ac_save_OBJCFLAGS=$OBJCFLAGS
591OBJCFLAGS="-g"
592AC_CACHE_CHECK(whether $OBJC accepts -g, ac_cv_prog_objc_g,
593               [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
594                                   [ac_cv_prog_objc_g=yes],
595                                   [ac_cv_prog_objc_g=no])])
596if test "$ac_test_OBJCFLAGS" = set; then
597  OBJCFLAGS=$ac_save_OBJCFLAGS
598elif test $ac_cv_prog_objc_g = yes; then
599  if test "$GOBJC" = yes; then
600    OBJCFLAGS="-g -O2"
601  else
602    OBJCFLAGS="-g"
603  fi
604else
605  if test "$GOBJC" = yes; then
606    OBJCFLAGS="-O2"
607  else
608    OBJCFLAGS=
609  fi
610fi[]dnl
611])# _AC_PROG_OBJC_G
612
613
614## ------------------------------- ##
615## 4. Compilers' characteristics.  ##
616## ------------------------------- ##
617
618
619# -------------------------------- #
620# 4b. C compiler characteristics.  #
621# -------------------------------- #
622
623# libobjc and objc header tests shere?
Note: See TracBrowser for help on using the repository browser.