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