Bladeren bron

Initial commit

master
kevin 12 jaren geleden
commit
015929c965
11 gewijzigde bestanden met toevoegingen van 403 en 0 verwijderingen
  1. 36
    0
      .gitignore
  2. 61
    0
      Makefile.am
  3. 60
    0
      build/clean.sh
  4. 20
    0
      build/linux/debug/build.sh
  5. 19
    0
      build/linux/release/build.sh
  6. 20
    0
      build/osx/debug/build.sh
  7. 19
    0
      build/osx/release/build.sh
  8. 110
    0
      configure.ac
  9. 8
    0
      m4/os_64.m4
  10. 11
    0
      m4/os_type.m4
  11. 39
    0
      src/proj/main.c

+ 36
- 0
.gitignore Bestand weergeven

@@ -0,0 +1,36 @@
1
+# directories to ignore
2
+libcm
3
+
4
+.deps
5
+autom4te.cache
6
+build-aux
7
+build/linux/debug/src/
8
+build/linux/debug/bin
9
+build/linux/debug/lib
10
+build/linux/debug/include
11
+build/linux/release/src/
12
+build/linux/release/bin
13
+build/linux/release/lib
14
+build/linux/release/include
15
+
16
+#Files to ignore
17
+*~
18
+*.[oa]
19
+
20
+Makefile
21
+aclocal.m4
22
+config.h.in
23
+config.h
24
+configure
25
+hold.makefile
26
+Makefile.in
27
+config.log
28
+config.status
29
+libtool
30
+stamp-h1
31
+
32
+m4/libtool.m4
33
+m4/ltoptions.m4
34
+m4/ltsugar.m4
35
+m4/ltversion.m4
36
+m4/lt~obsolete.m4

+ 61
- 0
Makefile.am Bestand weergeven

@@ -0,0 +1,61 @@
1
+ACLOCAL_AMFLAGS = -I m4 # use custom macro's in ./m4 
2
+
3
+lib_LTLIBRARIES=
4
+bin_PROGRAMS=
5
+include_HEADERS=
6
+
7
+# C compiler flags
8
+# _GNU_SOURCE - turns on GNU specific extensions and gives correct prototype for double log2(double) 
9
+# -Wall turn on all warnings
10
+# -Wno-multichar - turns off multi-character constant warnings from cmAudioFile.c
11
+
12
+
13
+
14
+AM_CPPFLAGS = -D _GNU_SOURCE  -I.. -I$(srcdir)/src/libcm  -I$(srcdir)/src/libcm/dsp  -I$(srcdir)/src/libcm/vop  -I$(srcdir)/src/libcm/app
15
+AM_CFLAGS   = -Wno-multichar 
16
+AM_CXXFLAGS = 
17
+AM_LDFLAGS  =  
18
+MYLIBS      = -lpthread  -lfftw3f -lfftw3
19
+CMLIBS      = src/libcm/libcm.la  # autoconfig manual recommends storing direct referenes to non-3rd party libraries rather than using -L and -l
20
+
21
+
22
+# debug/release switches
23
+if DEBUG
24
+  AM_CFLAGS   += -g 
25
+  AM_CXXFLAGS += -g
26
+else
27
+  AM_CFLAGS   += -O3
28
+  AM_CXXFLAGS += -O3
29
+endif
30
+
31
+# NOTE: 10/25/12 The use of -Wl, -Bstatic -Wl, -Bdynamic forces linking
32
+# against the static version of 'libasound' and then turns dynamic linking
33
+# back on for the other libraries.
34
+# For some reason dynamically linking to asound causes runtime problems.
35
+# The most notable of which is the inability for ALSA to successfully
36
+# return hardware parameter values. 
37
+# See: http://stackoverflow.com/questions/809794/use-both-static-and-dynamically-linked-libraries-in-gcc?rq=1
38
+
39
+# Linux specific
40
+if OS_LINUX
41
+ MYLIBS    += -llapack -lcblas -latlas -lgfortran 
42
+if OS_64
43
+  AM_LDFLAGS += -L/usr/lib64/atlas -L/usr/lib64 -Wl,-Bstatic -lasound -Wl,-Bdynamic
44
+  MYLIBS      += -lrt -lm
45
+  AM_CFLAGS  += -m64
46
+endif	
47
+endif
48
+
49
+if OS_OSX
50
+ AM_LDFLAGS  +=  -framework Cocoa -framework CoreAudio -framework CoreMIDI -framework Carbon -framework Accelerate -framework vecLib
51
+endif
52
+
53
+include src/libcm/Makefile.am
54
+src_libcm_libcm_la_SOURCES   = $(cmSRC) $(cmHDR)
55
+include_HEADERS += $(cmHDR)
56
+lib_LTLIBRARIES += src/libcm/libcm.la
57
+
58
+
59
+src_proj_proj_SOURCES  = src/proj/main.c
60
+src_proj_proj_LDADD    = $(CMLIBS) $(MYLIBS)
61
+bin_PROGRAMS          += src/proj/proj

+ 60
- 0
build/clean.sh Bestand weergeven

@@ -0,0 +1,60 @@
1
+#!/bin/bash
2
+#
3
+# Run 'make distclean' to clean many of the temporary make files.
4
+# then use this script run from cm/build to clean the remaining files
5
+#
6
+
7
+
8
+
9
+function clean_dir {
10
+
11
+rm -f  $1/bin/kc.app/Contents/MacOS/kc
12
+rm -rf $1/src
13
+rm -rf $1/cm
14
+rm -rf $1/include
15
+rm -rf $1/lib
16
+rm -rf $1/bin
17
+rm -rf $1/.deps
18
+
19
+rm -f $1/config.h
20
+rm -f $1/config.log
21
+rm -f $1/config.status
22
+rm -f $1/Makefile
23
+rm -f $1/stamp-h1
24
+rm -f $1/libtool
25
+
26
+make -C $1 distclean
27
+
28
+}
29
+
30
+
31
+rm -f ../aclocal.m4
32
+rm -f ../config.h.in
33
+rm -f ../config.h.in~
34
+rm -f ../configure
35
+rm -f ../Makefile.in
36
+rm -f ../src/Makefile.in
37
+rm -rf ../autom4te.cache
38
+rm -rf ../build-aux
39
+rm -rf ../m4/.svn
40
+rm -f  ../m4/libtool.m4
41
+rm -f  ../m4/lt~obsolete.m4
42
+rm -f  ../m4/ltoptions.m4
43
+rm -f  ../m4/ltversion.m4
44
+rm -f  ../m4/ltsugar.m4
45
+
46
+clean_dir linux/debug
47
+clean_dir linux/release
48
+clean_dir osx/debug
49
+clean_dir osx/release
50
+
51
+rm -rf osx/debug/a.out.dSYM
52
+
53
+
54
+#rm -rf ../octave/results
55
+
56
+# remove all of emacs backup files (files ending width '~')
57
+# find ../ -name "*~" -exec rm {} \; 
58
+
59
+
60
+

+ 20
- 0
build/linux/debug/build.sh Bestand weergeven

@@ -0,0 +1,20 @@
1
+#!/bin/sh
2
+
3
+curdir=`pwd`
4
+
5
+cd ../../..
6
+autoreconf --force --install
7
+
8
+cd ${curdir}
9
+
10
+../../../configure --prefix=${curdir} \
11
+--enable-debug \
12
+CFLAGS="-g -Wall" \
13
+CXXFLAGS="-g -Wall" \
14
+CPPFLAGS= \
15
+LDFLAGS= \
16
+LIBS=
17
+
18
+
19
+#make
20
+#make install

+ 19
- 0
build/linux/release/build.sh Bestand weergeven

@@ -0,0 +1,19 @@
1
+#!/bin/sh
2
+
3
+curdir=`pwd`
4
+
5
+cd ../../..
6
+autoreconf --force --install
7
+
8
+cd ${curdir}
9
+
10
+../../../configure --prefix=${curdir} \
11
+CFLAGS="-Wall" \
12
+CXXFLAGS="-Wall" \
13
+CPPFLAGS= \
14
+LDFLAGS= \
15
+LIBS=
16
+
17
+
18
+#make
19
+#make install

+ 20
- 0
build/osx/debug/build.sh Bestand weergeven

@@ -0,0 +1,20 @@
1
+#!/bin/sh
2
+
3
+curdir=`pwd`
4
+
5
+cd ../../..
6
+autoreconf --force --install
7
+
8
+cd ${curdir}
9
+
10
+../../../configure --prefix=${curdir} \
11
+--enable-debug \
12
+CFLAGS="-g -Wall" \
13
+CXXFLAGS="-g -Wall" \
14
+CPPFLAGS= \
15
+LDFLAGS= \
16
+LIBS=
17
+
18
+
19
+#make
20
+#make install

+ 19
- 0
build/osx/release/build.sh Bestand weergeven

@@ -0,0 +1,19 @@
1
+#!/bin/sh
2
+
3
+curdir=`pwd`
4
+
5
+cd ../../..
6
+autoreconf --force --install
7
+
8
+cd ${curdir}
9
+
10
+../../../configure --prefix=${curdir} \
11
+CFLAGS="-Wall" \
12
+CXXFLAGS="-Wall" \
13
+CPPFLAGS= \
14
+LDFLAGS= \
15
+LIBS=
16
+
17
+
18
+#make
19
+#make install

+ 110
- 0
configure.ac Bestand weergeven

@@ -0,0 +1,110 @@
1
+#
2
+# Use "autoreconf --force --install" to update depedent files after changing 
3
+# this configure.ac or any of the Makefile.am files.
4
+#
5
+
6
+AC_INIT([proj],[1.0],[proj@larke.org])
7
+AC_CONFIG_AUX_DIR([build-aux])                    # put aux files in build-aux
8
+AM_INIT_AUTOMAKE([1.9 -Wall foreign subdir-objects]) # subdir-objects needed for non-recursive make
9
+AC_CONFIG_SRCDIR([src/proj/main.c])
10
+AC_CONFIG_HEADERS([config.h])
11
+AC_CONFIG_MACRO_DIR([m4])
12
+
13
+LT_INIT
14
+
15
+# Check for programs
16
+AC_PROG_CC
17
+AC_PROG_CXX
18
+# AC_PROG_RANLIB  # required for static librarires
19
+
20
+# Checks for libraries.
21
+AC_CHECK_LIB([cairo],[cairo_debug_reset_static_data],[AC_MSG_RESULT([The 'cairo' library was found.])],[AC_MSG_ERROR([The 'cairo' library was not found.])])
22
+#TODO: add more library checks 
23
+
24
+
25
+# Checks for header files.
26
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h limits.h mach/mach.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h termios.h unistd.h])
27
+
28
+# Checks for typedefs, structures, and compiler characteristics.
29
+AC_HEADER_STDBOOL
30
+AC_C_INLINE
31
+AC_TYPE_OFF_T
32
+AC_TYPE_SSIZE_T
33
+AC_TYPE_UINT64_T
34
+
35
+# Checks for library functions.
36
+AC_FUNC_ERROR_AT_LINE
37
+AC_FUNC_FORK
38
+AC_FUNC_FSEEKO
39
+AC_FUNC_MALLOC
40
+AC_FUNC_REALLOC
41
+AC_FUNC_STRTOD
42
+AC_CHECK_FUNCS([clock_gettime floor memmove memset mkdir pow rint select socket sqrt strcasecmp strchr strcspn strerror strspn strstr strtol])
43
+
44
+
45
+# The following is a custom macro in ./m4/os_type.m4
46
+# be sure to also set "ACLOCAL_AMFLAGS = -I m4" in ./Makefile.am
47
+# Defines the config.h variable OS_LINUX or OS_OSX
48
+AX_FUNC_OS_TYPE
49
+
50
+AX_FUNC_OS_64
51
+
52
+# ac_cv_os_type is set by AX_FUNC_OS_TYPE
53
+AM_CONDITIONAL([OS_LINUX],[test x"${ax_cv_os_type}" = xLinux])
54
+AM_CONDITIONAL([OS_OSX],[test x"${ax_cv_os_type}" = xDarwin])
55
+echo "OS='${ax_cv_os_type}'"
56
+
57
+AM_CONDITIONAL([OS_64],[test x"${ax_cv_os_64}" == xx86_64])
58
+echo "ptr width='${ax_cv_os_64}'"
59
+
60
+
61
+AC_ARG_ENABLE([debug],
62
+     [  --enable-debug    Turn on debugging],
63
+     [case "${enableval}" in
64
+       yes) debug=true ;;
65
+       no)  debug=false ;;
66
+       *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
67
+     esac],[debug=false])
68
+     
69
+echo "debug=${debug}"
70
+     
71
+AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
72
+
73
+if test x$debug = xfalse; then
74
+AC_DEFINE([NDEBUG], 1,[Debugging off.])
75
+fi
76
+
77
+AC_ARG_ENABLE([vectop],
78
+     [  --enable-vectop    Turn on use of Lapack and Atlas vector/matrix operations. ],
79
+     [case "${enableval}" in
80
+       yes) vectop=true ;;
81
+       no)  vectop=false ;;
82
+       *) AC_MSG_ERROR([bad value ${enableval} for --enable-vectop]) ;;
83
+     esac],[vectop=true])
84
+     
85
+echo "vectop=${vectop}"
86
+     
87
+# if --enable-vectop then #define CM_VECTOP = 1 in config.h otherwise CM_VECTOP is undefined.
88
+if test x"$vectop" = xtrue; then
89
+AC_DEFINE([CM_VECTOP], 1,[Use Lapack and Atlas.])
90
+fi
91
+
92
+
93
+AC_ARG_ENABLE([memalign],
94
+     [  --enable-memalign    Turn on memory alignment on dynamic memory allocations. ],
95
+     [case "${enableval}" in
96
+       yes) memalign=true ;;
97
+       no)  memalign=false ;;
98
+       *) AC_MSG_ERROR([bad value ${enableval} for --enable-memalign]) ;;
99
+     esac],[memalign=true])
100
+     
101
+echo "memalign=${memalign}"
102
+
103
+# if --enable-vectop then #define CM_MEMALIGN = 1 in config.h otherwise CM_MEMALIGN is undefined.     
104
+if test x"$memalign" = xtrue; then
105
+AC_DEFINE([CM_MEMALIGN], 1,[Turn on dynamic memory alignment.])
106
+fi
107
+
108
+
109
+AC_CONFIG_FILES([ Makefile ])
110
+AC_OUTPUT

+ 8
- 0
m4/os_64.m4 Bestand weergeven

@@ -0,0 +1,8 @@
1
+AC_DEFUN([AX_FUNC_OS_64],
2
+[AC_CACHE_CHECK([operating system address width],
3
+[ax_cv_os_64],
4
+[ax_cv_os_64=`uname -m`])
5
+if test x"$ax_cv_os_64" = xx86_64; then
6
+AC_DEFINE([OS_64], 1,[Operating system is 64 bits.])
7
+fi
8
+]) # AX_FUNC_OS_TYPE

+ 11
- 0
m4/os_type.m4 Bestand weergeven

@@ -0,0 +1,11 @@
1
+AC_DEFUN([AX_FUNC_OS_TYPE],
2
+[AC_CACHE_CHECK([operating system type],
3
+[ax_cv_os_type],
4
+[ax_cv_os_type=`uname`])
5
+if test x"$ax_cv_os_type" = xLinux; then
6
+AC_DEFINE([OS_LINUX], 1,[Operating system is Linux.])
7
+fi
8
+if test x"$ax_cv_os_type" = xDarwin; then
9
+AC_DEFINE([OS_OSX], 1,[Operating system is Darwin.])
10
+fi]) # AX_FUNC_OS_TYPE
11
+

+ 39
- 0
src/proj/main.c Bestand weergeven

@@ -0,0 +1,39 @@
1
+#include "cmPrefix.h"
2
+#include "cmGlobal.h"
3
+#include "cmRpt.h"
4
+#include "cmErr.h"
5
+#include "cmCtx.h"
6
+#include "cmMem.h"
7
+#include "cmMallocDebug.h"
8
+#include "cmLinkedHeap.h"
9
+#include "cmFileSys.h"
10
+#include "cmText.h"
11
+
12
+void print( void* arg, const char* text )
13
+{
14
+  printf("%s\n",text);
15
+}
16
+
17
+int main( int argc, char* argv[] )
18
+{
19
+    // initialize the heap check library
20
+  bool       memDebugFl          = cmDEBUG_FL;
21
+  unsigned   memGuardByteCnt     = memDebugFl ? 8 : 0;
22
+  unsigned   memAlignByteCnt     = 16;
23
+  unsigned   memFlags            = memDebugFl ? kTrackMmFl | kDeferFreeMmFl | kFillUninitMmFl : 0;
24
+
25
+  cmCtx_t    ctx;
26
+  cmCtxSetup(&ctx,"cm test",print,print,NULL,memGuardByteCnt,memAlignByteCnt,memFlags);
27
+
28
+  cmMdInitialize( memGuardByteCnt, memAlignByteCnt, memFlags, &ctx.rpt );
29
+
30
+  cmFsInitialize( &ctx, "cm_test" );
31
+
32
+  cmTsInitialize(&ctx );
33
+
34
+  cmTsFinalize();
35
+  cmFsFinalize();
36
+  cmMdReport( kIgnoreNormalMmFl );
37
+  cmMdFinalize();
38
+  return 0;
39
+}

Laden…
Annuleren
Opslaan