diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..3a7e58c --- /dev/null +++ b/configure.ac @@ -0,0 +1,160 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.58) +AC_INIT(OSCxpd, 0.2, jdl@xdv.org) +AC_CONFIG_SRCDIR([libOSC/OSC-client.h]) +AC_CONFIG_HEADER([config.h]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_LN_S +# AC_PROG_CXX +AC_PROG_CPP +# AC_PROG_INSTALL + +dnl ---------------------------------- +dnl here you can see that autoconf adds "-g -02" as a default +dnl these are flags for debugging, and will add extra weight +dnl to you external. CFLAGS, CPPFLAGS, etc are default variables +dnl ---------------------------------- +echo "default flags" +# echo "$CPPFLAGS" +# echo "$CXXFLAGS" +echo cflags "$CFLAGS" +echo ldflags "$LDFLAGS" + +dnl ------------------------------------------ +dnl ---- do some magic to gues the host opsys +dnl ---- taken from libvorbis configure.in +dnl ------------------------------------------ +# AC_CANONICAL_HOST + +# Checks for libraries. +# FIXME: Replace `main' with a function in `-lc': +AC_CHECK_LIB([c], [main]) +# FIXME: Replace `main' with a function in `-lm': +AC_CHECK_LIB([m], [main]) + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_HEADER_TIME +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_FUNC_MALLOC +AC_FUNC_SELECT_ARGTYPES +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([bzero gethostbyname inet_ntoa select socket strchr]) +AC_TYPE_SIGNAL + +# from augusts template + +dnl ------------------------------------------ +dnl for each of the *-*-host's in the following, do the checking and then set your CFLAGS, CPPFLAGS and LDFLAGS +dnl CFLAGS get set for C code, CPPFLAGS for c++ code. LDFLAGS is the linking flags for both c and c++ +dnl ------------------------------------------ + +INCLUDES="-I../libOSC" +LDFLAGS="$LDFLAGS -L/usr/local/lib -ldl" +if test -z "$GCC"; then + case $host in + *-*-irix*) + dnl If we're on IRIX, we wanna use cc even if gcc + dnl is there (unless the user has overriden us)... + if test -z "$CC"; then + CC=cc + fi + ;; + sparc-sun-solaris*) + CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" + ;; + *) + CFLAGS="-O" + ;; + esac +else + + case $host in + *86-*-linux*) + CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O2" + LDFLAGS="$LDFLAGS -shared" + dnl we could test for bad glibc here, but don't + pd_suffix=pd_linux + ;; + powerpc-*-linux*) + CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" + LDFLAGS="$LDFLAGS -shared" + pd_suffix=pd_linux + ;; + *-*-linux*) + CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" + LDFLAGS="$LDFLAGS -shared" + INCLUDES="$INCLUDES" + pd_suffix=pd_linux + ;; + sparc-sun-*) + echo "YOU HAVE A SPARC STATION, not setting any flags, not supported yet" + ;; + *-*-darwin*) + CFLAGS="$CPFLAGS -DUNIX -DMACOSX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O3 " + # LDFLAGS="$LDFLAGS -bundle -bundle_loader /usr/local/pd/bin/pd -undefined suppress -flat_namespace" + LDFLAGS="$LDFLAGS -bundle -bundle_loader /usr/local/pd/bin/pd -flat_namespace" + pd_suffix=pd_darwin + ;; + *) + dnl assume unix + CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" + LDFLAGS="$LDFLAGS -shared" + pd_suffix=pd_linux + ;; + esac +fi + +CFLAGS="$CFLAGS $INCLUDES" + +echo "Using cflags= $CFLAGS" +echo "Using ldflags= $LDFLAGS" +echo "Using includes= $INCLUDES" + + + +dnl ------------------------------------------ +dnl ---- add PureData includes dir +dnl ---- usually /usr/local/include +dnl ------------------------------------------ +AC_ARG_WITH(pd_dir, + [ --with-pd-dir=path pd header path (default=/usr/local/include) ], + [ + CPPFLAGS="$CPPFLAGS -I$withval" + echo + echo "pd dir is $withval" + echo + ]) + +dnl ------------------------------------------ +dnl ---- check for PureData Header +dnl ------------------------------------------ +AC_CHECK_HEADER(m_pd.h, [have_pd_hdr=yes ], [ + have_pd_hdr=no + echo + echo "no m_pd.h header found. try with option --with-pd-dir=/path/to/pd/src" + echo + exit + ]) + + +AC_SUBST(pd_suffix) +AC_SUBST(INCLUDES) + +AC_CONFIG_FILES([src/Makefile + libOSC/Makefile + send+dump/Makefile + Makefile]) + +AC_OUTPUT |