# HG changeset patch # User Robert McIntyre # Date 1330921921 21600 # Node ID 48369c6aeaa0638248c94691ee5ee76e786f2e2d # Parent 2fa26addb9012f7e058db1d089fe58325ee71216 brought prof package in diff -r 2fa26addb901 -r 48369c6aeaa0 configure.ac --- a/configure.ac Sun Mar 04 21:09:22 2012 -0600 +++ b/configure.ac Sun Mar 04 22:32:01 2012 -0600 @@ -21,7 +21,16 @@ AC_PATH_PROG(NASM, nasm) # Checks for libraries. +AC_CHECK_LIB(z, gzopen, + , AC_MSG_ERROR([*** Cannot compile without zlib.])) +AC_CHECK_LIB(png, png_create_write_struct, + , AC_MSG_ERROR([*** Cannot compile without libpng.]), [-lz]) + +SDL_VERSION=1.2.2 +AM_PATH_SDL($SDL_VERSION, :, + AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])) AC_CHECK_LIB([SDL], [SDL_Init]) + AC_CHECK_LIB([pthread], [pthread_create]) @@ -61,9 +70,14 @@ src/common/Makefile src/SFMT/Makefile src/filters/Makefile + src/prof/Makefile src/sdl/Makefile]) +### RLM: investigate this further +CXXFLAGS="$CXXFLAGS -DC_CORE" + + AC_OUTPUT diff -r 2fa26addb901 -r 48369c6aeaa0 src/Makefile.am --- a/src/Makefile.am Sun Mar 04 21:09:22 2012 -0600 +++ b/src/Makefile.am Sun Mar 04 22:32:01 2012 -0600 @@ -1,3 +1,3 @@ -SUBDIRS = SFMT lua gb gba common filters sdl +SUBDIRS = SFMT lua gb gba common filters prof sdl -noinst_HEADERS = Port.h NLS.h AutoBuild.h +noinst_HEADERS = Port.h NLS.h AutoBuild.h version.h diff -r 2fa26addb901 -r 48369c6aeaa0 src/Port.h --- a/src/Port.h Sun Mar 04 21:09:22 2012 -0600 +++ b/src/Port.h Sun Mar 04 22:32:01 2012 -0600 @@ -13,9 +13,22 @@ typedef unsigned char bool8; -#ifdef HAVE_STDINT_H +//#ifdef HAVE_STDINT_H #include +// RLM combatibility junk + +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; + +typedef int8_t s8; +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; + + typedef int8_t int8; typedef uint8_t uint8; typedef int16_t int16; @@ -26,55 +39,6 @@ typedef uint64_t uint64; typedef intptr_t pint; -#else /* Don't have stdint.h */ - -#ifdef PTR_NOT_INT -typedef long pint; -#else /* pointer is int */ -typedef int pint; -#endif /* PTR_NOT_INT */ - -/* FIXME: Refactor this by moving out the BORLAND part and unifying typedefs */ -#ifndef WIN32 -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef signed char int8; -typedef short int16; -typedef int int32; -typedef unsigned int uint32; -# ifdef __GNUC__ /* long long is not part of ISO C++ */ -__extension__ typedef long long int64; -__extension__ typedef unsigned long long uint64; -# else -typedef long long int64; -typedef unsigned long long uint64; -# endif -#else /* WIN32 */ - -# ifdef __BORLANDC__ -# include -# else - -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef signed char int8; -typedef short int16; - -# ifndef WSAAPI -/* winsock2.h typedefs int32 as well. */ -typedef long int32; -# endif - -typedef unsigned int uint32; - -# endif /* __BORLANDC__ */ - -typedef __int64 int64; -typedef unsigned __int64 uint64; - -#endif /* WIN32 */ -#endif /* HAVE_STDINT_H */ - #ifndef WIN32 #ifndef PATH_MAX @@ -98,14 +62,6 @@ #define strncasecmp strnicmp #endif -typedef uint8 u8; -typedef uint16 u16; -typedef uint32 u32; -typedef uint64 u64; -typedef int8 s8; -typedef int16 s16; -typedef int32 s32; -typedef int64 s64; // for consistency static inline u8 swap8(u8 v) diff -r 2fa26addb901 -r 48369c6aeaa0 src/prof/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/prof/Makefile Sun Mar 04 22:32:01 2012 -0600 @@ -0,0 +1,450 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# src/prof/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + +pkgdatadir = $(datadir)/VisualBoyAdvance +pkglibdir = $(libdir)/VisualBoyAdvance +pkgincludedir = $(includedir)/VisualBoyAdvance +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +target_triplet = x86_64-unknown-linux-gnu +subdir = src/prof +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +OBJDIR = $(top_srcdir)/src/obj +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libprof_a_AR = $(AR) $(ARFLAGS) +libprof_a_LIBADD = +am_libprof_a_OBJECTS = prof.$(OBJEXT) +libprof_a_OBJECTS = $(patsubst %,$(OBJDIR)/%,$(am_libprof_a_OBJECTS)) +DEFAULT_INCLUDES = -I. +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libprof_a_SOURCES) +DIST_SOURCES = $(libprof_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/r/proj/vba/trunk/missing --run aclocal-1.10 +AMTAR = ${SHELL} /home/r/proj/vba/trunk/missing --run tar +AUTOCONF = ${SHELL} /home/r/proj/vba/trunk/missing --run autoconf +AUTOHEADER = ${SHELL} /home/r/proj/vba/trunk/missing --run autoheader +AUTOMAKE = ${SHELL} /home/r/proj/vba/trunk/missing --run automake-1.10 +AWK = gawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 -DC_CORE -DDEV_VERSION +CYGPATH_W = echo +DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"VisualBoyAdvance\" -DVERSION=\"1.7.2\" -DYYTEXT_POINTER=1 -DHAVE_LIBZ=1 -DHAVE_LIBPNG=1 -DHAVE_LIBPTHREAD=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_NETINET_IN_H=1 +DEPDIR = .deps +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +GETTEXT_PACKAGE = +GMSGFMT = +GREP = /bin/grep +GTKMM_CFLAGS = +GTKMM_CPPFLAGS = +GTKMM_LIBS = +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +INTLLIBS = +LDFLAGS = +LEX = flex +LEXLIB = -lfl +LEX_OUTPUT_ROOT = lex.yy +LIBICONV = +LIBINTL = +LIBOBJS = +LIBS = -lpthread -lpng -lz +LTLIBICONV = +LTLIBINTL = +LTLIBOBJS = +MAKEINFO = ${SHELL} /home/r/proj/vba/trunk/missing --run makeinfo +MKDIR_P = /bin/mkdir -p +MKINSTALLDIRS = +MSGFMT = +MSGMERGE = +NASM = /usr/bin/nasm +OBJEXT = o +PACKAGE = VisualBoyAdvance +PACKAGE_BUGREPORT = +PACKAGE_NAME = +PACKAGE_STRING = +PACKAGE_TARNAME = +PACKAGE_VERSION = +PATH_SEPARATOR = : +PKG_CONFIG = +POSUB = +RANLIB = ranlib +SDL_CFLAGS = -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT +SDL_CONFIG = /usr/bin/sdl-config +SDL_LIBS = -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread +SET_MAKE = +SHELL = /bin/sh +STRIP = +USE_NLS = +VBA_EXTRA = +VBA_LIBS = ../gba/libgba.a ../gb/libgb.a ../common/libgbcom.a ../filters/libfilter.a ../lua/libgblua.a +VBA_SRC_EXTRA = lua sdl +VERSION = 1.7.2 +XGETTEXT = +XMKMF = +YACC = bison -y +YFLAGS = +abs_builddir = /home/r/proj/vba/trunk/src/prof +abs_srcdir = /home/r/proj/vba/trunk/src/prof +abs_top_builddir = /home/r/proj/vba/trunk +abs_top_srcdir = /home/r/proj/vba/trunk +ac_ct_CC = gcc +ac_ct_CXX = g++ +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = $(SHELL) /home/r/proj/vba/trunk/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = /bin/mkdir -p +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target = x86_64-unknown-linux-gnu +target_alias = +target_cpu = x86_64 +target_os = linux-gnu +target_vendor = unknown +top_builddir = ../.. +top_srcdir = ../.. +noinst_LIBRARIES = libprof.a +libprof_a_SOURCES = \ + gmon.h \ + gmon_out.h \ + prof.cpp \ + prof.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/prof/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/prof/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libprof.a: $(libprof_a_OBJECTS) $(libprof_a_DEPENDENCIES) + -rm -f libprof.a + $(libprof_a_AR) libprof.a $(libprof_a_OBJECTS) $(libprof_a_LIBADD) + $(RANLIB) libprof.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/prof.Po + +$(OBJDIR)/%.o: %.cpp + $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: + $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(libprof_a_OBJECTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -r 2fa26addb901 -r 48369c6aeaa0 src/prof/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/prof/Makefile.am Sun Mar 04 22:32:01 2012 -0600 @@ -0,0 +1,7 @@ +noinst_LIBRARIES = libprof.a + +libprof_a_SOURCES = \ + gmon.h \ + gmon_out.h \ + prof.cpp \ + prof.h diff -r 2fa26addb901 -r 48369c6aeaa0 src/prof/gmon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/prof/gmon.h Sun Mar 04 22:32:01 2012 -0600 @@ -0,0 +1,151 @@ +/* + * Copyright (c) 1983, 1991, 1993, 2001 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef gmon_h +#define gmon_h + +#include +typedef uint32_t u32; + +/* Size of the 4.4BSD gmon header */ +#define GMON_HDRSIZE_BSD44_32 (4 + 4 + 4 + 4 + 4 + (3 * 4)) +#define GMON_HDRSIZE_BSD44_64 (8 + 8 + 4 + 4 + 4 + (3 * 4)) + +#if 0 /* For documentation purposes only. */ + struct raw_phdr + { + char low_pc[sizeof(void *)]; /* base pc address of sample buffer */ + char high_pc[sizeof(void *)];/* max pc address of sampled buffer */ + char ncnt[4]; /* size of sample buffer (plus this + header) */ + + char version[4]; /* version number */ + char profrate[4]; /* profiling clock rate */ + char spare[3*4]; /* reserved */ + }; +#endif + +#define GMONVERSION 0x00051879 + +/* Size of the old BSD gmon header */ +#define GMON_HDRSIZE_OLDBSD_32 (4 + 4 + 4) + +/* FIXME: Checking host compiler defines here means that we can't + use a cross gprof alpha OSF. */ +#if defined(__alpha__) && defined (__osf__) +#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4 + 4) +#else +#define GMON_HDRSIZE_OLDBSD_64 (8 + 8 + 4) +#endif + +#if 0 /* For documentation purposes only. */ + struct old_raw_phdr + { + char low_pc[sizeof(void *)]; /* base pc address of sample buffer */ + char high_pc[sizeof(void *)];/* max pc address of sampled buffer */ + char ncnt[4]; /* size of sample buffer (plus this + header) */ +#if defined (__alpha__) && defined (__osf__) + /* + * DEC's OSF v3.0 uses 4 bytes of padding to bring the header to + * a size that is a multiple of 8. + */ + char pad[4]; +#endif + }; +#endif + +/* + * Histogram counters are unsigned shorts: + */ +#define HISTCOUNTER unsigned short + +/* + * Fraction of text space to allocate for histogram counters here, 1/2: + */ +#define HISTFRACTION 2 + +/* + * Fraction of text space to allocate for from hash buckets. The + * value of HASHFRACTION is based on the minimum number of bytes of + * separation between two subroutine call points in the object code. + * Given MIN_SUBR_SEPARATION bytes of separation the value of + * HASHFRACTION is calculated as: + * + * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1); + * + * For the VAX, the shortest two call sequence is: + * + * calls $0,(r0) + * calls $0,(r0) + * + * which is separated by only three bytes, thus HASHFRACTION is + * calculated as: + * + * HASHFRACTION = 3 / (2 * 2 - 1) = 1 + * + * Note that the division above rounds down, thus if MIN_SUBR_FRACTION + * is less than three, this algorithm will not work! + */ +#define HASHFRACTION 1 + +/* + * Percent of text space to allocate for tostructs with a minimum: + */ +#define ARCDENSITY 2 +#define MINARCS 50 + +struct tostruct + { + u32 selfpc; + int count; + unsigned short link; + }; + +/* + * A raw arc, with pointers to the calling site and the called site + * and a count. Everything is defined in terms of characters so + * as to get a packed representation (otherwise, different compilers + * might introduce different padding): + */ +#if 0 /* For documentation purposes only. */ + struct raw_arc + { + char from_pc[sizeof(void *)]; + char self_pc[sizeof(void *)]; + char count[sizeof(long)]; + }; +#endif + +/* + * General rounding functions: + */ +#define ROUNDDOWN(x,y) (((x)/(y))*(y)) +#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) + +#endif /* gmon_h */ diff -r 2fa26addb901 -r 48369c6aeaa0 src/prof/gmon_out.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/prof/gmon_out.h Sun Mar 04 22:32:01 2012 -0600 @@ -0,0 +1,45 @@ +/* gmon_out.h + + Copyright 2000, 2001 Free Software Foundation, Inc. + +This file is part of GNU Binutils. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* A gmon.out file consists of a header (defined by gmon_hdr) followed + by a sequence of records. Each record starts with a one-byte tag + identifying the type of records, followed by records specific data. */ +#ifndef gmon_out_h +#define gmon_out_h + +#define GMON_MAGIC "gmon" /* magic cookie */ +#define GMON_VERSION 1 /* version number */ + +/* Raw header as it appears on file (without padding). */ +struct gmon_hdr + { + char cookie[4]; + char version[4]; + char spare[3 * 4]; + }; + +/* Types of records in this file. */ +typedef enum + { + GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2 + } +GMON_Record_Tag; + +#endif /* gmon_out_h */ diff -r 2fa26addb901 -r 48369c6aeaa0 src/prof/prof.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/prof/prof.cpp Sun Mar 04 22:32:01 2012 -0600 @@ -0,0 +1,405 @@ +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// adapted from gmon.c +/*- + * Copyright (c) 1991, 1998 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. [rescinded 22 July 1999] + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +#include "gmon.h" +#include "gmon_out.h" + +#include "../common/System.h" +#include "../gba/GBA.h" +#include "../gba/GBAGlobals.h" +#include "../NLS.h" + +/* + * froms is actually a bunch of unsigned shorts indexing tos + */ +static int profiling = 3; +static unsigned short *froms; +static struct tostruct *tos = 0; +static long tolimit = 0; +static u32 s_lowpc = 0; +static u32 s_highpc = 0; +static unsigned long s_textsize = 0; + +static int ssiz; +static char *sbuf; +static int s_scale; + +static int hz = 0; +static int hist_num_bins = 0; +static char hist_dimension[16] = "seconds"; +static char hist_dimension_abbrev = 's'; + +/* see profil(2) where this is describe (incorrectly) */ +#define SCALE_1_TO_1 0x10000L + +void profPut32(char *b, u32 v) +{ + b[0] = v & 255; + b[1] = (v >> 8) & 255; + b[2] = (v >> 16) & 255; + b[3] = (v >> 24) & 255; +} + +void profPut16(char *b, u16 v) +{ + b[0] = v & 255; + b[1] = (v >> 8) & 255; +} + +int profWrite8(FILE *f, u8 b) +{ + if(fwrite(&b, 1, 1, f) != 1) + return 1; + return 0; +} + +int profWrite32(FILE *f, u32 v) +{ + char buf[4]; + + profPut32(buf, v); + if(fwrite(buf, 1, 4, f) != 4) + return 1; + return 0; +} + +int profWrite(FILE *f, char *buf, unsigned int n) +{ + if(fwrite(buf, 1, n, f) != n) + return 1; + return 0; +} + +/* Control profiling; + profiling is what mcount checks to see if + all the data structures are ready. */ + +void profControl(int mode) +{ + if (mode) { + /* start */ +#ifdef PROFILING + cpuProfil(sbuf, ssiz, (u32)s_lowpc, s_scale); +#endif + profiling = 0; + } else { + /* stop */ +#ifdef PROFILING + cpuProfil(NULL, 0, 0, 0); +#endif + profiling = 3; + } +} + + +#define MSG N_("No space for profiling buffer(s)\n") + +void profStartup(u32 lowpc, u32 highpc) +{ + int monsize; + char *buffer; + int o; + + /* + * round lowpc and highpc to multiples of the density we're using + * so the rest of the scaling (here and in gprof) stays in ints. + */ + lowpc = ROUNDDOWN(lowpc, HISTFRACTION*sizeof(HISTCOUNTER)); + s_lowpc = lowpc; + highpc = ROUNDUP(highpc, HISTFRACTION*sizeof(HISTCOUNTER)); + s_highpc = highpc; + s_textsize = highpc - lowpc; + monsize = (s_textsize / HISTFRACTION); + buffer = (char *)calloc(1, 2*monsize ); + if ( buffer == NULL ) { + systemMessage(0, MSG); + return; + } + froms = (unsigned short *) calloc(1, 4*s_textsize / HASHFRACTION ); + if ( froms == NULL ) { + systemMessage(0, MSG); + free(buffer); + buffer = NULL; + return; + } + tolimit = s_textsize * ARCDENSITY / 100; + if ( tolimit < MINARCS ) { + tolimit = MINARCS; + } else if ( tolimit > 65534 ) { + tolimit = 65534; + } + tos = (struct tostruct *) calloc(1, tolimit * sizeof( struct tostruct ) ); + if ( tos == NULL ) { + systemMessage(0, MSG); + + free(buffer); + buffer = NULL; + + free(froms); + froms = NULL; + + return; + } + tos[0].link = 0; + sbuf = buffer; + ssiz = monsize; + if ( monsize <= 0 ) + return; + o = highpc - lowpc; + if( monsize < o ) + s_scale = (int)(( (float) monsize / o ) * SCALE_1_TO_1); + else + s_scale = SCALE_1_TO_1; + profControl(1); +} + +void profCleanup() +{ + FILE *fd; + int fromindex; + int endfrom; + u32 frompc; + int toindex; + struct gmon_hdr ghdr; + + profControl(0); + fd = fopen( "gmon.out" , "wb" ); + if ( fd == NULL ) { + systemMessage( 0, "mcount: gmon.out" ); + return; + } + + memcpy(&ghdr.cookie[0], GMON_MAGIC, 4); + profPut32((char *)ghdr.version, GMON_VERSION); + + if(fwrite(&ghdr, sizeof(ghdr), 1, fd) != 1) { + systemMessage(0, "mcount: gmon.out header"); + fclose(fd); + return; + } + + if(hz == 0) + hz = 100; + + hist_num_bins = ssiz; + + if(profWrite8(fd, GMON_TAG_TIME_HIST) || + profWrite32(fd, (u32)s_lowpc) || + profWrite32(fd, (u32)s_highpc) || + profWrite32(fd, hist_num_bins) || + profWrite32(fd, hz) || + profWrite(fd, hist_dimension, 15) || + profWrite(fd, &hist_dimension_abbrev, 1)) { + systemMessage(0, "mcount: gmon.out hist"); + fclose(fd); + return; + } + u16 *hist_sample = (u16 *)sbuf; + + u16 count; + int i; + + for(i = 0; i < hist_num_bins; ++i) { + profPut16((char *)&count, hist_sample[i]); + + if(fwrite(&count, sizeof(count), 1, fd) != 1) { + systemMessage(0, "mcount: gmon.out sample"); + fclose(fd); + return; + } + } + + endfrom = s_textsize / (HASHFRACTION * sizeof(*froms)); + for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) { + if ( froms[fromindex] == 0 ) { + continue; + } + frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms)); + for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) { + if(profWrite8(fd, GMON_TAG_CG_ARC) || + profWrite32(fd, (u32)frompc) || + profWrite32(fd, (u32)tos[toindex].selfpc) || + profWrite32(fd, tos[toindex].count)) { + systemMessage(0, "mcount: arc"); + fclose(fd); + return; + } + } + } + fclose(fd); +} + +void profCount() +{ + register u32 selfpc; + register unsigned short *frompcindex; + register struct tostruct *top; + register struct tostruct *prevtop; + register long toindex; + + /* + * find the return address for mcount, + * and the return address for mcount's caller. + */ + + /* selfpc = pc pushed by mcount call. + This identifies the function that was just entered. */ + selfpc = (u32) reg[14].I; + /* frompcindex = pc in preceding frame. + This identifies the caller of the function just entered. */ + frompcindex = (unsigned short *) reg[12].I; + /* + * check that we are profiling + * and that we aren't recursively invoked. + */ + if (profiling) { + goto out; + } + profiling++; + /* + * check that frompcindex is a reasonable pc value. + * for example: signal catchers get called from the stack, + * not from text space. too bad. + */ + frompcindex = (unsigned short *) ((long) frompcindex - (long) s_lowpc); + if ((unsigned long) frompcindex > s_textsize) { + goto done; + } + frompcindex = + &froms[((long) frompcindex) / (HASHFRACTION * sizeof(*froms))]; + toindex = *frompcindex; + if (toindex == 0) { + /* + * first time traversing this arc + */ + toindex = ++tos[0].link; + if (toindex >= tolimit) { + goto overflow; + } + *frompcindex = (unsigned short)toindex; + top = &tos[toindex]; + top->selfpc = selfpc; + top->count = 1; + top->link = 0; + goto done; + } + top = &tos[toindex]; + if (top->selfpc == selfpc) { + /* + * arc at front of chain; usual case. + */ + top->count++; + goto done; + } + /* + * have to go looking down chain for it. + * top points to what we are looking at, + * prevtop points to previous top. + * we know it is not at the head of the chain. + */ + for (; /* goto done */; ) { + if (top->link == 0) { + /* + * top is end of the chain and none of the chain + * had top->selfpc == selfpc. + * so we allocate a new tostruct + * and link it to the head of the chain. + */ + toindex = ++tos[0].link; + if (toindex >= tolimit) { + goto overflow; + } + top = &tos[toindex]; + top->selfpc = selfpc; + top->count = 1; + top->link = *frompcindex; + *frompcindex = (unsigned short)toindex; + goto done; + } + /* + * otherwise, check the next arc on the chain. + */ + prevtop = top; + top = &tos[top->link]; + if (top->selfpc == selfpc) { + /* + * there it is. + * increment its count + * move it to the head of the chain. + */ + top->count++; + toindex = prevtop->link; + prevtop->link = top->link; + top->link = *frompcindex; + *frompcindex = (unsigned short)toindex; + goto done; + } + + } + done: + profiling--; + /* and fall through */ + out: + return; /* normal return restores saved registers */ + + overflow: + profiling++; /* halt further profiling */ +#define TOLIMIT "mcount: tos overflow\n" + systemMessage(0, TOLIMIT); + goto out; +} + +void profSetHertz(int h) +{ + hz = h; +} diff -r 2fa26addb901 -r 48369c6aeaa0 src/prof/prof.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/prof/prof.h Sun Mar 04 22:32:01 2012 -0600 @@ -0,0 +1,34 @@ +// -*- C++ -*- +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 1999-2003 Forgotten +// Copyright (C) 2004 Forgotten and the VBA development team + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or(at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef VBA_PROF_PROF_H +#define VBA_PROF_PROF_H + +/* Control profiling; + profiling is what mcount checks to see if + all the data structures are ready. */ + +extern void profControl(int mode); +extern void profStartup(u32 lowpc, u32 highpc); +extern void profCleanup(); +extern void profCount(); + +extern void profSetHertz(int hertz); +#endif + diff -r 2fa26addb901 -r 48369c6aeaa0 src/sdl/Makefile.am --- a/src/sdl/Makefile.am Sun Mar 04 21:09:22 2012 -0600 +++ b/src/sdl/Makefile.am Sun Mar 04 22:32:01 2012 -0600 @@ -3,28 +3,37 @@ #noinst_PROGRAMS = TestEmu VisualBoyAdvance_SOURCES = \ - SDL.cpp \ - debugger.cpp \ - debugger.h \ - expr-lex.cpp \ - expr.cpp \ - expr.cpp.h \ - exprNode.cpp \ - exprNode.h \ - getopt.c \ - getopt.h \ - getopt1.c \ - ../AutoBuild.h \ - ../NLS.h \ - ../Port.h + Array.h \ + debugger.h \ + expr.cpp.h \ + getopt.h \ + RingBuffer.h \ + SoundDriver.h \ + SoundSDL.h \ + Types.h \ + exprNode.h \ + \ + debugger.cpp \ + expr.cpp \ + expr-lex.cpp \ + exprNode.cpp \ + getopt1.c \ + getopt.c \ + SDL.cpp \ + SoundSDL.cpp + + +#TestEmu.cpp + VisualBoyAdvance_LDADD = \ - ../lua/libgblua.a \ ../common/libgbcom.a \ ../gb/libgb.a \ ../gba/libgba.a \ ../filters/lib386.a \ - ../filters/libfilter.a + ../filters/libfilter.a \ + ../prof/libprof.a \ + ../lua/libgblua.a # TestEmu_SOURCES = \ # TestEmu.cpp \ @@ -48,4 +57,4 @@ -DSDL \ -DSYSCONFDIR=\"$(sysconfdir)\" -AM_CXXFLAGS = -fno-exceptions +AM_CXXFLAGS = -fno-exceptions @SDL_CFLAGS@ diff -r 2fa26addb901 -r 48369c6aeaa0 src/sdl/SDL.cpp --- a/src/sdl/SDL.cpp Sun Mar 04 21:09:22 2012 -0600 +++ b/src/sdl/SDL.cpp Sun Mar 04 22:32:01 2012 -0600 @@ -22,7 +22,7 @@ #include #include #include - +#include #include "AutoBuild.h" #include "Port.h" @@ -2043,7 +2043,7 @@ int main(int argc, char **argv) { - fprintf(stderr, "VisualBoyAdvance version %s [SDL]\n", VERSION); + fprintf(stderr, "VisualBoyAdvance version %s [SDL]\n", PACKAGE_VERSION); arg0 = argv[0];