1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
#
# This file is part of the Simutrans project under the Artistic License.
# (see LICENSE.txt)
#
simutrans.ac
AC_INIT([simutrans],[version-0.2])
AC_PROG_CC
AC_LANG(C++)
# architecture
AC_C_BIGENDIAN([AC_SUBST(endian, '-DSIM_BIG_ENDIAN')],
[AC_SUBST(endian, '')],
[AC_SUBST(endian, '')],
[AC_SUBST(endian, '')])
# missing libs
AC_CHECK_LIB(png, png_read_image, [],
[AC_MSG_WARN([libpng is missing! Makeobj will not compile!])] )
AC_CHECK_LIB(bz2, BZ2_bzReadOpen, [],
[AC_MSG_WARN([libbz2 is missing! Only zlib compressed saves will be available.])] )
# optional (but highly recommended) multithreading
AC_SEARCH_LIBS(pthread_mutex_destroy, pthread,
[AC_SUBST(multithread, 1)],
[AC_SUBST(multithread, 0)] )
AC_CHECK_LIB(pthreadGC2, pthread_mutex_destroy,
[AC_SUBST(bundlepthread, 1)],
[AC_SUBST(bundlepthread, 0)] )
# find OS and backend by libs ...
AC_CHECK_LIB(SDL2, SDL_GetRenderDriverInfo)
AC_CHECK_HEADERS(windows.h)
AC_CHECK_HEADERS(LocaleRoster.h)
# optional zstd
AC_SEARCH_LIBS(ZSTD_CStreamInSize, zstd,
[AC_SUBST(zstd, 1)],
[AC_SUBST(zstd, 0)] )
# hackish detection of OS ...
if test "$ac_cv_header_windows_h" == yes
then
AC_SUBST(os_type, mingw)
AC_SUBST(av_foundation, 0)
# optional upnp
AC_SEARCH_LIBS(upnpDiscover, miniupnpc,
[AC_SUBST(upnp, 1)],
[AC_SUBST(upnp, 0)],
-liphlpapi -lws2_32 )
# optional fluidsynth
AC_SEARCH_LIBS(new_fluid_settings, fluidsynth,
[AC_SUBST(fluidsynth, 1)],
[AC_SUBST(fluidsynth, 0)],
-lglib-2.0 -lintl -liconv -ldsound -lole32)
else
# optional upnp
AC_SEARCH_LIBS(upnpDiscover, miniupnpc,
[AC_SUBST(upnp, 1)],
[AC_SUBST(upnp, 0)] )
# optional fontconfig
AC_SEARCH_LIBS(FcInitLoadConfigAndFonts, fontconfig,
[AC_SUBST(fontconfig, 1)],
[AC_SUBST(fontconfig, 0)],
-lfontconfig )
# optional fluidsynth
AC_SEARCH_LIBS(new_fluid_settings, fluidsynth,
[AC_SUBST(fluidsynth, 1)],
[AC_SUBST(fluidsynth, 0)] )
# optional fluidsynth
AC_SEARCH_LIBS(FcInit, fontconfig,
[AC_SUBST(fontconfig, 1)],
[AC_SUBST(fontconfig, 0)] )
if uname | grep "Darwin"
then
AC_LANG_PUSH(Objective C++)
AC_CHECK_HEADERS(AVFoundation/AVFoundation.h)
AC_CHECK_HEADERS(QTKit/QTMovie.h)
AC_LANG_POP(Objective C++)
if test "$ac_cv_header_AVFoundation_AVFoundation_h" == yes
then
AC_SUBST(av_foundation, 1)
else
AC_SUBST(av_foundation, 0)
if test "$ac_cv_header_QTKit_QTMovie_h" != yes
then
AC_MSG_ERROR([Neither AVFoundation nor QTKit are available as a sound driver. Simutrans will not compile!])
fi
fi
AC_SUBST(os_type, mac)
else
# Mac stuff
AC_SUBST(av_foundation, 0)
if test "$ac_cv_header_LocaleRoster_h" == yes
then
AC_SUBST(os_type, haiku)
elif uname | grep "Linux"
then
AC_SUBST(os_type, linux)
elif uname | grep "BSD"
then
AC_SUBST(os_type, freebsd)
elif uname | grep "miga"
then
AC_SUBST(os_type, amiga)
else
AC_MSG_ERROR([Unknow OS!])
fi
fi
fi
# and backend ...
AC_ARG_ENABLE([server],
[AS_HELP_STRING(
[--enable-server],
[Builds a server without graphics])],
[],
[enable_server=no])
# first test if forced as server
if test "x$enable_server" != "xno"
then
AC_SUBST(backend, posix)
elif test "$ac_cv_header_windows_h" == yes
then
AC_SUBST(backend, gdi)
AC_MSG_WARN([Using GDI backend!])
AC_SEARCH_LIBS(FT_Init_FreeType, freetype, [], [AC_MSG_ERROR([FreeType Library is needed for graphical interface!])])
elif test "$ac_cv_lib_SDL2_SDL_GetRenderDriverInfo" == yes
then
AC_SUBST(backend, sdl2)
AC_MSG_WARN([Using SDL2 backend!])
AC_SEARCH_LIBS(FT_Init_FreeType, freetype, [], [AC_MSG_ERROR([FreeType Library is needed for graphical interface!])])
else
AC_SUBST(backend, posix)
AC_MSG_WARN([No backend found, using server (posix)!])
fi
# are we in a svn?
if svn info
then
AC_SUBST(svn, 1)
else
AC_SUBST(svn, 0)
fi
AC_CONFIG_FILES([config.default])
AC_OUTPUT
|