1
dnl Copyright (C) 2005-2006 IOhannes m zm�lnig
2
dnl This file is free software; IOhannes m zm�lnig
3
dnl gives unlimited permission to copy and/or distribute it,
4
dnl with or without modifications, as long as this notice is preserved.
6
# AC_CHECK_CPPFLAGS(ADDITIONAL-CPPFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
8
# checks whether the $(C) compiler accepts the ADDITIONAL-CPPFLAGS
9
# if so, they are added to the CPPFLAGS
10
AC_DEFUN([AC_CHECK_CPPFLAGS],
12
AC_MSG_CHECKING([whether $CPP accepts "$1"])
13
temp_check_cppflags="${CPPFLAGS}"
14
CPPFLAGS="$1 ${CPPFLAGS}"
16
[AC_LANG_SOURCE([[int main(void){return 0;}]])],
17
[AC_MSG_RESULT([yes])],
18
[AC_MSG_RESULT([no]); CPPFLAGS="${temp_check_cppflags}"])
23
# AC_CHECK_CFLAGS(ADDITIONAL-CFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
25
# checks whether the $(C) compiler accepts the ADDITIONAL-CFLAGS
26
# if so, they are added to the CFLAGS
27
AC_DEFUN([AC_CHECK_CFLAGS],
29
AC_MSG_CHECKING([whether $CC accepts "$1"])
30
cat > conftest.c << EOF
35
if $CC $CFLAGS [$1] -o conftest.o conftest.c > /dev/null 2>&1
38
CFLAGS="${CFLAGS} [$1]"
39
AC_CHECK_CPPFLAGS([$1])
47
# AC_CHECK_CXXFLAGS(ADDITIONAL-CXXFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
49
# checks whether the $(CXX) (c++) compiler accepts the ADDITIONAL-CXXFLAGS
50
# if so, they are added to the CXXFLAGS
51
AC_DEFUN([AC_CHECK_CXXFLAGS],
53
AC_MSG_CHECKING([whether $CXX accepts "$1"])
54
cat > conftest.c++ << EOF
59
if $CXX $CPPFLAGS $CXXFLAGS -o conftest.o conftest.c++ [$1] > /dev/null 2>&1
62
CXXFLAGS="${CXXFLAGS} [$1]"
63
AC_CHECK_CPPFLAGS([$1])
71
# AC_CHECK_FRAMEWORK(FRAMEWORK, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
74
AC_DEFUN([AC_CHECK_FRAMEWORK],
76
AC_MSG_CHECKING([for "$1"-framework])
78
temp_check_ldflags_org="${LDFLAGS}"
79
LDFLAGS="-framework [$1] ${LDFLAGS}"
81
AC_LINK_IFELSE(AC_LANG_PROGRAM(,), [temp_check_ldflags_success="yes"],[temp_check_ldflags_success="no"])
83
if test "x$temp_check_ldflags_success" = "xyes"; then
88
LDFLAGS="$temp_check_ldflags_org"
91
])# AC_CHECK_FRAMEWORK
93
# AC_CHECK_LDFLAGS(ADDITIONAL-LDFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
95
# checks whether the $(LD) linker accepts the ADDITIONAL-LDFLAGS
96
# if so, they are added to the LDFLAGS
97
AC_DEFUN([AC_CHECK_LDFLAGS],
99
AC_MSG_CHECKING([whether linker accepts "$1"])
100
temp_check_ldflags_org="${LDFLAGS}"
101
LDFLAGS="$1 ${LDFLAGS}"
103
AC_LINK_IFELSE(AC_LANG_PROGRAM(,), [temp_check_ldflags_success="yes"],[temp_check_ldflags_success="no"])
105
if test "x$temp_check_ldflags_success" = "xyes"; then
110
LDFLAGS="$temp_check_ldflags_org"
116
AC_DEFUN([AC_CHECK_FAT],
118
AC_ARG_ENABLE(fat-binary,
119
[ --enable-fat-binary=ARCHS
120
build an Apple Multi Architecture Binary (MAB);
121
ARCHS is a comma-delimited list of architectures for
122
which to build; if ARCHS is omitted, then the package
123
will be built for all architectures supported by the
124
platform (e.g. "ppc,i386" for MacOS/X and Darwin;
125
if this option is disabled or omitted entirely, then
126
the package will be built only for the target
128
[fat_binary=$enableval], [fat_binary=no])
129
if test "$fat_binary" != no; then
130
AC_MSG_CHECKING([target architectures])
132
# Respect TARGET_ARCHS setting from environment if available.
133
if test -z "$TARGET_ARCHS"; then
134
# Respect ARCH given to --enable-fat-binary if present.
135
if test "$fat_binary" != yes; then
136
TARGET_ARCHS=`echo "$fat_binary" | tr ',' ' '`
138
# Choose a default set of architectures based upon platform.
139
TARGET_ARCHS="ppc i386"
142
AC_MSG_RESULT([$TARGET_ARCHS])
144
define([Name],[translit([$1],[./-], [___])])
145
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
147
for archs in $TARGET_ARCHS
149
[]Name="$[]Name -arch $archs"
152
if test "x$[]Name" != "x"; then
153
AC_CHECK_CFLAGS($[]Name,,[]Name="")
156
if test "x$[]Name" != "x"; then
157
AC_CHECK_LDFLAGS($[]Name,,[]Name="")