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