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

Revision 31446, 5.0 kB (checked in by saturday06, 4 years ago)

duplicate case value

Line 
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.60)
5AC_INIT([i3],[0.1alpha],[dyob@lunaport.net])
6AC_CONFIG_AUX_DIR([build-aux])
7#AM_INIT_AUTOMAKE([gnu no-define check-news std-options tar-pax filename-length-max=99])
8AM_INIT_AUTOMAKE([gnu no-define check-news std-options])
9AC_CONFIG_SRCDIR([src/Main.cpp])
10AC_CONFIG_HEADER([config.h])
11
12# ---------------------------------------
13# this should be set before AC_PROG_CC, AC_USE_SYSTEM_EXTENSIONS
14AC_ARG_ENABLE(debug,
15    AS_HELP_STRING([--enable-debug], [build debug binaries]),
16        enable_debug="$enableval", enable_debug="no")
17AM_CONDITIONAL(ENABLE_DEBUG, test "$enable_debug" = "yes")
18if test "$enable_debug" = "yes"; then
19  if test "$CFLAGS" = ""; then
20    CFLAGS="-O0 -g"
21  fi
22  if test "$CXXFLAGS" = ""; then
23    CXXFLAGS="-O0 -g"
24  fi
25fi
26
27# ---------------------------------------
28# Programs
29AC_USE_SYSTEM_EXTENSIONS
30AC_CANONICAL_HOST
31AC_PROG_CC
32AC_PROG_CXX
33AC_LANG([C++])
34
35AM_CONDITIONAL(USE_GCH, test "$GXX" = "yes")
36
37# ---------------------------------------
38# OS
39
40case "$host_os" in
41    mingw*)
42        with_os=windows
43        with_gui_default=gnustep
44        ;;
45    cygwin*)
46        with_os=unix
47        with_gui_default=windows
48        with_cygwin=yes
49        ;;
50    darwin*)
51        with_os=unix
52        with_gui_default=cocoa
53        ;;
54    *)
55        with_os=unix
56        with_gui_default=gnustep
57        ;;
58esac
59
60AC_ARG_WITH(gui,
61    AS_HELP_STRING([--with-gui={cocoa|gnustep|windows}], [gui]),
62        with_gui="$withval", with_gui=$with_gui_default)
63
64case "$with_gui" in
65    windows)
66    ;;
67    cocoa)
68        CXXFLAGS="$CXXFLAGS -x objective-c++"
69        LDFLAGS="$LDFLAGS -x none -framework Cocoa"
70    ;;
71    gnustep)
72        which gnustep-config > /dev/null
73        if test $? -ne 0; then
74            AC_MSG_WARN([gnustep-config not found])
75        fi
76
77        if test "$enable_debug" = "yes"; then
78            debug_arg="--debug"
79        fi
80
81        CXXFLAGS="$CXXFLAGS -x objective-c++ `perl $srcdir/scripts/gnustep-config-filter.pl $debug_arg gnustep-config --objc-flags`"
82        LDFLAGS="$LDFLAGS -x none"
83        LIBS="$LIBS `perl $srcdir/scripts/gnustep-config-filter.pl $debug_arg gnustep-config --gui-libs`"
84        with_gui=cocoa
85    ;;
86    *)
87        AC_MSG_ERROR([--with-gui=$with_gui is invalid])
88    ;;
89esac
90
91OS_DIR="os-$with_os"
92GUI_DIR="gui-$with_gui"
93AC_SUBST(OS_DIR)
94AC_SUBST(GUI_DIR)
95
96AM_CONDITIONAL(WITH_CYGWIN,      test "$with_cygwin" = "yes")
97AM_CONDITIONAL(WITH_OS_WINDOWS,  test "$with_os"     = "windows")
98AM_CONDITIONAL(WITH_OS_UNIX,     test "$with_os"     = "unix")
99AM_CONDITIONAL(WITH_GUI_WINDOWS, test "$with_gui"    = "windows")
100AM_CONDITIONAL(WITH_GUI_COCOA,   test "$with_gui"    = "cocoa")
101
102if test "$with_gui" != "windows"; then   
103    AC_MSG_CHECKING([objective-c++])
104    prologue="class Foo {}; @interface Bar {} @end @implementation Bar @end"
105    body="Foo foo; Bar* bar;"
106    AC_COMPILE_IFELSE(
107        [AC_LANG_PROGRAM([[$prologue]], [[$body]])],
108            [],
109            [AC_MSG_FAILURE([objective-c++ compiler not found])])
110    LDFLAGS_ORIG="$LDFLAGS"
111    LDFLAGS="$LDFLAGS -x objective-c++"
112    AC_LINK_IFELSE(
113        [AC_LANG_PROGRAM([[$prologue]], [[$body]])],
114            [AC_MSG_RESULT([yes])],
115            [AC_MSG_FAILURE([objective-c++ linker does not work])])
116    LDFLAGS="$LDFLAGS_ORIG"
117fi
118
119# ---------------------------------------
120# Libraries
121
122#
123# boost
124#
125
126AX_BOOST_BASE([1.38.0])
127#AX_BOOST_PROGRAM_OPTIONS
128#AX_BOOST_UNIT_TEST_FRAMEWORK
129
130#
131# pthread
132#
133
134ACX_PTHREAD
135
136#
137# gettext
138#
139
140AC_LANG_PUSH([C])
141AM_GNU_GETTEXT_VERSION([0.16.1])
142AM_GNU_GETTEXT
143AC_LANG_POP
144
145# ---------------------------------------
146# Checks for header files.
147AC_CHECK_HEADERS([popt.h xbyak.h cstdatomic])
148
149# ---------------------------------------
150# Checks for typedefs, structures, and compiler characteristics.
151
152# ---------------------------------------
153# Checks for library functions.
154
155#AC_CHECK_LIB([argtable2],[arg_parse], [], [echo "argtable2 not found"])
156
157#
158# popt
159#
160
161AC_CHECK_LIB([popt],[poptGetContext],
162    [
163        LIBS="$LIBS -lpopt $LIBINTL"
164    ],
165    [
166        AC_CHECK_LIB([popt],[poptFreeContext], [], [echo "popt not found"])
167    ],
168    ["$LIBINTL"])
169
170#
171# wbindtextdomain
172#
173
174LIBS_ORIG="$LIBS"
175LIBS="$LIBS $LIBINTL"
176AC_CHECK_FUNCS([wbindtextdomain])
177LIBS="$LIBS_ORIG"
178
179#
180# atomic operations
181#
182AC_MSG_CHECKING([for __sync_bool_compare_and_swap])
183prog="int data = 0;  __sync_bool_compare_and_swap(&data, 0, 1);"
184AC_LINK_IFELSE(
185    [AC_LANG_PROGRAM([[]], [[$prog]])],
186    [AC_MSG_RESULT([yes])],
187    [
188        CXXFLAGS="$CXXFLAGS -march=$host_cpu"
189        AC_LINK_IFELSE(
190            [AC_LANG_PROGRAM([[]], [[$prog]])],
191                [AC_MSG_RESULT([yes])],
192                [AC_MSG_FAILURE([__sync_bool_compare_and_swap not found])])])
193
194#
195# autotest
196#
197
198AC_CONFIG_TESTDIR([tests])
199AC_CONFIG_FILES([tests/Makefile tests/atlocal])
200
201# ---------------------------------------
202AC_CONFIG_FILES([Makefile intl/Makefile po/Makefile.in])
203AC_OUTPUT
204
205echo "Then type 'make' to make ${PACKAGE_NAME}. Good luck. "
206
Note: See TracBrowser for help on using the browser.