rlm@9: AC_PREREQ([2.68])
rlm@9: 
rlm@6: AC_INIT([vba-rlm], [1.0])
rlm@6: 
rlm@19: AC_CONFIG_AUX_DIR([build-aux])
rlm@19: 
rlm@19: AM_INIT_AUTOMAKE([foreign dist-bzip2])
rlm@19: 
rlm@9: dnl TODO: change this to gba.cpp or something
rlm@12: AC_CONFIG_SRCDIR([src/lua/lopcodes.c])
rlm@9: AC_CONFIG_HEADERS([config.h])
rlm@18: 
rlm@18: # Checks for programs.
rlm@18: AC_PROG_CXX
rlm@18: AC_PROG_CC
rlm@21: AC_PROG_AWK
rlm@21: AC_PROG_INSTALL
rlm@9: AC_PROG_RANLIB
rlm@21: AC_PROG_CPP
rlm@21: AC_PROG_MKDIR_P
rlm@27: AC_PATH_PROG(NASM, nasm)
rlm@45: AC_PROG_LIBTOOL
rlm@19: 
rlm@46: 
rlm@21: # Checks for libraries.
rlm@30: AC_CHECK_LIB(z, gzopen,
rlm@30:   , AC_MSG_ERROR([*** Cannot compile without zlib.]))
rlm@30: AC_CHECK_LIB(png, png_create_write_struct,
rlm@30:   , AC_MSG_ERROR([*** Cannot compile without libpng.]), [-lz])
rlm@30: 
rlm@30: SDL_VERSION=1.2.2
rlm@30: AM_PATH_SDL($SDL_VERSION, :,
rlm@30:             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
rlm@21: AC_CHECK_LIB([SDL], [SDL_Init])
rlm@30: 
rlm@21: AC_CHECK_LIB([pthread], [pthread_create])
rlm@19: 
rlm@19: 
rlm@19: 
rlm@9: # Checks for header files.
rlm@28: AC_FUNC_ALLOCA
rlm@28: AC_CHECK_HEADERS([arpa/inet.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/socket.h unistd.h libintl.h])
rlm@9: 
rlm@9: # Checks for typedefs, structures, and compiler characteristics.
rlm@18: AC_HEADER_STDBOOL
rlm@18: AC_C_INLINE
rlm@21: AC_TYPE_INT16_T
rlm@21: AC_TYPE_INT32_T
rlm@21: AC_TYPE_INT64_T
rlm@21: AC_TYPE_INT8_T
rlm@9: AC_TYPE_SIZE_T
rlm@21: AC_TYPE_UINT16_T
rlm@21: AC_TYPE_UINT32_T
rlm@21: AC_TYPE_UINT64_T
rlm@21: AC_TYPE_UINT8_T
rlm@9: AC_CHECK_TYPES([ptrdiff_t])
rlm@9: 
rlm@9: # Checks for library functions.
rlm@9: AC_FUNC_ERROR_AT_LINE
rlm@21: AC_FUNC_FORK
rlm@21: AC_FUNC_MALLOC
rlm@9: AC_FUNC_MKTIME
rlm@9: AC_FUNC_REALLOC
rlm@9: AC_FUNC_STRCOLL
rlm@21: AC_CHECK_FUNCS([floor ftruncate gethostbyname gethostname inet_ntoa localeconv memchr memset modf pow setlocale socket sqrt strcasecmp strchr strcspn strdup strerror strpbrk strrchr strstr strtoul])
rlm@21: 
rlm@46: 
rlm@46: 
rlm@46: # find JNI headers
rlm@46: AC_ARG_VAR([JAVA_INCLUDE_PATH], [The path to the jni.h])
rlm@46: AC_ARG_VAR([JAVA_INCLUDE_PATH2], [The path to jni_md.h])
rlm@46: 
rlm@46: 
rlm@46: if test "x$JAVA_INCLUDE_PATH" = "x"; then
rlm@46:    echo "----------------------------------"	
rlm@46:    echo "you must have JAVA_INCLUDE_PATH defined."
rlm@46:    echo "this is the path to jni.h"
rlm@46:    echo "----------------------------------"
rlm@46: fi
rlm@46: 
rlm@46: if test "x$JAVA_INCLUDE_PATH2" = "x"; then
rlm@46:    echo "----------------------------------"	
rlm@46:    echo "you must have JAVA_INCLUDE_PATH2 defined."
rlm@46:    echo "this is the path to jni_md.h"
rlm@46:    echo "----------------------------------"
rlm@46: fi
rlm@46: 
rlm@46: if test "x$JAVA_INCLUDE_PATH" = "x"; then
rlm@46:    AC_MSG_ERROR([JAVA_INCLUDE_PATH not defined])
rlm@46: fi
rlm@46: 
rlm@46: if test "x$JAVA_INCLUDE_PATH2" = "x"; then
rlm@46:    AC_MSG_ERROR([JAVA_INCLUDE_PATH2 not defined])	
rlm@46: fi
rlm@46: 
rlm@46: #AC_SUBST(JAVA_INCLUDE_PATH)
rlm@46: #AC_SUBST(JAVA_INCLUDE_PATH2)
rlm@46: 
rlm@8: AC_CONFIG_FILES([Makefile 
rlm@8: 	         src/Makefile
rlm@18:                  src/lua/Makefile
rlm@46: 		 src/clojure/Makefile
rlm@19: 		 src/gb/Makefile
rlm@19: 		 src/gba/Makefile
rlm@26: 		 src/common/Makefile
rlm@27: 		 src/SFMT/Makefile
rlm@28: 		 src/filters/Makefile
rlm@30: 		 src/prof/Makefile
rlm@28: 		 src/sdl/Makefile])
rlm@8: 
rlm@19: 
rlm@6: 
rlm@30: ### RLM: investigate this further
rlm@30: CXXFLAGS="$CXXFLAGS -DC_CORE"	
rlm@30: 
rlm@30: 
rlm@6: AC_OUTPUT
rlm@6: