1dnl Process this file with autoconf to produce a configure script. 2dnl $Id: configure.in 409 2004-06-07 21:10:20Z roms $ 3 4dnl Init. 5AC_PREREQ(2.57) 6AC_INIT(TiEmu, 3.03, [tiemu-users@lists.sourceforge.net]) 7 8AM_INIT_AUTOMAKE([dist-bzip2]) 9AM_MAINTAINER_MODE 10 11AC_PREFIX_DEFAULT(/usr/local) 12 13dnl Files to configure. 14AC_CONFIG_SRCDIR([src/gui/main.c]) 15AC_CONFIG_HEADERS([config.h]) 16AC_CONFIG_FILES([ 17 Makefile 18 build/Makefile 19 glade/Makefile 20 help/Makefile 21 man/Makefile 22 misc/Makefile 23 pedrom/Makefile 24 pixmaps/Makefile 25 po/Makefile.in 26 skins/Makefile 27 src/Makefile 28 tiemu.lsm 29 tiemu.spec 30]) 31 32AC_MSG_CHECKING([for something to drink while compiling]) 33AC_MSG_RESULT([err: no fridge found!]) 34 35# Setup libtool. 36AC_DISABLE_STATIC 37AC_LIBTOOL_WIN32_DLL 38AC_PROG_LIBTOOL 39 40# Checks for programs. 41AC_PROG_CC 42AC_PROG_INSTALL 43AC_PROG_MAKE_SET 44AC_PROG_LN_S 45AC_ISC_POSIX 46AC_CHECK_PROG(GROFF, groff, yes, no) 47AM_CONDITIONAL(USE_GROFF, test "$GROFF" != "no") 48AC_CHECK_TOOL(RC, windres, windres) 49 50# Checks for libraries. 51AM_GNU_GETTEXT(external) 52AC_SUBST(INCINTL) 53 54PKG_CHECK_MODULES(TICABLES, ticables2 >= 1.3.0) 55AC_SUBST(TICABLES_CFLAGS) 56AC_SUBST(TICABLES_LIBS) 57 58PKG_CHECK_MODULES(TICALCS, ticalcs2 >= 1.0.7) 59AC_SUBST(TICALCS_CFLAGS) 60AC_SUBST(TICALCS_LIBS) 61 62PKG_CHECK_MODULES(TIFILES, tifiles2 >= 1.0.7) 63AC_SUBST(TIFILES_CFLAGS) 64AC_SUBST(TIFILES_LIBS) 65 66PKG_CHECK_MODULES(TICONV, ticonv >= 1.0.4) 67AC_SUBST(TICONV_CFLAGS) 68AC_SUBST(TICONV_LIBS) 69 70PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6.0) 71AC_SUBST(GLIB_CFLAGS) 72AC_SUBST(GLIB_LIBS) 73 74PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0) 75AC_SUBST(GTK_CFLAGS) 76AC_SUBST(GTK_LIBS) 77 78PKG_CHECK_MODULES(GLADE, libglade-2.0 >= 2.4.0) 79AC_SUBST(GLADE_CFLAGS) 80AC_SUBST(GLADE_LIBS) 81 82# D-Bus support 83AC_ARG_WITH(dbus, AC_HELP_STRING([--with-dbus], [Compile with D-Bus support]), [dbus=$withval], [dbus=no]) 84if test "x$dbus" = "xyes"; then 85 PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.60) 86 AC_DEFINE(WITH_DBUS, 1, [Use D-Bus support]) 87else 88 DBUS_GLIB_CFLAGS= 89 DBUS_GLIB_LIBS= 90fi 91AC_SUBST(DBUS_GLIB_CFLAGS) 92AC_SUBST(DBUS_GLIB_LIBS) 93AC_SUBST(dbus) 94 95# Checks for header files. 96AC_HEADER_STDBOOL 97AC_CHECK_HEADERS([fcntl.h]) 98AC_CHECK_HEADERS([libintl.h]) 99AC_CHECK_HEADERS([sys/timeb.h]) 100AC_CHECK_HEADERS(stdint.h) 101AC_CHECK_HEADERS([tilp2/ticables.h tilp2/ticalcs.h tilp2/tifiles.h]) 102dnl AC_CHECK_HEADERS([Carbon/Carbon.h]) 103 104dnl # Add Carbon framework if detected 105dnl if test x"$ac_cv_header_Carbon_Carbon_h" = xyes ; then 106dnl LDFLAGS="$LDFLAGS -framework Carbon" 107dnl #fi 108 109# Checks for typedefs, structures, and compiler characteristics. 110AC_FUNC_MEMCMP 111#AC_C_RESTRICT 112AC_C_VOLATILE 113 114# Checks for libraries. 115AC_CHECK_LIB(m, pow) 116AC_CHECK_LIB(pthread, pthread_create) dnl needed by GThread 117#AC_CHECK_LIB(comdlg32, GetOpenFileName) 118 119# Check for zlib 120AC_CHECK_HEADER(zlib.h) 121AC_CHECK_LIB(z, compress) 122LIBZ="$LIBS" 123LIBS="" 124AC_SUBST(LIBZ) 125 126# Checks for library functions. 127AC_FUNC_SELECT_ARGTYPES 128AC_FUNC_STAT 129AC_FUNC_VPRINTF 130AC_CHECK_FUNCS([bzero memset mkdir select strchr strrchr strstr]) 131 132# Platform specific tests. 133CFLAGS_FOR_BUILD="$CFLAGS" 134export CFLAGS_FOR_BUILD 135dnl AC_CANONICAL_HOST 136case $host in 137 *-*-mingw*) ARCH="-D__WIN32__ -D__MINGW32__ -mwindows -D_WINDOWS" ;; 138 *-*-*bsd*) ARCH="-D__BSD__" ;; 139 i[[3456]]86-*-linux-*) ARCH="-D__I386__ -D__LINUX__" ;; 140 i[[3456]]86-apple-darwin*) ARCH="-D__I386__ -D__MACOSX__" ;; 141 arm*-*-linux-*) ARCH="-D__IPAQ__ -D__LINUX__" ;; 142 powerpc-*-linux-*) ARCH="-D__PPC__ -D__LINUX__" ;; 143 powerpc-apple-darwin*) ARCH="-D__PPC__ -D__MACOSX__" ;; 144 *-apple-darwin*) ARCH="-D__MACOSX__" ;; 145 *) ARCH="-D__LINUX__" ;; 146esac 147CFLAGS="$CFLAGS $ARCH" 148 149# Check for SDL if sound support is wanted 150AC_ARG_ENABLE(sound, 151 AC_HELP_STRING([--disable-sound], [disable sound emulation]), 152 [tiemu_use_sound=$enableval], [tiemu_use_sound=yes]) 153AC_CACHE_CHECK([whether to enable sound emulation], 154 [tiemu_use_sound], [tiemu_use_sound=yes]) 155if test "x$tiemu_use_sound" = "xyes"; then 156 SDL_VERSION=1.2.0 157 AM_PATH_SDL($SDL_VERSION, 158 :, 159 AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) 160 ) 161else 162 CFLAGS="$CFLAGS -DNO_SOUND" 163 SDL_CFLAGS= 164 SDL_LIBS= 165fi 166AC_SUBST(SDL_CFLAGS) 167AC_SUBST(SDL_LIBS) 168 169# KDE dialogs support 170AC_ARG_WITH(kde, AC_HELP_STRING([--without-kde], [Compile without KDE support]), [kde=$withval], [kde=default]) 171if test "x$kde" = "xdefault"; then 172 case $host_os in 173 *mingw*) 174 kde=no 175 ;; 176 *) 177 kde=yes 178 ;; 179 esac 180fi 181if test "x$kde" = "xyes"; then 182 AC_PROG_CXX 183 AC_PATH_KDE 184 AC_DEFINE(WITH_KDE, 1, [Use KDE support]) 185fi 186AC_SUBST(kde) 187 188# Ensure MSVC-compatible struct packing convention is used when 189# compiling for Win32 with gcc. 190# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while 191# gcc2 uses "-fnative-struct". 192case $host_os in 193*mingw*|*cygwin*) 194 if test x$GCC = xyes; then 195 msnative_struct='' 196 AC_MSG_CHECKING([how to get MSVC-compatible struct packing]) 197 if test -z "$ac_cv_prog_CC"; then 198 our_gcc="$CC" 199 else 200 our_gcc="$ac_cv_prog_CC" 201 fi 202 case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in 203 2.) 204 if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then 205 msnative_struct='-fnative-struct' 206 fi 207 ;; 208 *) 209 if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then 210 msnative_struct='-mms-bitfields' 211 fi 212 ;; 213 esac 214 if test x"$msnative_struct" = x ; then 215 AC_MSG_RESULT([no way]) 216 AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code]) 217 else 218 CFLAGS="$CFLAGS $msnative_struct" 219 AC_MSG_RESULT([${msnative_struct}]) 220 fi 221 fi 222 ;; 223esac 224 225# Check for the new -fvisibility=hidden flag introduced in gcc 4.0 226# Allow to reduce shared library size and avoid symbol clash 227# Unfortunately, this only works for fully static builds. If any parts of GDB are built shared (--enable-shared or --enable-shared-*), we currently have no way to disable it just for these parts. -- Kevin 228case $host_os in 229*mingw*) 230 ;; 231*) 232 case "$ac_configure_args" in 233 *--enable-shared*) 234 ;; 235 *) 236 if test x$GCC = xyes; then 237 visibility_flag='' 238 AC_MSG_CHECKING([whether gcc accepts -fvisibility]) 239 if test -z "$ac_cv_prog_CC"; then 240 our_gcc="$CC" 241 else 242 our_gcc="$ac_cv_prog_CC" 243 fi 244 if $our_gcc -v --help 2>/dev/null | grep "fvisibility" >/dev/null; then 245 visibility_flag='-fvisibility=hidden' 246 fi 247 if test x"$visibility_flag" = x ; then 248 AC_MSG_RESULT([no]) 249 else 250 CFLAGS="$CFLAGS $visibility_flag" 251 AC_MSG_RESULT([${visibility_flag}]) 252 AC_DEFINE(HAVE_FVISIBILITY, 1, [Use -fvisibility=hidden flag]) 253 fi 254 fi 255 ;; 256 esac 257 ;; 258esac 259 260case "$host" in 261 *-*-linux*) EXFL="-Wl,--export-dynamic" ;; 262 *) EXFL="" ;; 263esac 264LDFLAGS="$LDFLAGS $EXFL" 265 266# On Darwin, libglade chokes on stripped executables. 267case "$host" in 268 *-apple-darwin*) 269 case "$CFLAGS $CXXFLAGS $LDFLAGS" in 270 *" -s "*|"-s "*|*" -s"|"-s") 271 echo "warning: cannot strip libglade executables on this host" 272 CFLAGS=`echo "$CFLAGS"|sed 's/\( -s\)* / /g;s/^-s //g;s/ -s$//g;s/^-s$//g'` 273 CXXFLAGS=`echo "$CXXFLAGS"|sed 's/\( -s\)* / /g;s/^-s //g;s/ -s$//g;s/^-s$//g'` 274 LDFLAGS=`echo "$LDFLAGS"|sed 's/\( -s\)* / /g;s/^-s //g;s/ -s$//g;s/^-s$//g'` 275 ;; 276 esac 277 ;; 278esac 279 280# some extra flags 281CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED -DDEBUGGER" 282CXXFLAGS="$CFLAGS -fno-rtti -fno-exceptions" 283 284AC_SUBST(CFLAGS) 285AC_SUBST(LDFLAGS) 286AC_SUBST(CXXFLAGS) 287 288# Debugger support (can be disabled for embedded architectures) 289AC_ARG_ENABLE(debugger, 290 AC_HELP_STRING([--disable-debugger], [disable the built-in debugger]), 291 [tiemu_use_debugger=$enableval], [tiemu_use_debugger=yes]) 292AC_CACHE_CHECK([whether to use the debugger], 293 [tiemu_use_debugger], [tiemu_use_debugger=yes]) 294if test x$tiemu_use_debugger = xno; then 295 AC_DEFINE(NO_DEBUGGER, 1, [Defined to disable the debugger]) 296fi 297 298# GDB support (can be disabled) 299AC_ARG_ENABLE(gdb, 300 AC_HELP_STRING([--disable-gdb], [disable the GDB-based source-level debugger]), 301 [tiemu_use_gdb=$enableval], [tiemu_use_gdb=$tiemu_use_debugger]) 302AC_CACHE_CHECK([whether to use the GDB-based source-level debugger], 303 [tiemu_use_gdb], [tiemu_use_gdb=$tiemu_use_debugger]) 304if test x$tiemu_use_gdb = xno; then 305 CFLAGS="$CFLAGS -DNO_GDB" 306fi 307AM_CONDITIONAL(NO_GDB, test x$tiemu_use_gdb = xno) 308 309# It makes no sense to enable GDB without the debugger! 310if test x$tiemu_use_debugger = xno -a x$tiemu_use_gdb = xyes; then 311 AC_MSG_ERROR([cannot enable GDB without the debugger]) 312fi 313 314# Run GDB configury (if enabled) 315if test x$tiemu_use_gdb = xyes; then 316 ac_configure_args="$ac_configure_args --target=m68k-coff --disable-tui --disable-werror" 317 changequote(<<,>>) 318 ac_configure_args=`echo "$ac_configure_args" | sed "s,'CC=[^']*',,g;s,'CFLAGS=[^']*',,g;s,'CXX=[^']*',,g;s,'CXXFLAGS=[^']*',,g;s,'LDFLAGS=[^']*',,g;s,'LIBS=[^']*',,g;s,'build_alias=[^']*',,g;s,'host_alias=[^']*',,g;s,'target_alias=[^']*',,g"` 319 changequote([,]) 320 AC_CONFIG_SUBDIRS(src/gdb) 321fi 322 323# Output. 324AC_OUTPUT 325 326echo 327echo "To run the TiEmu emulator, you will need an image (ROM dump or FLASH upgrade)." 328echo "As those files are copyrighted by Texas Instruments, they will never be" 329echo "distributed with the emulator... In replacement, you can use PedRom which" 330echo "is provided with TiEmu." 331echo 332echo "It you need a ROM dump, you can get one from your calculator" 333echo "with the 'ROM dump' function of TiLP." 334echo "Otherwise, you can use a TI's FLASH OS upgrade (AMS) as image." 335echo "Note: TiLP is available at [http://lpg.ticalc.org/prj_tilp]." 336echo 337echo "Now, you can type 'make' and 'make install'" 338echo ; 339 340