| 1 | # -*- coding: us-ascii-unix -*- |
|---|
| 2 | |
|---|
| 3 | m4_define( |
|---|
| 4 | [I3_VERSION_M4_MACRO], |
|---|
| 5 | [m4_esyscmd([. ./unix/scripts/ac_init_version.sh | tr -d '\r\n'])]) |
|---|
| 6 | |
|---|
| 7 | AC_PREREQ([2.61]) |
|---|
| 8 | AC_INIT([windcrest],[I3_VERSION_M4_MACRO],[dyob@lunaport.net]) |
|---|
| 9 | |
|---|
| 10 | # |
|---|
| 11 | # macros |
|---|
| 12 | # |
|---|
| 13 | |
|---|
| 14 | AC_DEFUN([I3_HIGHLIGHTED_ECHO],[ |
|---|
| 15 | echo $1 | GREP_COLOR='01' grep --color=auto '.' 2> /dev/null |
|---|
| 16 | if test $? -ne 0; then |
|---|
| 17 | echo $1 |
|---|
| 18 | fi |
|---|
| 19 | ]) |
|---|
| 20 | |
|---|
| 21 | AC_DEFUN([I3_ADD_OPTION],[ |
|---|
| 22 | if test "$2" != ""; then |
|---|
| 23 | AC_MSG_CHECKING([for $2 ]) |
|---|
| 24 | orig="$$1" |
|---|
| 25 | $1="$2 $$1" |
|---|
| 26 | |
|---|
| 27 | check_result=no |
|---|
| 28 | |
|---|
| 29 | case $1 in |
|---|
| 30 | CPPFLAGS) |
|---|
| 31 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) |
|---|
| 32 | ;; |
|---|
| 33 | CFLAGS) |
|---|
| 34 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) |
|---|
| 35 | ;; |
|---|
| 36 | CXXFLAGS) |
|---|
| 37 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) |
|---|
| 38 | ;; |
|---|
| 39 | LDFLAGS) |
|---|
| 40 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) |
|---|
| 41 | ;; |
|---|
| 42 | LIBS) |
|---|
| 43 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) |
|---|
| 44 | ;; |
|---|
| 45 | *) |
|---|
| 46 | AC_MSG_FAILURE([unknown variable name]) |
|---|
| 47 | ;; |
|---|
| 48 | esac |
|---|
| 49 | |
|---|
| 50 | AC_MSG_RESULT([$check_result]) |
|---|
| 51 | if test "$check_result" = "yes"; then |
|---|
| 52 | true |
|---|
| 53 | $5 |
|---|
| 54 | else |
|---|
| 55 | $1="$orig" |
|---|
| 56 | $6 |
|---|
| 57 | fi |
|---|
| 58 | fi |
|---|
| 59 | ]) |
|---|
| 60 | |
|---|
| 61 | AC_DEFUN([I3_ADD_CPPFLAGS],[I3_ADD_OPTION([CPPFLAGS],[$1],[$2],[$3],[$4],[$5])]) |
|---|
| 62 | AC_DEFUN([I3_ADD_CFLAGS], [I3_ADD_OPTION([CFLAGS], [$1],[$2],[$3],[$4],[$5])]) |
|---|
| 63 | AC_DEFUN([I3_ADD_CXXFLAGS],[I3_ADD_OPTION([CXXFLAGS],[$1],[$2],[$3],[$4],[$5])]) |
|---|
| 64 | AC_DEFUN([I3_ADD_LDFLAGS], [I3_ADD_OPTION([LDFLAGS], [$1],[$2],[$3],[$4],[$5])]) |
|---|
| 65 | AC_DEFUN([I3_ADD_LIBS], [I3_ADD_OPTION([LIBS], [$1],[$2],[$3],[$4],[$5])]) |
|---|
| 66 | |
|---|
| 67 | CFLAGS_before_configure="$CFLAGS" |
|---|
| 68 | CXXFLAGS_before_configure="$CXXFLAGS" |
|---|
| 69 | |
|---|
| 70 | # |
|---|
| 71 | # banner |
|---|
| 72 | # |
|---|
| 73 | |
|---|
| 74 | I3_HIGHLIGHTED_ECHO([$0: $PACKAGE_STRING]) |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | # |
|---|
| 78 | # basic test |
|---|
| 79 | # |
|---|
| 80 | |
|---|
| 81 | AC_CONFIG_AUX_DIR([unix/build-aux]) |
|---|
| 82 | AM_INIT_AUTOMAKE([-Wall gnu no-define filename-length-max=99 std-options nostdinc]) |
|---|
| 83 | #AM_INIT_AUTOMAKE([-Wall gnu no-define filename-length-max=99 std-options nostdinc check-news]) |
|---|
| 84 | AC_CONFIG_SRCDIR([unix/am/i3.am]) |
|---|
| 85 | AC_CONFIG_HEADER([config.h]) |
|---|
| 86 | AC_USE_SYSTEM_EXTENSIONS |
|---|
| 87 | AC_CANONICAL_HOST |
|---|
| 88 | AC_PROG_CXXCPP # for old cygwin |
|---|
| 89 | AC_PROG_CPP |
|---|
| 90 | AC_PROG_CC |
|---|
| 91 | AC_PROG_CXX |
|---|
| 92 | AC_PROG_RANLIB |
|---|
| 93 | AC_LANG([C++]) |
|---|
| 94 | |
|---|
| 95 | AC_DEFINE(MIL_CONFIG_H_INCLUDED, 1, [config.h include guard]) |
|---|
| 96 | |
|---|
| 97 | I3_ADD_CPPFLAGS([-Iintl]) |
|---|
| 98 | I3_ADD_CPPFLAGS([-I$srcdir/src]) |
|---|
| 99 | I3_ADD_CPPFLAGS([-I.]) # for config.h, mil/PrecompiledHeaders.h.gch |
|---|
| 100 | # `-I.' should be placed before `-I$srcdir/src' for gch |
|---|
| 101 | |
|---|
| 102 | # |
|---|
| 103 | # configure options |
|---|
| 104 | # |
|---|
| 105 | |
|---|
| 106 | AC_ARG_ENABLE( |
|---|
| 107 | debug, |
|---|
| 108 | AS_HELP_STRING([--enable-debug],[build debug binaries]), |
|---|
| 109 | enable_debug="$enableval", |
|---|
| 110 | #enable_debug="no" |
|---|
| 111 | enable_debug="yes" |
|---|
| 112 | ) |
|---|
| 113 | |
|---|
| 114 | AM_CONDITIONAL(ENABLE_DEBUG, test "$enable_debug" = "yes") |
|---|
| 115 | if test "$enable_debug" = "yes"; then |
|---|
| 116 | CFLAGS="$CFLAGS_before_configure -O0 -g" |
|---|
| 117 | CXXFLAGS="$CXXFLAGS_before_configure -O0 -g" |
|---|
| 118 | fi |
|---|
| 119 | |
|---|
| 120 | # |
|---|
| 121 | # basic compiler options |
|---|
| 122 | # |
|---|
| 123 | |
|---|
| 124 | #AX_CXX_COMPILE_STDCXX_0X |
|---|
| 125 | #if test "$ax_cv_cxx_compile_cxx0x_native" = yes; then |
|---|
| 126 | # true |
|---|
| 127 | #elif test "$ax_cv_cxx_compile_cxx0x_gxx" = yes; then |
|---|
| 128 | # I3_ADD_CXXFLAGS([-std=gnu++0x]) |
|---|
| 129 | #elif test "$ax_cv_cxx_compile_cxx0x_cxx" = yes; then |
|---|
| 130 | # I3_ADD_CXXFLAGS([-std=c++0x]) |
|---|
| 131 | #else |
|---|
| 132 | # AC_MSG_FAILURE([c++0x support required]) |
|---|
| 133 | #fi |
|---|
| 134 | |
|---|
| 135 | I3_ADD_CXXFLAGS([-funit-at-a-time]) |
|---|
| 136 | |
|---|
| 137 | AX_CFLAGS_WARN_ALL |
|---|
| 138 | AX_CXXFLAGS_WARN_ALL |
|---|
| 139 | I3_ADD_CXXFLAGS([-Wno-missing-field-initializers]) |
|---|
| 140 | I3_ADD_CXXFLAGS([-Wextra]) |
|---|
| 141 | |
|---|
| 142 | if test "$enable_debug" = "yes"; then |
|---|
| 143 | #I3_ADD_CXXFLAGS([-pg]) |
|---|
| 144 | #I3_ADD_CXXFLAGS([-fprofile-arcs]) |
|---|
| 145 | #I3_ADD_CXXFLAGS([-ftest-coverage]) |
|---|
| 146 | |
|---|
| 147 | I3_ADD_CXXFLAGS([-Wcast-align -Wcast-qual -Winit-self -Winvalid-pch -Wpointer-arith]) |
|---|
| 148 | I3_ADD_CXXFLAGS([-Wwrite-strings -Wfloat-equal -Wformat=2 -Wimplicit]) |
|---|
| 149 | I3_ADD_CXXFLAGS([-Wmissing-braces -Wdisabled-optimization -Wconversion]) |
|---|
| 150 | I3_ADD_CXXFLAGS([-Wstrict-aliasing=2]) |
|---|
| 151 | I3_ADD_CXXFLAGS([-Wno-reorder]) |
|---|
| 152 | #I3_ADD_CXXFLAGS([-Weffc++ -Wpadded -Wunsafe-loop-optimizations]) |
|---|
| 153 | |
|---|
| 154 | I3_ADD_CXXFLAGS([-Wno-unused-parameter]) # ... |
|---|
| 155 | #I3_ADD_CXXFLAGS([-Wno-unused-value]) # ... |
|---|
| 156 | #I3_ADD_CXXFLAGS([-Wno-unused]) # ... |
|---|
| 157 | fi |
|---|
| 158 | |
|---|
| 159 | |
|---|
| 160 | # --------------------------------------- |
|---|
| 161 | # Runtime envirinment |
|---|
| 162 | |
|---|
| 163 | # |
|---|
| 164 | # OS selection |
|---|
| 165 | # |
|---|
| 166 | |
|---|
| 167 | case "$host_os" in |
|---|
| 168 | cygwin*) |
|---|
| 169 | with_os=unix |
|---|
| 170 | #with_ui_default=windows |
|---|
| 171 | with_ui_default=gnustep |
|---|
| 172 | I3_ADD_LDFLAGS([-Wl,--enable-auto-import]) |
|---|
| 173 | ;; |
|---|
| 174 | darwin*) |
|---|
| 175 | with_os=unix |
|---|
| 176 | with_ui_default=cocoa |
|---|
| 177 | ;; |
|---|
| 178 | mingw*) |
|---|
| 179 | with_os=windows |
|---|
| 180 | with_ui_default=windows |
|---|
| 181 | I3_ADD_LDFLAGS([-Wl,--enable-auto-import]) |
|---|
| 182 | ;; |
|---|
| 183 | *) |
|---|
| 184 | with_os=unix |
|---|
| 185 | with_ui_default=gnustep |
|---|
| 186 | ;; |
|---|
| 187 | esac |
|---|
| 188 | |
|---|
| 189 | if test "$with_os" = "windows"; then |
|---|
| 190 | I3_ADD_CPPFLAGS([-DMIL_OS_WINDOWS]) |
|---|
| 191 | I3_ADD_LDFLAGS([-mwindows]) |
|---|
| 192 | else |
|---|
| 193 | I3_ADD_CPPFLAGS([-DMIL_OS_UNIX]) |
|---|
| 194 | fi |
|---|
| 195 | |
|---|
| 196 | # |
|---|
| 197 | # UI selection |
|---|
| 198 | # |
|---|
| 199 | |
|---|
| 200 | AC_ARG_WITH(ui, |
|---|
| 201 | AS_HELP_STRING([--with-ui={cocoa|gnustep|windows}],[UI toolkit]), |
|---|
| 202 | with_ui="$withval", with_ui=$with_ui_default) |
|---|
| 203 | |
|---|
| 204 | AX_WITH_PROG([PERL],[perl]) |
|---|
| 205 | if test "$PERL" = ""; then |
|---|
| 206 | AC_MSG_WARN([perl not found]) |
|---|
| 207 | fi |
|---|
| 208 | |
|---|
| 209 | AX_WITH_PROG([VALGRIND],[valgrind]) |
|---|
| 210 | |
|---|
| 211 | case "$with_ui" in |
|---|
| 212 | windows) |
|---|
| 213 | GCH_LANG="c++-header" |
|---|
| 214 | I3_ADD_CXXFLAGS([-fno-operator-names]) |
|---|
| 215 | I3_ADD_CPPFLAGS([-D_WIN32_WINNT=0x0601]) # Windows 7 |
|---|
| 216 | I3_ADD_CPPFLAGS([-DMIL_UI_WINDOWS]) |
|---|
| 217 | if test "$with_os" = "windows"; then |
|---|
| 218 | I3_ADD_CPPFLAGS([-DUNICODE]) |
|---|
| 219 | I3_ADD_CPPFLAGS([-D_UNICODE]) |
|---|
| 220 | fi |
|---|
| 221 | ;; |
|---|
| 222 | cocoa) |
|---|
| 223 | I3_ADD_CXXFLAGS([-fobjc-exceptions]) |
|---|
| 224 | I3_ADD_LDFLAGS([-framework Cocoa]) |
|---|
| 225 | ;; |
|---|
| 226 | gnustep) |
|---|
| 227 | with_ui=cocoa |
|---|
| 228 | AX_WITH_PROG([GNUSTEP_CONFIG],[gnustep-config]) |
|---|
| 229 | if test "$GNUSTEP_CONFIG" = ""; then |
|---|
| 230 | AC_MSG_WARN([gnustep-config not found]) |
|---|
| 231 | else |
|---|
| 232 | if test "$enable_debug" = "yes"; then |
|---|
| 233 | debug_arg="--debug" |
|---|
| 234 | fi |
|---|
| 235 | |
|---|
| 236 | if test "$PERL" != ""; then |
|---|
| 237 | GNUSTEP_CONFIG="$PERL $srcdir/unix/scripts/gnustep-config-filter.pl $debug_arg $GNUSTEP_CONFIG" |
|---|
| 238 | fi |
|---|
| 239 | |
|---|
| 240 | my_gnustep_objc_flags=`$GNUSTEP_CONFIG --objc-flags` |
|---|
| 241 | my_gnustep_gui_libs=`$GNUSTEP_CONFIG --gui-libs` |
|---|
| 242 | |
|---|
| 243 | echo GNUstep objc-flags : $my_gnustep_objc_flags |
|---|
| 244 | echo GNUstep gui-libs : $my_gnustep_gui_libs |
|---|
| 245 | |
|---|
| 246 | CXXFLAGS="$my_gnustep_objc_flags $CXXFLAGS" |
|---|
| 247 | LIBS="$my_gnustep_gui_libs $LIBS" |
|---|
| 248 | fi |
|---|
| 249 | ;; |
|---|
| 250 | *) |
|---|
| 251 | AC_MSG_FAILURE([--with-ui=$with_ui is invalid]) |
|---|
| 252 | ;; |
|---|
| 253 | esac |
|---|
| 254 | |
|---|
| 255 | if test "$with_os" = "windows" || test "$with_ui" = "windows"; then |
|---|
| 256 | I3_ADD_LIBS([-lgdi32 -luser32 -lpsapi -lshlwapi -lcomctl32]) |
|---|
| 257 | fi |
|---|
| 258 | |
|---|
| 259 | if test "$with_ui" = "cocoa"; then |
|---|
| 260 | GCH_LANG="objective-c++-header" |
|---|
| 261 | I3_ADD_LDFLAGS([-x none]) |
|---|
| 262 | I3_ADD_CPPFLAGS([-DMIL_UI_COCOA]) |
|---|
| 263 | |
|---|
| 264 | AC_MSG_CHECKING([for -x objective-c++]) |
|---|
| 265 | CXX_ORIG="$CXX" |
|---|
| 266 | CXX="$CXX -x objective-c++" # can't use CXXFLAGS |
|---|
| 267 | AC_COMPILE_IFELSE( |
|---|
| 268 | [AC_LANG_PROGRAM([[]],[[]])], |
|---|
| 269 | [AC_MSG_RESULT([yes])], |
|---|
| 270 | [ |
|---|
| 271 | AC_MSG_RESULT([no]) |
|---|
| 272 | CXX="$CXX_ORIG" |
|---|
| 273 | AC_MSG_WARN([compiler option "-x objective-c++" unsupported]) |
|---|
| 274 | ] |
|---|
| 275 | ) |
|---|
| 276 | |
|---|
| 277 | CHECKING_OBJCXX="for Objective-C++ toolset works" |
|---|
| 278 | AC_MSG_CHECKING([$CHECKING_OBJCXX]) |
|---|
| 279 | LDFLAGS_ORIG="$LDFLAGS" |
|---|
| 280 | LDFLAGS="$LDFLAGS -x objective-c++" # override "-x none" |
|---|
| 281 | |
|---|
| 282 | AC_LINK_IFELSE( |
|---|
| 283 | [AC_LANG_PROGRAM([[ |
|---|
| 284 | #import <Foundation/Foundation.h> |
|---|
| 285 | #import <AppKit/AppKit.h> |
|---|
| 286 | #include <stdlib.h> |
|---|
| 287 | #include <memory> |
|---|
| 288 | #include <mil/ObjCExceptionFix.h> |
|---|
| 289 | |
|---|
| 290 | class Foo { |
|---|
| 291 | }; |
|---|
| 292 | @interface Bar : NSObject { |
|---|
| 293 | } |
|---|
| 294 | @end |
|---|
| 295 | @implementation Bar |
|---|
| 296 | @end |
|---|
| 297 | ]], |
|---|
| 298 | [[ |
|---|
| 299 | NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; |
|---|
| 300 | Bar* bar = [[Bar alloc] init]; |
|---|
| 301 | [bar release]; |
|---|
| 302 | Foo foo; |
|---|
| 303 | std::auto_ptr<Foo> p(new Foo()); |
|---|
| 304 | NSException* e = [NSException exceptionWithName:@"foo" |
|---|
| 305 | reason:@"bar" |
|---|
| 306 | userInfo:nil]; |
|---|
| 307 | |
|---|
| 308 | NS_DURING { [e raise]; } NS_HANDLER {} NS_ENDHANDLER; |
|---|
| 309 | |
|---|
| 310 | NSLog([e description]); |
|---|
| 311 | [pool release]; |
|---|
| 312 | ]])], |
|---|
| 313 | [AC_MSG_RESULT([yes])], |
|---|
| 314 | [AC_MSG_RESULT([no]) |
|---|
| 315 | echo ----------------------------------------------------- |
|---|
| 316 | echo |
|---|
| 317 | echo ============= |
|---|
| 318 | echo = ERROR LOG = |
|---|
| 319 | echo ============= |
|---|
| 320 | echo |
|---|
| 321 | grep -i -A 100 "$CHECKING_OBJCXX" config.log |
|---|
| 322 | echo |
|---|
| 323 | echo ================= |
|---|
| 324 | echo = ERROR LOG END = |
|---|
| 325 | echo ================= |
|---|
| 326 | echo |
|---|
| 327 | AC_MSG_FAILURE([Objective-C++ toolset does not work])]) |
|---|
| 328 | |
|---|
| 329 | LDFLAGS="$LDFLAGS_ORIG" |
|---|
| 330 | fi |
|---|
| 331 | |
|---|
| 332 | AC_SUBST(GCH_LANG) |
|---|
| 333 | |
|---|
| 334 | OS_DIR="os-$with_os" |
|---|
| 335 | UI_DIR="ui-$with_ui" |
|---|
| 336 | AC_SUBST(OS_DIR) |
|---|
| 337 | AC_SUBST(UI_DIR) |
|---|
| 338 | |
|---|
| 339 | AM_CONDITIONAL(WITH_OS_WINDOWS, test "$with_os" = "windows") |
|---|
| 340 | AM_CONDITIONAL(WITH_OS_UNIX, test "$with_os" = "unix") |
|---|
| 341 | AM_CONDITIONAL(WITH_UI_WINDOWS, test "$with_ui" = "windows") |
|---|
| 342 | AM_CONDITIONAL(WITH_UI_COCOA, test "$with_ui" = "cocoa") |
|---|
| 343 | |
|---|
| 344 | # --------------------------------------- |
|---|
| 345 | # Libraries |
|---|
| 346 | |
|---|
| 347 | # |
|---|
| 348 | # pthread |
|---|
| 349 | # |
|---|
| 350 | |
|---|
| 351 | if test "$with_os" = "unix"; then |
|---|
| 352 | AX_PTHREAD |
|---|
| 353 | CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS" |
|---|
| 354 | LIBS="$PTHREAD_LIBS $LIBS" |
|---|
| 355 | fi |
|---|
| 356 | |
|---|
| 357 | # |
|---|
| 358 | # boost |
|---|
| 359 | # |
|---|
| 360 | |
|---|
| 361 | AX_BOOST_BASE([1.42],[],[AC_MSG_FAILURE([boost c++ libraries required])]) |
|---|
| 362 | I3_ADD_CPPFLAGS([${BOOST_CPPFLAGS}]) |
|---|
| 363 | I3_ADD_LDFLAGS([${BOOST_LDFLAGS}]) |
|---|
| 364 | |
|---|
| 365 | # AX_BOOST could add "-I/usr/include". it causes error while cross compiling on cygwin |
|---|
| 366 | AC_MSG_CHECKING([for compile with boost headers]) |
|---|
| 367 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
|---|
| 368 | #include <boost/cstdint.hpp> |
|---|
| 369 | #include <boost/pool/pool.hpp> |
|---|
| 370 | #include <boost/shared_ptr.hpp> |
|---|
| 371 | #include <boost/static_assert.hpp> |
|---|
| 372 | #include <boost/utility.hpp> |
|---|
| 373 | ]],[[]])],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([failed])]) |
|---|
| 374 | |
|---|
| 375 | # rtti |
|---|
| 376 | I3_ADD_CXXFLAGS([-fno-rtti],[ |
|---|
| 377 | #include <boost/shared_ptr.hpp> |
|---|
| 378 | #include <boost/test/unit_test.hpp> |
|---|
| 379 | ],[],[],[ |
|---|
| 380 | I3_ADD_CXXFLAGS([-fno-rtti],[ |
|---|
| 381 | #include <boost/shared_ptr.hpp> |
|---|
| 382 | #include <mil/TypeInfoDummy.h> |
|---|
| 383 | #include <boost/test/unit_test.hpp> |
|---|
| 384 | ],[],[AC_DEFINE(USE_TEST_TYPEINFODUMMY_H, 1, [use TypeInfoDummy.h for test])]) |
|---|
| 385 | ]) |
|---|
| 386 | |
|---|
| 387 | AC_CHECK_HEADERS([ \ |
|---|
| 388 | boost/detail/is_incrementable.hpp \ |
|---|
| 389 | boost/ptr_container/detail/static_move_ptr.hpp \ |
|---|
| 390 | ],[],[],[ |
|---|
| 391 | #include <stdlib.h> |
|---|
| 392 | ]) |
|---|
| 393 | |
|---|
| 394 | # |
|---|
| 395 | # gettext |
|---|
| 396 | # |
|---|
| 397 | |
|---|
| 398 | # po/POTFILES.in |
|---|
| 399 | $SHELL $srcdir/unix/scripts/POTFILES.in.sh |
|---|
| 400 | if test $? -ne 0; then |
|---|
| 401 | AC_MSG_FAILURE([can't update po/POTFILES.in]) |
|---|
| 402 | fi |
|---|
| 403 | |
|---|
| 404 | # po/LINGUAS |
|---|
| 405 | $SHELL $srcdir/unix/scripts/LINGUAS.sh |
|---|
| 406 | if test $? -ne 0; then |
|---|
| 407 | AC_MSG_FAILURE([can't update po/LINGUAS]) |
|---|
| 408 | fi |
|---|
| 409 | |
|---|
| 410 | AC_LANG_PUSH([C]) # for iconv |
|---|
| 411 | #AM_GNU_GETTEXT_VERSION([0.18.1]) |
|---|
| 412 | AM_GNU_GETTEXT_VERSION([0.17]) |
|---|
| 413 | #AM_GNU_GETTEXT_VERSION([0.16.1]) |
|---|
| 414 | #AM_GNU_GETTEXT_VERSION([0.14.5]) |
|---|
| 415 | AM_GNU_GETTEXT |
|---|
| 416 | #AM_GNU_GETTEXT([external],[],[$(top_builddir)/src/intl/]) |
|---|
| 417 | #AM_GNU_GETTEXT_INTL_SUBDIR |
|---|
| 418 | AC_LANG_POP |
|---|
| 419 | |
|---|
| 420 | I3_ADD_LIBS([$LIBICONV]) |
|---|
| 421 | |
|---|
| 422 | # |
|---|
| 423 | # wbindtextdomain |
|---|
| 424 | # |
|---|
| 425 | |
|---|
| 426 | AC_CHECK_FUNCS([wbindtextdomain]) |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | # |
|---|
| 430 | # popt (may depend on gettext, put it after AM_GNU_GETTEXT) |
|---|
| 431 | # |
|---|
| 432 | |
|---|
| 433 | if test "$with_os" = "unix"; then |
|---|
| 434 | AC_CHECK_HEADERS([popt.h],[AC_CHECK_LIB([popt],[poptGetContext])]) |
|---|
| 435 | fi |
|---|
| 436 | |
|---|
| 437 | |
|---|
| 438 | # --------------------------------------- |
|---|
| 439 | # Checks for header files. |
|---|
| 440 | |
|---|
| 441 | AC_CHECK_HEADERS([malloc.h semaphore.h]) |
|---|
| 442 | AC_CHECK_HEADERS([uxtheme.h dwmapi.h],[],[],[ |
|---|
| 443 | #include <windows.h> |
|---|
| 444 | ]) |
|---|
| 445 | |
|---|
| 446 | AC_CHECK_HEADERS([tbb/tbb_allocator.h],[ |
|---|
| 447 | I3_ADD_LIBS([-ltbb]) |
|---|
| 448 | ]) |
|---|
| 449 | |
|---|
| 450 | # --------------------------------------- |
|---|
| 451 | # Checks for typedefs, structures, and compiler characteristics. |
|---|
| 452 | |
|---|
| 453 | AC_CHECK_TYPES([HPAINTBUFFER],[],[],[ |
|---|
| 454 | #include <windows.h> |
|---|
| 455 | #include <uxtheme.h> |
|---|
| 456 | ]) |
|---|
| 457 | |
|---|
| 458 | # |
|---|
| 459 | # Precompiled Headers |
|---|
| 460 | # |
|---|
| 461 | |
|---|
| 462 | use_gch=no |
|---|
| 463 | if test "$GXX" = "yes" && test "$enable_debug" = "yes"; then |
|---|
| 464 | AC_MSG_CHECKING([for Precompiled Headers]) |
|---|
| 465 | cat >>gch_check.h <<GCH_CHECK_H |
|---|
| 466 | #if MIL_UI_COCOA |
|---|
| 467 | #include <Cocoa/Cocoa.h> |
|---|
| 468 | #endif |
|---|
| 469 | #include <vector> |
|---|
| 470 | GCH_CHECK_H |
|---|
| 471 | gch_check_command="$CXX -c $CXXFLAGS $CPPFLAGS -x $GCH_LANG gch_check.h" |
|---|
| 472 | echo $gch_check_command |
|---|
| 473 | $gch_check_command > gch_check.out 2> gch_check.err |
|---|
| 474 | if test $? -eq 0; then |
|---|
| 475 | AC_MSG_RESULT([yes]) |
|---|
| 476 | rm -f gch_check* |
|---|
| 477 | use_gch=yes |
|---|
| 478 | else |
|---|
| 479 | AC_MSG_RESULT([no]) |
|---|
| 480 | fi |
|---|
| 481 | fi |
|---|
| 482 | AM_CONDITIONAL(USE_GCC_PRECOMPILED_HEADER, test "$use_gch" = "yes") |
|---|
| 483 | |
|---|
| 484 | |
|---|
| 485 | # --------------------------------------- |
|---|
| 486 | # Checks for library functions. |
|---|
| 487 | |
|---|
| 488 | AC_CHECK_FUNCS([putenv setenv]) |
|---|
| 489 | |
|---|
| 490 | # |
|---|
| 491 | # semaphore |
|---|
| 492 | # |
|---|
| 493 | |
|---|
| 494 | AC_MSG_CHECKING([for unnamed semaphore]) |
|---|
| 495 | AC_RUN_IFELSE( |
|---|
| 496 | [AC_LANG_PROGRAM([[ |
|---|
| 497 | #include <stdlib.h> |
|---|
| 498 | #include <semaphore.h> |
|---|
| 499 | ]], |
|---|
| 500 | [[ |
|---|
| 501 | sem_t sem; |
|---|
| 502 | if (sem_init(&sem, 0, 0) == 0) { |
|---|
| 503 | sem_destroy(&sem); |
|---|
| 504 | return EXIT_SUCCESS; |
|---|
| 505 | } else { |
|---|
| 506 | return EXIT_FAILURE; |
|---|
| 507 | } |
|---|
| 508 | ]])], |
|---|
| 509 | [AC_MSG_RESULT([yes]) |
|---|
| 510 | AC_DEFINE(HAVE_UNNAMED_SEMAPHORE, 1, [Unnamed semaphore])], |
|---|
| 511 | [AC_MSG_RESULT([no])], |
|---|
| 512 | [AC_MSG_RESULT([treat as no (cross compiling)])]) |
|---|
| 513 | |
|---|
| 514 | # |
|---|
| 515 | # atomic operations |
|---|
| 516 | # |
|---|
| 517 | |
|---|
| 518 | AC_MSG_CHECKING([for __sync_bool_compare_and_swap]) |
|---|
| 519 | |
|---|
| 520 | AC_DEFUN([I3_GCC_ATOMIC_OPERATIONS_FOUND],[ |
|---|
| 521 | AC_MSG_RESULT([yes]) |
|---|
| 522 | AC_DEFINE(HAVE_GCC_ATOMIC_OPERATIONS,[],[TODO: Description]) |
|---|
| 523 | ]) |
|---|
| 524 | |
|---|
| 525 | body="int data = 0; __sync_bool_compare_and_swap(&data, 0, 1);" |
|---|
| 526 | |
|---|
| 527 | CXXFLAGS_ORIG="$CXXFLAGS" |
|---|
| 528 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$body]])],[I3_GCC_ATOMIC_OPERATIONS_FOUND],[ |
|---|
| 529 | CXXFLAGS="-march=i486 $CXXFLAGS_ORIG" |
|---|
| 530 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$body]])],[I3_GCC_ATOMIC_OPERATIONS_FOUND],[ |
|---|
| 531 | CXXFLAGS="-march=$host_cpu $CXXFLAGS_ORIG" |
|---|
| 532 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[$body]])],[I3_GCC_ATOMIC_OPERATIONS_FOUND],[ |
|---|
| 533 | AC_MSG_RESULT([no]); CXXFLAGS="$CXXFLAGS_ORIG" |
|---|
| 534 | ]) |
|---|
| 535 | ]) |
|---|
| 536 | ]) |
|---|
| 537 | |
|---|
| 538 | |
|---|
| 539 | # |
|---|
| 540 | # my helper variable |
|---|
| 541 | # |
|---|
| 542 | |
|---|
| 543 | I3_CONFIGURE_DATE=`date +%Y%m%d.%H%M%S` |
|---|
| 544 | AC_SUBST(I3_CONFIGURE_DATE) |
|---|
| 545 | |
|---|
| 546 | # |
|---|
| 547 | # internal consistency check |
|---|
| 548 | # |
|---|
| 549 | |
|---|
| 550 | AC_MSG_CHECKING([for simple test program]) |
|---|
| 551 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
|---|
| 552 | #include <stdlib.h> |
|---|
| 553 | #include <cstdio> |
|---|
| 554 | #include <list> |
|---|
| 555 | #include <boost/pool/pool.hpp> |
|---|
| 556 | ]], |
|---|
| 557 | [[ |
|---|
| 558 | using namespace std; |
|---|
| 559 | try { |
|---|
| 560 | // instanciation test |
|---|
| 561 | boost::pool<> p(10); |
|---|
| 562 | list<int> l; |
|---|
| 563 | } catch ( ... ) { |
|---|
| 564 | return EXIT_FAILURE; |
|---|
| 565 | } |
|---|
| 566 | ]])],[AC_MSG_RESULT([yes])], |
|---|
| 567 | [AC_MSG_RESULT([no]); AC_MSG_FAILURE([simple test program does not work])]) |
|---|
| 568 | |
|---|
| 569 | AC_MSG_CHECKING([for simple error test program]) |
|---|
| 570 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
|---|
| 571 | #include <boost/pool/pool.hpp> |
|---|
| 572 | ]], |
|---|
| 573 | [[ |
|---|
| 574 | struct { double x; } foo = "bar"; |
|---|
| 575 | ]])],[AC_MSG_RESULT([yes]); AC_MSG_FAILURE([no error])], |
|---|
| 576 | [AC_MSG_RESULT([no])]) |
|---|
| 577 | |
|---|
| 578 | AC_CHECK_HEADERS([__NON__EXISTANT__HEADER__FILE__], |
|---|
| 579 | [AC_MSG_FAILURE([no error when include file is not found])]) |
|---|
| 580 | |
|---|
| 581 | # --------------------------------------- |
|---|
| 582 | AC_CONFIG_TESTDIR([unix/tests]) |
|---|
| 583 | AC_CONFIG_FILES([Makefile intl/Makefile po/Makefile.in unix/i3.spec unix/tests/Makefile unix/tests/atlocal]) |
|---|
| 584 | AC_CONFIG_FILES([unix/debian/changelog]) # !! |
|---|
| 585 | AC_OUTPUT |
|---|
| 586 | |
|---|
| 587 | I3_HIGHLIGHTED_ECHO(["Then type \`make' to make ${PACKAGE_NAME}. Good luck. "]) |
|---|