aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2006-12-08 18:40:36 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2006-12-08 18:40:36 +0000
commit5af83c784ab47c787da30ab3127f35ddf4e7631e (patch)
tree0882e4b179afd071e6767686abcc375c2561f4bd /src
parentfe6d57d31342cb521a0ab64ce41e535cf353d02d (diff)
use zexy's build-system, which generates Make.config rather than
Makefile directly svn path=/trunk/externals/iem/iemmatrix/; revision=6745
Diffstat (limited to 'src')
-rw-r--r--src/Make.config.in34
-rw-r--r--src/Makefile106
-rw-r--r--src/Makefile.in86
-rw-r--r--src/configure.ac188
4 files changed, 254 insertions, 160 deletions
diff --git a/src/Make.config.in b/src/Make.config.in
new file mode 100644
index 0000000..7c685e0
--- /dev/null
+++ b/src/Make.config.in
@@ -0,0 +1,34 @@
+LIBRARY_NAME=@LIBRARY_NAME@
+
+# when build as a library this holds a pre-processor define
+# (e.g. "-DZEXY_LIBRARY")
+# when build as single externals this is empty
+BUILDLIBRARY =@BUILDLIBRARY@
+
+PREFIX =@prefix@@PDLIBDIR@
+
+INSTALL_BIN=$(DESTDIR)$(PREFIX)/lib/pd/extra
+INSTALL_DOC=$(DESTDIR)$(PREFIX)/lib/pd/@REFERENCEPATH@$(LIBRARY_NAME)
+
+EXT = @EXT@
+DEFS = @DFLAGS@
+IFLAGS = -I. @INCLUDES@
+
+CC = @CC@
+LD = @LD@
+STRIP = @STRIP@
+STRIPFLAGS= @STRIPFLAGS@
+
+AFLAGS =
+LFLAGS = @LFLAGS@
+WFLAGS =
+
+TARNAME = $(LIBRARY_NAME)-@LIBRARY_VERSION@.tgz
+
+# ICCFLAGS=-march=pentiumiii -axK
+LIBRARY_CFLAGS = $(IFLAGS) $(DEFS) $(BUILDLIBRARY) -DPD $(WFLAGS) @CFLAGS@ $(CFLAGS)
+
+MAKEDEP_FLAGS = @MAKEDEP_FLAGS@
+CONFIGUREFLAGS = @CONFIGUREFLAGS@
+
+LIBS = @LIBS@
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..1c95077
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,106 @@
+default: all
+
+.PHONEY: default all everything dist \
+ clean realclean distclean \
+ install install-bin install-doc install-abs \
+ tests
+
+-include Make.config
+
+TESTDIR=../tests
+
+HELPERSOURCES=$(LIBRARY_NAME)_sources.c $(LIBRARY_NAME).c
+
+OBJECTSOURCES=$(sort $(filter-out $(HELPERSOURCES), $(filter %.c, $(wildcard *.c))))
+
+SOURCES=$(OBJECTSOURCES) $(HELPERSOURCES)
+
+configure: configure.ac aclocal.m4
+ autoconf
+
+aclocal.m4: acinclude.m4
+ aclocal
+
+Make.config: Make.config.in configure
+ ./configure $(CONFIGUREFLAGS)
+
+$(LIBRARY_NAME)_sources.c $(LIBRARY_NAME)_sources.h:
+ ./makesource.sh
+
+-include $(SOURCES:.c=.d)
+
+## 2nd only generate depend-files when we have Make.config included
+## and thus MAKEDEP_FLAGS defined
+ifdef MAKEDEP_FLAGS
+## dependencies: as proposed by the GNU-make documentation
+## see http://www.gnu.org/software/make/manual/html_node/make_47.html#SEC51
+%.d: %.c
+ @set -e; rm -f $@; \
+ $(CPP) $(MAKEDEP_FLAGS) $(LIBRARY_CFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$
+endif
+
+.SUFFIXES: .$(EXT)
+
+TARGETS = $(SOURCES:.c=.o)
+
+OBJECTS = $(OBJECTSOURCES:.c=.$(EXT))
+
+## if $(BUILDLIBRARY) is defined, we build everything as a single library
+## else we build separate externals
+ifneq "$(BUILDLIBRARY)" ""
+all: $(LIBRARY_NAME)
+ cp $(LIBRARY_NAME).$(EXT) ..
+else
+all: $(OBJECTS)
+endif
+
+$(OBJECTS): %.$(EXT) : %.o
+ $(LD) $(LFLAGS) -o $@ $*.o $(LIBS)
+ $(STRIP) $(STRIPFLAGS) $@
+
+$(LIBRARY_NAME): $(TARGETS) $(LIBRARY_NAME)_sources.c $(LIBRARY_NAME)_sources.h
+ $(LD) $(LFLAGS) -o $@.$(EXT) *.o $(LIBS)
+ $(STRIP) $(STRIPFLAGS) $@.$(EXT)
+
+$(TARGETS): %.o : %.c
+ $(CC) $(LIBRARY_CFLAGS) -c -o $@ $*.c
+
+externals: $(OBJECTS)
+
+clean:
+ -rm -f *.$(EXT) *.o
+
+realclean: clean
+ -rm -f *~ _* config.*
+ -rm -f *.d *.d.*
+
+distclean: realclean
+ -rm -f Make.config ../*.$(EXT)
+ -rm -f $(LIBRARY_NAME).exp $(LIBRARY_NAME).lib $(LIBRARY_NAME).ncb \
+ $(LIBRARY_NAME).opt $(LIBRARY_NAME).plg
+ -rm -rf autom4te.cache/
+
+tests: all
+ make -C $(TESTDIR)
+
+install: install-bin install-doc install-abs
+
+install-bin:
+ -install -d $(INSTALL_BIN)
+ -install -m 644 $(LIBRARY_NAME).$(EXT) $(INSTALL_BIN)
+
+install-doc:
+ -install -d $(INSTALL_DOC)
+ -install -m 644 ../doc/*.pd $(INSTALL_DOC)
+
+install-abs:
+ -install -d $(INSTALL_BIN)
+ -install -m 644 ../abs/*.pd $(INSTALL_BIN)
+
+dist: all realclean
+ (cd ../..;tar czvf $(TARNAME) $(LIBRARY_NAME))
+
+everything: clean all install distclean
+
diff --git a/src/Makefile.in b/src/Makefile.in
deleted file mode 100644
index c4225e7..0000000
--- a/src/Makefile.in
+++ /dev/null
@@ -1,86 +0,0 @@
-LIBNAME =iemmatrix
-
-PREFIX =@prefix@@PDLIBDIR@
-
-INSTALL_BIN=$(PREFIX)/extra/$(LIBNAME)
-INSTALL_DOC=$(INSTALL_BIN)
-
-EXT = @EXT@
-DEFS = @DFLAGS@
-IFLAGS = -I. @INCLUDES@ $(INCLUDES)
-MAKEDEP_FLAGS = @MAKEDEP_FLAGS@
-
-CC = @CC@
-LD = @LD@
-STRIP = @STRIP@ @STRIPFLAGS@
-
-AFLAGS =
-LFLAGS = @LFLAGS@
-WFLAGS =
-
-TARNAME = $(LIBNAME)-@IEMMATRIX_VERSION@.tgz
-
-.SUFFIXES: .$(EXT)
-
-CFLAGS = $(DEFS) $(IFLAGS) $(WFLAGS) @CFLAGS@
-
-LIBS = @LIBS@
-
-SOURCES=$(sort $(filter %.c, $(wildcard *.c)))
-TARGETS = $(SOURCES:.c=.o)
-
-all: $(LIBNAME)
- cp $(LIBNAME).$(EXT) ..
-
-$(LIBNAME): $(TARGETS)
- $(LD) $(LFLAGS) -o $(LIBNAME).$(EXT) *.o $(LIBS)
- $(STRIP) $(LIBNAME).$(EXT)
-
-## dependencies: as proposed by the GNU-make documentation
-## see http://www.gnu.org/software/make/manual/html_node/make_47.html#SEC51
--include $(SOURCES:.c=.d)
-%.d: %.c
- @set -e; rm -f $@; \
- $(CXX) $(MAKEDEP_FLAGS) $(CFLAGS) $< > $@.$$$$; \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
- rm -f $@.$$$$
-
-clean:
- -rm -f *.$(EXT) *.o
-
-cleaner: clean
- -rm -f *~ _* config.* *.d *.d.*
-
-cleanest: cleaner
- -rm -f Makefile ../*.$(EXT)
-
-distclean: cleanest newmakefile
-
-install: install-bin install-abs install-doc
-
-install-bin:
- -install -d $(INSTALL_BIN)
- -install -m 644 $(LIBNAME).$(EXT) $(INSTALL_BIN)
-
-install-doc:
- -install -d $(INSTALL_DOC)
- -install -m 644 ../doc/*.pd $(INSTALL_DOC)
-
-install-abs:
- -install -d $(INSTALL_BIN)
- -install -m644 ../abs/*.pd $(INSTALL_BIN)
-
-dist: all cleaner
- (cd ../..;tar czvf $(TARNAME) $(LIBNAME))
-
-everything: clean all install distclean
-
-newmakefile:
- echo "current:">Makefile
- echo " ./configure && make">>Makefile
-
-Makefile: Makefile.in configure
- ./configure
-
-configure: configure.ac
- autoconf
diff --git a/src/configure.ac b/src/configure.ac
index 03036be..6b6320c 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1,6 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(iemmatrix.c)
+
dnl Checks for programs.
AC_PROG_CC
@@ -11,15 +12,46 @@ AC_SUBST(EXT)
AC_SUBST(LD)
AC_SUBST(STRIP)
AC_SUBST(STRIPFLAGS)
-AC_SUBST(IEMMATRIX_VERSION)
+AC_SUBST(LIBRARY_NAME)
+AC_SUBST(LIBRARY_VERSION)
+AC_SUBST(BUILDLIBRARY)
AC_SUBST(REFERENCEPATH)
AC_SUBST(PDLIBDIR)
AC_SUBST(INCLUDES)
+AC_SUBST(CONFIGUREFLAGS)
+
+LIBRARY_NAME=${ac_unique_file%.*}
+
+## store the flags passed to us
+## is there no way to get the flags without quotes?
+#CONFIGUREFLAGS=${ac_configure_args}
+## and is this solution portable? time will show....
+CONFIGUREFLAGS=$(echo ${ac_configure_args} | sed "s/'//g")
-AC_ARG_WITH(version, [ --with-version=<ver> enforce a certain iemmatrix-version (e.g. 0.1)])
AC_ARG_WITH(extension, [ --with-extension=<ext> enforce a certain extension for the dynamic library (e.g. dll)])
AC_ARG_WITH(pdpath, [ --with-pd=</path/to/pd> where to look for pd-headers and and -libs])
+
AC_ARG_ENABLE(PIC, [ --disable-PIC disable compilation with PIC-flag])
+if test "x" = "x${enable_PIC}" ; then
+ enable_PIC="${with_PIC}"
+fi
+
+if test "x$enable_PIC" != "xno"; then
+ AC_CHECK_CFLAGS([-fPIC])
+fi
+
+
+AC_ARG_ENABLE(library,[ --disable-library split the library into single externals])
+if test "xno" != "x${enable_library}" ; then
+dnl LATER: find a more generic way to generate the .._LIBRARY define
+ BUILDLIBRARY="-DLIBRARY"
+fi
+
+
+dnl check for "-mms-bitfields" cflag
+dnl it would make things so easy: AC_CHECK_FLAG([-mms-bitfields],,)
+AC_CHECK_CFLAGS([-mms-bitfields])
+
dnl Checks for libraries.
dnl Replace `main' with a function in -lc:
@@ -77,25 +109,6 @@ else
AC_SUBST(MAKEDEP_FLAGS, "-M")
fi
-dnl check for "-mms-bitfields" cflag
-dnl why is there no generic compiler-check for a given flag ?
-dnl it would make things so easy: AC_CHECK_FLAG([-mms-bitfields],,)
-AC_MSG_CHECKING("ms-bitfields")
-cat > conftest.c << EOF
-int main(){
- return 0;
-}
-EOF
-if ${CC} ${INCLUDES} ${DFLAGS} -o conftest.o conftest.c ${CFLAGS} -mms-bitfields > /dev/null 2>&1
-then
- echo "yes"
- CFLAGS="${CFLAGS} -mms-bitfields"
-else
- echo "no"
-fi
-
-
-
dnl isn't there a better way to check for good linker/stripper ?
@@ -117,124 +130,151 @@ fi
LD=${LD:=$CC}
dnl if we don't have $STRIP set, we set it to ${host}-strip or strip
-AC_CHECK_TOOL([STRIP], [strip], [true])
-AC_MSG_CHECKING([if strip is GNU strip])
-if $STRIP -V 2>&1 | grep GNU > /dev/null
-then
- AC_SUBST(STRIPFLAGS, "--strip-unneeded")
- AC_MSG_RESULT([yes])
-else
- AC_SUBST(STRIPFLAGS,"-x")
- AC_MSG_RESULT([no])
-fi
-
-DFLAGS=""
-
-
-if test "x$enable_PIC" != "xno"; then
-AC_MSG_CHECKING("PIC")
-cat > conftest.c << EOF
-int main(){
- return 0;
-}
-EOF
-if ${CC} ${INCLUDES} ${DFLAGS} -o conftest.o conftest.c ${CFLAGS} -fPIC > /dev/null 2>&1
+if test "x$STRIP" = "x"
then
- echo "yes"
- CFLAGS="${CFLAGS} -fPIC"
-else
- echo "no"
-fi
+ if test "x$host" != "x"
+ then
+ STRIP=${host}-strip
+ if $(which ${host}-strip > /dev/null)
+ then
+ :
+ else
+ STRIP="echo fake strip"
+ fi
+ else
+ STRIP=strip
+ fi
fi
+dnl STRIP=${STRIP:=strip}
dnl
-dnl OK, checks for machines are here now
+dnl OK, checks which machines are here now
+dnl this needs some rethinking when cross-compiling (?)
dnl
+AC_CHECK_LDFLAGS([-export_dynamic -shared])
+
if test `uname -s` = Linux;
then
- LFLAGS="-export_dynamic -shared"
- CFLAGS="$CFLAGS"
EXT=pd_linux
+ STRIPFLAGS="--strip-unneeded"
+ if test "$enable_icc" = "yes"; then
+ CC=icc
+ fi
+
+ if test $CC = "icc"
+ then
+ LD=$CC
+ AC_CHECK_LDFLAGS([-ip -ipo_obj])
+ AC_CHECK_CFLAGS([-ip -ipo_obj])
+ fi
fi
dnl This should use '-bundle_loader /path/to/pd/bin/pd' instead of'-undefined suppress'
dnl then strip might do something
if test `uname -s` = Darwin;
then
- LD=cc
- LFLAGS="-bundle -undefined suppress -flat_namespace"
+ LD=${CC}
EXT=pd_darwin
+ STRIP="echo faking strip"
+ STRIPFLAGS=
+
+ if test "$enable_lpt" = "yes"; then
+ AC_MSG_ERROR("lpt not supported on this platform");
+ fi
+ if test "$enable_lpt" = ""; then
+ AC_MSG_WARN("lpt not supported on this platform - disabling");
+ enable_lpt="no";
+ fi
fi
-if test `uname | sed -e 's/^MINGW.*/NT/'` = NT;
+#AC_CHECK_LDFLAGS([-dynamiclib -mmacosx-version-min=10.3 -undefined dynamic_lookup],
+# ,
+ AC_CHECK_LDFLAGS([-bundle -undefined suppress -flat_namespace])
+# )
+
+if test `uname | sed -e 's/^MINGW.*/NT/'` = NT ;
then
- LD=gcc
- INCLUDES="-I@prefix@/src"
- DFLAGS="-D__WIN32__"
- LFLAGS="-shared @prefix@/bin/pd.dll"
+ LD=${CC}
+# LDFLAGS="-shared pd.dll"
EXT=dll
-else
- PDLIBDIR="/lib/pd"
fi
+AC_CHECK_LDFLAGS([-shared pd.dll])
+
if test `uname -s` = IRIX64;
then
- LFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
+ LDFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
-OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
-shared -rdata_shared"
EXT=pd_irix6
dnl DFLAGS="-DUNIX -DIRIX6"
+ STRIPFLAGS="--strip-unneeded"
+ if test "$enable_lpt" = "yes"; then
+ AC_MSG_ERROR("lpt not supported on this platform");
+ fi
+ if test "$enable_lpt" = ""; then
+ AC_MSG_WARN("lpt not supported on this platform - disabling");
+ enable_lpt="no";
+ fi
fi
if test `uname -s` = IRIX32;
then
- LFLAGS="-o32 -DUNIX -DIRIX -O2
+ LDFLAGS="-o32 -DUNIX -DIRIX -O2
-shared -rdata_shared"
EXT=pd_irix5
dnl DFLAGS="-DUNIX -DIRIX5"
+ STRIPFLAGS="--strip-unneeded"
+ if test "$enable_lpt" = "yes"; then
+ AC_MSG_ERROR("lpt not supported on this platform");
+ fi
+ if test "$enable_lpt" = ""; then
+ AC_MSG_WARN("lpt not supported on this platform - disabling");
+ enable_lpt="no";
+ fi
fi
-
if test "x$with_extension" != "x"
then
EXT=$with_extension
fi
-dnl check for iemmatrix-version (but why...)
-AC_MSG_CHECKING("iemmatrix-version")
+dnl check for ${LIBRARY_NAME}-version (but why...)
+AC_MSG_CHECKING("library version")
if test "$with_version" != ""
then
echo -n "($with_version)... "
- IEMMATRIX_VERSION="$with_version"
+ LIBRARY_VERSION="$with_version"
else
if test "x$cross_compiling" = "xno"
then
cat > conftest.c << EOF
#include <stdio.h>
-#include "iemmatrix.h"
+#include "${LIBRARY_NAME}.h"
int main(){
printf("%s\n", VERSION);
return 0;
}
EOF
-if $CC $INCLUDES -o conftest.o conftest.c > /dev/null 2>&1
+if ${CC} ${INCLUDES} -o conftest.o conftest.c > /dev/null 2>&1
then
- IEMMATRIX_VERSION=`./conftest.o`
- echo "$IEMMATRIX_VERSION"
+ LIBRARY_VERSION=`./conftest.o`
+ echo "$LIBRARY_VERSION"
else
- IEMMATRIX_VERSION=""
+ LIBRARY_VERSION=""
echo "(unknown)"
fi
else
- IEMMATRIX_VERSION="X"
+ LIBRARY_VERSION="X"
echo "(X)"
fi
fi
-AC_OUTPUT(Makefile)
+LFLAGS=${LDFLAGS}
+AC_OUTPUT(Make.config)
-rm -f conftest.*
+dnl rm -f conftest.*