1 AC_INIT([odcctools], [590.36od13], [odcctools@opendarwin.org])
3 AC_REVISION([$Revision: 1.44 $])
5 AC_CONFIG_SRCDIR([APPLE_LICENSE])
6 AC_CONFIG_HEADERS([include/config.h])
19 AC_MSG_ERROR([$PACKAGE_NAME only supports targeting Darwin])
25 AC_DEFINE(EMULATED_HOST_CPU_TYPE, 18, [Emulated CPU type])
26 AC_DEFINE(EMULATED_HOST_CPU_SUBTYPE, 100, [Emulated CPU subtype])
29 AC_DEFINE(EMULATED_HOST_CPU_TYPE, 7, [Emulated CPU type])
30 AC_DEFINE(EMULATED_HOST_CPU_SUBTYPE, 10, [Emulated CPU subtype])
33 AC_MSG_ERROR([Unsupported target $target_cpu])
43 AC_CHECK_TOOL([HOST_RANLIB], [ranlib], :)
44 AC_CHECK_TOOL([HOST_AR], [ar], :)
48 AC_MSG_CHECKING([for configured assembler targets])
49 AC_ARG_ENABLE([as-targets],
50 AC_HELP_STRING([--enable-as-targets],
51 [space-separated list ("ppc", "ppc64", "i386", "x86_64", "all")]),
52 [conftargets="$enableval"],
53 [conftargets="default"])
55 case "$conftargets" in
57 ASTARGETS="ppc ppc64 i386 x86_64"
60 ASTARGETS="ppc ppc64 i386 x86_64"
63 AC_MSG_ERROR([no assembler targets configured])
66 AC_MSG_ERROR([no assembler targets configured])
69 if [[ -z "$conftargets" ]]; then
70 AC_MSG_ERROR([no assembler targets configured])
72 ASTARGETS="$conftargets"
76 AC_MSG_RESULT([$ASTARGETS])
77 AC_SUBST([ASTARGETS], [$ASTARGETS])
79 AC_SUBST([ASLIBEXECDIR], ['${libexecdir}/as'])
81 AC_ARG_WITH([sysroot],
82 AC_HELP_STRING([--with-sysroot],
83 [filesystem root of cross build environment]),
84 [AC_DEFINE_UNQUOTED([CROSS_SYSROOT],["$withval"],[filesystem root of cross build environment])])
87 CFLAGS="$CFLAGS -mdynamic-no-pic"
88 AC_MSG_CHECKING([if -mdynamic-no-pic is supported])
90 [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])],
91 [AC_SUBST([MDYNAMICNOPIC],[-mdynamic-no-pic])
92 AC_MSG_RESULT([yes])],
93 [AC_SUBST([MDYNAMICNOPIC],[])
99 CFLAGS="$CFLAGS -fno-builtin-round"
100 AC_MSG_CHECKING([if -fno-builtin-round is supported])
102 [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])],
103 [AC_MSG_RESULT([yes])],
109 CFLAGS="$CFLAGS -fno-builtin-trunc"
110 AC_MSG_CHECKING([if -fno-builtin-trunc is supported])
112 [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])],
113 [AC_MSG_RESULT([yes])],
119 CFLAGS="$CFLAGS -no-cpp-precomp"
121 AC_MSG_CHECKING([if -no-cpp-precomp is supported])
122 AC_LANG_CONFTEST([[const char hw[] = "Hello, World\n";]])
123 rm -f conftest.$ac_objext conftest$ac_exeext
124 out=`$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1`
125 if [[ $? -ne 0 ]]; then
128 unrecog=`echo $out | grep unrecog | wc -l`
129 if [[ $unrecog -gt 0 ]]; then
136 if [[ $supported -eq 1 ]]; then
142 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
147 CFLAGS="$CFLAGS -Wall"
148 AC_MSG_CHECKING([if -Wall is supported])
150 [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])],
151 [WARNINGS="$WARNINGS -Wall"
152 AC_MSG_RESULT([yes])],
153 [AC_MSG_RESULT([no])]
158 CFLAGS="$CFLAGS -Wno-long-double"
159 AC_MSG_CHECKING([if -Wno-long-double is supported])
161 [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])],
162 [WARNINGS="$WARNINGS -Wno-long-double"
163 AC_MSG_RESULT([yes])],
164 [AC_MSG_RESULT([no])]
169 CFLAGS="$CFLAGS -Wno-import"
170 AC_MSG_CHECKING([if -Wno-import is supported])
172 [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])],
173 [WARNINGS="$WARNINGS -Wno-import"
174 AC_MSG_RESULT([yes])],
175 [AC_MSG_RESULT([no])]
179 AC_SUBST([WARNINGS], [$WARNINGS])
182 CFLAGS="$CFLAGS -x objective-c"
183 OBJC="-x objective-c"
184 AC_MSG_CHECKING([if -x objective-c is supported])
186 [AC_LANG_SOURCE([[@class foo;
191 [AC_DEFINE(HAVE_OBJC, 1, [Have Objective-C support])
192 AC_MSG_RESULT([yes])],
196 AC_SUBST([OBJC], [$OBJC])
200 AC_MSG_CHECKING([if __private_extern__ is supported])
202 [AC_LANG_SOURCE([[__private_extern__ int foo;]])],
203 [AC_SUBST([HAVE_PRIVEXT], [YES])
204 AC_MSG_RESULT([yes])],
205 [AC_SUBST([HAVE_PRIVEXT], [NO])
210 LDFLAGS="-multiply_defined suppress"
211 AC_MSG_CHECKING([if -multiply_defined suppress is supported])
212 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
213 [AC_MSG_RESULT([yes])],
214 [LDFLAGS="$ORIGLDFLAGS"
219 AC_CHECK_HEADERS([stdio.h errno.h limits.h])
220 if [[ "x$OBJC" != "x" ]]; then
222 CFLAGS="$CFLAGS $OBJC"
223 AC_CHECK_HEADERS([objc/objc-runtime.h])
227 AC_MSG_CHECKING([for max unsigned long long])
229 [AC_LANG_SOURCE([[#if HAVE_LIMITS_H
232 unsigned long long a = ULLONG_MAX;]])],
233 [AC_MSG_RESULT([ULLONG_MAX])],
235 [AC_LANG_SOURCE([[#if HAVE_LIMITS_H
238 unsigned long long a = 18446744073709551615ULL;]])],
239 [AC_DEFINE(ULLONG_MAX, [18446744073709551615ULL], [max unsigned long long])
240 AC_MSG_RESULT([18446744073709551615ULL])],
241 [AC_MSG_RESULT([none]) ]
246 AC_CHECK_FUNCS([strmode qsort_r qsort getattrlist NSIsSymbolNameDefined])
248 AC_CHECK_DECLS([getc_unlocked])
249 AH_VERBATIM([HAVE_DECL_GETC_UNLOCKED_REPLACEMENT],
250 [/* For systems that don't have getc_unlocked, use getc */
251 #if !HAVE_DECL_GETC_UNLOCKED
252 # define getc_unlocked(a) getc(a)
259 AC_SUBST([HAVE_FOREIGN_HEADERS],[NO])
262 AC_SUBST([HAVE_FOREIGN_HEADERS],[YES])
263 AC_SUBST([EMULATED_OBJ], [emulated.c])
264 AC_C_BIGENDIAN([AC_SUBST([ENDIAN_FLAG],[-D__BIG_ENDIAN__=1])],
265 [AC_SUBST([ENDIAN_FLAG],[-D__LITTLE_ENDIAN__=1])])
269 COMPONENTS="ar as include libstuff libmacho ld ld64 man misc otool"
270 AC_SUBST([COMPONENTS], [$COMPONENTS])
272 AC_CONFIG_FILES([Makefile include/Makefile libstuff/Makefile libmacho/Makefile])
273 AC_CONFIG_FILES([ar/Makefile])
274 AC_CONFIG_FILES([as/Makefile])
275 for ast in $ASTARGETS; do
278 AC_CONFIG_FILES([as/ppc/Makefile:as/ppc/Makefile.in:as/Makefile.arch.in])
281 AC_CONFIG_FILES([as/ppc64/Makefile:as/ppc64/Makefile.in:as/Makefile.arch.in])
284 AC_CONFIG_FILES([as/i386/Makefile:as/i386/Makefile.in:as/Makefile.arch.in])
287 AC_CONFIG_FILES([as/x86_64/Makefile:as/x86_64/Makefile.in:as/Makefile.arch.in])
290 AC_MSG_ERROR([Unrecognized assembler target $ast])
294 AC_CONFIG_FILES([ld/Makefile])
295 AC_CONFIG_FILES([ld64/Makefile])
296 AC_CONFIG_FILES([man/Makefile])
297 AC_CONFIG_FILES([misc/Makefile])
298 AC_CONFIG_FILES([otool/Makefile])