From 72b364e58b271242cb8b7840c460b28b8bf54ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Wed, 11 May 2005 16:50:56 +0000 Subject: modified configure in get MinGW-crosscompilation (for w32) work added a beautiful INSTALL.txt svn path=/trunk/externals/iem/iemmatrix/; revision=2956 --- INSTALL.txt | 68 ++++++++++++++++++++++++++++++++++++++ src/Makefile.in | 19 +++-------- src/configure.in | 99 ++++++++++++++++++++++++++++++++++++-------------------- 3 files changed, 137 insertions(+), 49 deletions(-) create mode 100644 INSTALL.txt diff --git a/INSTALL.txt b/INSTALL.txt new file mode 100644 index 0000000..de8f2eb --- /dev/null +++ b/INSTALL.txt @@ -0,0 +1,68 @@ +Installation/Compilation instructions for "iemmatrix" +===================================================== + + +1) linux (and other autoconf-systems): +====================================== + "cd" into iemmatrix/src/ + run "./configure" (see "./configure --help" for valid options) + run "make" + run "make install" + enjoy. + + this should install iemmatrix into /usr/local/lib/pd (unless you specify otherwise) + the dynamic-lib (iemmatrix.pd_linux) is installed into extra/ + the configure-script tries to detect whether you are running a pd>=0.37; if so, the + help-patches are installed into extra/iemmatrix; if you are running an old version + of pd, the help-files will be installed into doc/5.reference/iemmatrix + +CrossCompilation for w32 with MinGW (http://www.mingw.org) on linux-systems + you need a cross-compilation tool-chain for windows (there is a debian-package mingw32) + set the CC-environment-variable to the cross-compiler and export it + set the STRIP-environment-variable to the strip-version that comes with the toolchain and export it + set the CFLAGS-environment-variable to "-mms-bitfields" and export it (this is highly necessary to + run the external if pd was compiled with M$-vc) + run "./configure" and specify the path to your "m_pd.h" (with --includedir) and to your "pd.lib" (with --libdir) + don't forget to override the default extension ("pd_linux" on linux-systems) with the more appropriate "dll". + on bash this looks like: + % export CC=i586-mingw32msvc-cc + % export STRIP=i586-mingw32msvc-strip + % export CFLAGS=-mms-bitfields + % ./configure --includedir=/path/to/w32-pd/src/ -libdir=/path/to/w32-pd/bin/ -with-extension=dll + now run "make" and enjoy. + + +2) mac OS-X: +============ + there is nothing special in the code, so it should compile out of the box: + "cd" to iemmatrix/src + run "./configure; make" (for further details please see "1) linux") + +3) irix: +======== + i don't have any irix machine at hand, so i don't know whether it works + but again, since iemmatrix does not use anything special, it should work out of the box + try using configure in iemmatrix/src + (for further details please see "1) linux") + +4) W32: +======= + with MinGW installed, you probably might be able to use the configure in iemmatrix/src + users have reported that they were able to build it (with problems) + http://lists.puredata.info/pipermail/pd-list/2005-05/028266.html + i will support a makefile for msvc as soon as i boot into windows again + + +5) FreeBSD et al: +================= + i don't know, but why shouldn't it run there ? + try the configure in iemmatrix/src + and report any success or failure + + + + + + + + diff --git a/src/Makefile.in b/src/Makefile.in index bbb76c5..d34d582 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -7,10 +7,12 @@ INSTALL_DOC=$(PREFIX)/@REFERENCEPATH@$(LIBNAME) EXT = @EXT@ DEFS = @DFLAGS@ -IFLAGS = -I. @INCLUDES@ +IFLAGS = -I. @INCLUDES@ $(INCLUDES) CC = @CC@ LD = @LD@ +STRIP = @STRIP@ + AFLAGS = LFLAGS = @LFLAGS@ WFLAGS = @@ -19,11 +21,9 @@ TARNAME = $(LIBNAME)-@IEMMATRIX_VERSION@.tgz .SUFFIXES: .$(EXT) -PDCFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) $(LFLAGS) $(AFLAGS) -CFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) +CFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) @CFLAGS@ LIBS = @LIBS@ -#LIBS = -lpthread -lm -lc include Make.source TARGETS = $(SOURCES:.c=.o) @@ -33,16 +33,7 @@ all: $(LIBNAME) $(LIBNAME): $(TARGETS) $(LD) $(LFLAGS) -o $(LIBNAME).$(EXT) *.o $(LIBS) - strip @STRIPFLAGS@ $(LIBNAME).$(EXT) - -.c.o: - $(CC) -c -o $@ $(CFLAGS) -DPD $*.c - -# cp $@ $*_stat.o - -.o.$(EXT): - $(CC) -o $@ $(PDCFLAGS) -DPD $*.o - + $(STRIP) @STRIPFLAGS@ $(LIBNAME).$(EXT) clean: -rm -f *.$(EXT) *.o diff --git a/src/configure.in b/src/configure.in index f1da16b..645df29 100644 --- a/src/configure.in +++ b/src/configure.in @@ -9,6 +9,7 @@ AC_SUBST(DFLAGS) AC_SUBST(LFLAGS) AC_SUBST(EXT) AC_SUBST(LD) +AC_SUBST(STRIP) AC_SUBST(STRIPFLAGS) AC_SUBST(IEMMATRIX_VERSION) AC_SUBST(REFERENCEPATH) @@ -18,21 +19,15 @@ AC_SUBST(SOURCES) AC_ARG_WITH(pdversion, [ --with-pdversion= enforce a certain pd-version (e.g. 0.37)]) +AC_ARG_WITH(version, [ --with-version= enforce a certain iemmatrix-version (e.g. 0.1)]) +AC_ARG_WITH(extension, [ --with-extension= enforce a certain extension for the dynamic library (e.g. dll)]) -if test $includedir -then - for id in $includedir - do - if test -d $id - then - INCLUDES="-I$id $INCLUDES" - fi - done -fi dnl Checks for libraries. dnl Replace `main' with a function in -lc: AC_CHECK_LIB(c, main) +AC_CHECK_LIB(crtdll, fclose) + dnl Replace `main' with a function in -lm: AC_CHECK_LIB(m, main) dnl Replace `main' with a function in -lpthread: @@ -40,6 +35,24 @@ dnl AC_CHECK_LIB(pthread, main) dnl Replace `main' with a function in -lstk: dnl AC_CHECK_LIB(stk, main, STK=yes) + +if test $includedir +then + for id in $includedir + do + if test -d $id; then INCLUDES="-I$id $INCLUDES"; fi + done +fi +if test $libdir +then + for id in $libdir + do + if test -d $id; then LIBS="-L$id $LIBS"; fi + done +fi + +AC_CHECK_LIB(pd, nullfn) + dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(stdlib.h stdio.h string.h math.h time.h sys/time.h) @@ -52,7 +65,9 @@ AC_FUNC_MMAP AC_CHECK_FUNCS(select socket strerror) -LD=ld +LD=${LD:=$CC} +STRIP=${STRIP:=strip} + DFLAGS="" dnl @@ -73,14 +88,8 @@ then LFLAGS="-bundle -undefined suppress -flat_namespace" EXT=pd_darwin 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; then LD=gcc @@ -90,8 +99,8 @@ then EXT=dll else PDLIBDIR="/lib/pd" - LIBS="-lc -lm" fi + if test `uname -s` = IRIX64; then LFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \ @@ -100,13 +109,6 @@ then 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; @@ -116,15 +118,15 @@ then 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 Checks for pd-version, to set the correct help-path AC_MSG_CHECKING("pd\>=0.37") @@ -133,6 +135,9 @@ then echo -n "($with_pdversion)... " PD_VERSION="$with_pdversion" else +if test "x$cross_compiling" = "xno" +then + cat > conftest.c << EOF #include #include "m_pd.h" @@ -141,28 +146,47 @@ int main(){ return 0; } EOF + if $CC $INCLUDES -o conftest.o conftest.c > /dev/null 2>&1 then PD_VERSION=`./conftest.o` else PD_VERSION="" fi + echo -n $PD_VERSION +else +dnl we are cross-compiling... + echo -n "(X)..." + PD_VERSION="0.38" +fi fi let PD_MAJORVERSION=`echo $PD_VERSION | cut -d"." -f1`+0 let PD_MINORVERSION=`echo $PD_VERSION | cut -d"." -f2`+0 + + if test "$PD_MAJORVERSION" -gt 0 || test "$PD_MINORVERSION" -ge 37 then REFERENCEPATH=extra/help- - echo "yes" + echo " yes" else REFERENCEPATH=doc/5.reference/ - echo "no" + echo " no" fi + dnl check for iemmatrix-version (but why...) AC_MSG_CHECKING("iemmatrix-version") + +if test "$with_version" != "" +then + echo -n "($with_version)... " + IEMMATRIX_VERSION="$with_version" +else + +if test "x$cross_compiling" = "xno" +then cat > conftest.c << EOF #include #include "iemmatrix.h" @@ -180,6 +204,11 @@ else IEMMATRIX_VERSION="" echo "(unknown)" fi +else + IEMMATRIX_VERSION="X" + echo "(X)" +fi +fi echo "SOURCES = \\"> Make.source for i in `ls mtx_*.c iemmatrix.c` -- cgit v1.2.1