root/lang/objective-cplusplus/i3/trunk/configure.ac @ 35844

Revision 35844, 7.2 kB (checked in by saturday06, 4 years ago)

lplp

Line 
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.60)
5AC_INIT([i3],[m4_esyscmd(./scripts/ac_init_version.sh | tr -d '\r\n')],[dyob@lunaport.net])
6
7CFLAGS_before_configure="$CFLAGS"
8CXXFLAGS_before_configure="$CXXFLAGS"
9OBJCFLAGS_before_configure="$OBJCFLAGS"
10
11AC_CONFIG_AUX_DIR([build-aux])
12AM_INIT_AUTOMAKE([-Wall gnu no-define std-options filename-length-max=99])
13#AM_INIT_AUTOMAKE([-Wall gnu no-define check-news std-options filename-length-max=99 color-tests])
14AC_CONFIG_SRCDIR([src/Main.cpp])
15AC_CONFIG_HEADER([config.h])
16
17# ---------------------------------------
18# Programs
19AC_USE_SYSTEM_EXTENSIONS
20AC_CANONICAL_HOST
21AC_PROG_CC
22AC_PROG_CXX
23AC_PROG_OBJC
24AC_LANG([C++])
25
26AC_ARG_ENABLE(debug,
27              AS_HELP_STRING([--enable-debug], [build debug binaries]),
28              enable_debug="$enableval",
29#              enable_debug="no"
30              enable_debug="yes"
31                           )
32AM_CONDITIONAL(ENABLE_DEBUG, test "$enable_debug" = "yes")
33if test "$enable_debug" = "yes"; then
34    if test "$CFLAGS_before_configure" = ""; then
35        CFLAGS="-O0 -g"
36    fi
37    if test "$CXXFLAGS_before_configure" = ""; then
38        CXXFLAGS="-O0 -g"
39    fi
40    if test "$OBJCFLAGS_before_configure" = ""; then
41        OBJCFLAGS="-O0 -g"
42    fi
43fi
44
45# ---------------------------------------
46# OS
47
48case "$host_os" in
49    mingw*)
50        with_os=windows
51        with_gui_default=windows
52        ;;
53    cygwin)
54        with_os=unix
55        with_gui_default=windows
56        with_cygwin=yes
57        ;;
58    darwin*)
59        with_os=unix
60        with_gui_default=cocoa
61        ;;
62    *)
63        with_os=unix
64        with_gui_default=gnustep
65        ;;
66esac
67
68AC_ARG_WITH(gui,
69    AS_HELP_STRING([--with-gui={cocoa|gnustep|windows}], [gui]),
70        with_gui="$withval", with_gui=$with_gui_default)
71
72case "$with_gui" in
73    windows)
74        GCH_LANG="c++-header"
75    ;;
76    cocoa)
77        GCH_LANG="objective-c++-header"
78        CXXFLAGS="$CXXFLAGS -xobjective-c++"
79        LDFLAGS="$LDFLAGS -xnone -framework Cocoa"
80    ;;
81    gnustep)
82        with_gui=cocoa
83        GCH_LANG="objective-c++-header"
84        CXXFLAGS="$CXXFLAGS -xobjective-c++"
85        LDFLAGS="$LDFLAGS -xnone"
86
87        #AC_CHECK_PROG(GNUSTEP_CONFIG, gnustep-config)
88        which gnustep-config > /dev/null
89        if test $? -eq 0; then
90            GNUSTEP_CONFIG="gnustep-config"
91            if test "$enable_debug" = "yes"; then
92                debug_arg="--debug"
93            fi
94
95            #AC_CHECK_PROG(GNUSTEP_CONFIG, perl)
96            which perl > /dev/null
97            if test $? -eq 0; then
98                GNUSTEP_CONFIG="perl $srcdir/scripts/gnustep-config-filter.pl $debug_arg $GNUSTEP_CONFIG"
99            else
100                AC_MSG_WARN([perl not found])
101            fi
102
103            OBJCFLAGS="$OBJCFLAGS `$GNUSTEP_CONFIG --objc-flags`"
104            CXXFLAGS="$CXXFLAGS `$GNUSTEP_CONFIG --objc-flags`"
105            LIBS="$LIBS `$GNUSTEP_CONFIG --gui-libs`"
106        else
107            AC_MSG_WARN([gnustep-config not found])
108        fi
109    ;;
110    *)
111        AC_MSG_ERROR([--with-gui=$with_gui is invalid])
112    ;;
113esac
114
115if test "$with_gui" != "windows"; then
116    AC_MSG_CHECKING([objective-c++])
117    prologue="class Foo {}; @interface Bar {} @end @implementation Bar @end"
118    body="Foo foo; Bar* bar;"
119    LDFLAGS_ORIG="$LDFLAGS"
120    LDFLAGS="$LDFLAGS -xobjective-c++"
121    AC_LINK_IFELSE(
122        [AC_LANG_PROGRAM([[$prologue]], [[$body]])],
123        [AC_MSG_RESULT([yes])],
124        [AC_MSG_FAILURE([objective-c++ compiler/linker does not work])])
125    AC_CHECK_HEADERS([boost/ptr_container/detail/static_move_ptr.hpp boost/detail/is_incrementable.hpp])
126    LDFLAGS="$LDFLAGS_ORIG"
127fi
128AC_CHECK_HEADERS([__NON..EXISTANT--HEADER__FILE__],
129                 [AC_MSG_FAILURE([no error when include file is not found])])
130
131AC_SUBST(GCH_LANG)
132
133OS_DIR="os-$with_os"
134GUI_DIR="gui-$with_gui"
135AC_SUBST(OS_DIR)
136AC_SUBST(GUI_DIR)
137
138AM_CONDITIONAL(WITH_CYGWIN,      test "$with_cygwin" = "yes")
139AM_CONDITIONAL(WITH_OS_WINDOWS,  test "$with_os"     = "windows")
140AM_CONDITIONAL(WITH_OS_UNIX,     test "$with_os"     = "unix")
141AM_CONDITIONAL(WITH_GUI_WINDOWS, test "$with_gui"    = "windows")
142AM_CONDITIONAL(WITH_GUI_COCOA,   test "$with_gui"    = "cocoa")
143
144# ---------------------------------------
145# Libraries
146
147#
148# boost
149#
150
151AX_BOOST_BASE([1.33.1])
152
153#
154# pthread
155#
156
157ACX_PTHREAD
158
159#
160# gettext
161#
162
163AC_LANG_PUSH([C])
164AM_GNU_GETTEXT_VERSION([0.17])
165#AM_GNU_GETTEXT_VERSION([0.16.1])
166#AM_GNU_GETTEXT_VERSION([0.14.5])
167AM_GNU_GETTEXT
168AC_LANG_POP
169
170# ---------------------------------------
171# Checks for header files.
172
173#AC_CHECK_HEADERS([xbyak.h cstdatomic])
174
175# ---------------------------------------
176# Checks for typedefs, structures, and compiler characteristics.
177
178# ---------------------------------------
179# Checks for library functions.
180
181#
182# popt
183#
184
185#AC_LANG_PUSH([C])
186AC_CHECK_HEADERS(
187    [popt.h],
188    [AC_CHECK_LIB(
189        [popt],
190        [poptGetContext],
191        [LIBS="$LIBS -lpopt $LIBINTL"],
192        [AC_CHECK_LIB(
193            [popt],
194            [poptFreeContext])],
195        ["$LIBINTL"])])
196#AC_LANG_POP
197
198#
199# wbindtextdomain
200#
201
202LIBS_ORIG="$LIBS"
203LIBS="$LIBS $LIBINTL"
204AC_CHECK_FUNCS([wbindtextdomain])
205LIBS="$LIBS_ORIG"
206
207#
208# atomic operations
209#
210
211CXXFLAGS_ORIG="$CXXFLAGS"
212AC_MSG_CHECKING([for __sync_bool_compare_and_swap])
213prog="int data = 0;  __sync_bool_compare_and_swap(&data, 0, 1);"
214
215gcc_atomic_operations_found() {
216    AC_MSG_RESULT([yes]);
217    AC_DEFINE(HAVE_GCC_ATOMIC_OPERATIONS,[],[TODO: Description])
218}
219
220AC_LINK_IFELSE(
221    [AC_LANG_PROGRAM([[]], [[$prog]])],
222    [gcc_atomic_operations_found],
223    [
224        CXXFLAGS="$CXXFLAGS -march=$host_cpu"
225        AC_LINK_IFELSE(
226            [AC_LANG_PROGRAM([[]], [[$prog]])],
227            [gcc_atomic_operations_found],
228            [AC_MSG_RESULT([no]); CXXFLAGS="$CXXFLAGS_ORIG"])])
229
230CXXFLAGS_NO_LANG=`echo $CXXFLAGS | sed "s/-xobjective-c++//" -`
231AC_SUBST(CXXFLAGS_NO_LANG)
232
233# -Wno-missing-field-initializers
234AC_MSG_CHECKING([for -Wno-missing-field-initializers])
235CXXFLAGS_ORIG="$CXXFLAGS"
236CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers"
237AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
238                  [AC_MSG_RESULT([yes])],
239                  [AC_MSG_RESULT([no]); CXXFLAGS="$CXXFLAGS_ORIG"])
240
241#
242# precompiled headers
243#
244
245use_gch=no
246if test "$GXX" = "yes"; then
247    if test "$enable_debug" = "yes"; then
248        AC_MSG_CHECKING([for precompiled headers])
249        CXXFLAGS_ORIG="$CXXFLAGS"
250        output=foo.cpp.gch
251        rm -f $output
252        if test -e $output; then
253            AC_MSG_ERROR([can't remove file '$output'])
254        fi
255        CXXFLAGS="$CXXFLAGS_NO_LANG -x$GCH_LANG -o $output"
256        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [], [])
257        if test -e $output; then
258            AC_MSG_RESULT([yes])
259            use_gch=yes
260        else
261            AC_MSG_RESULT([no])
262        fi
263        rm -f $output
264        CXXFLAGS="$CXXFLAGS_ORIG"
265    fi
266fi
267AM_CONDITIONAL(USE_GCC_PRECOMPILED_HEADER, test "$use_gch" = "yes")
268
269#
270# autotest
271#
272
273AC_CONFIG_TESTDIR([tests])
274AC_CONFIG_FILES([tests/Makefile tests/atlocal])
275
276# ---------------------------------------
277AC_CONFIG_FILES([Makefile intl/Makefile po/Makefile.in])
278AC_OUTPUT
279
280echo "Then type \`make' to make ${PACKAGE_NAME}. Good luck. "
281
282
Note: See TracBrowser for help on using the browser.