--- configure.ac.orig 2017-09-27 19:55:15 UTC +++ configure.ac @@ -10,18 +10,33 @@ dnl ------------------------------------ dnl path vars dnl ---------------------------------------------------------------------------- +AC_PREFIX_DEFAULT("/usr") + AC_CONFIG_AUX_DIR([build-aux]) AC_CANONICAL_HOST AC_CANONICAL_BUILD AC_SUBST([USER], ["$USER"]) + +gfortran="gfortran" + +AC_DEFINE_UNQUOTED(PREFIX, "${prefix}", [Prefix where wspr is installed.]) + + AC_SUBST([HOMEDIR], [/home/"$USER"/.wspr]) -AC_SUBST([PREFIX], [/usr]) -AC_SUBST([BINDIR], [/usr/bin]) -AC_SUBST([WSPRLIB], [/usr/lib/wspr]) -AC_SUBST([SHARED], [/usr/share/wspr]) -AC_SUBST([MANDIR], [/usr/share/man/man1]) -AC_SUBST([DOCDIR], [/usr/share/doc/wspr]) +AC_SUBST([PREFIX], [${prefix}]) +AC_SUBST([BINDIR], [${prefix}/bin]) +AC_SUBST([WSPRLIB], [${prefix}/lib/wspr]) +AC_SUBST([SHARED], [${prefix}/share/wspr]) +AC_SUBST([DOCDIR], [${prefix}/share/doc/wspr]) +case "${host_os}" in + *bsd* ) + AC_SUBST([MANDIR], [${prefix}/man/man1]) + ;; + * ) + AC_SUBST([MANDIR], [${prefix}/share/man/man1]) + ;; +esac dnl ---------------------------------------------------------------------------- dnl check compilers @@ -59,9 +74,17 @@ AC_PATH_PROG([TR], [tr]) AC_SUBST([OS], ["$host_os"]) AC_SUBST([CPU], ["$host_cpu"]) -dnl ---------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------- dnl check headers -dnl ---------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------- + +dnl --------------------------------------------------------------------------- +dnl Lots of BSD/Solaris/ other systems look in /usr/local +dnl --------------------------------------------------------------------------- + +CPPFLAGS="-I/usr/local/include ${CPPFLAGS}" +LDFLAGS="-L/usr/local/lib ${LDFLAGS}" + AC_HEADER_STDC AC_HEADER_DIRENT AC_HEADER_TIME @@ -88,36 +111,36 @@ dnl ------------------------------------ dnl add additional lib paths dnl ---------------------------------------------------------------------------- if test -d "/usr/lib64"; then LDFLAGS="-L/usr/lib64 ${LDFLAGS}"; fi -if test -d "/usr/local/lib"; then LDFLAGS="-L/usr/local/lib ${LDFLAGS}"; fi +#if test -d "/usr/local/lib"; then LDFLAGS="${LDFLAGS} -L/usr/local/lib"; fi if test -d "/usr/lib/x86_64-linux-gnu"; then LDFLAGS="-L/usr/lib/x86_64-linux-gnu ${LDFLAGS}"; fi if test -d "/usr/lib/i386-linux-gnu"; then LDFLAGS="-L/usr/lib/i386-linux-gnu ${LDFLAGS}"; fi -if test -d "/usr/lib"; then LDFLAGS="-L/usr/lib ${LDFLAGS}"; fi +if test -d "/usr/lib"; then LDFLAGS="${LDFLAGS} -L/usr/lib"; fi if test -d "/usr/lib/arm-linux-gnueabihf"; then LDFLAGS="-L/usr/lib/arm-linux-gnueabihf ${LDFLAGS}"; fi + dnl ---------------------------------------------------------------------------- dnl find Python3 dnl ---------------------------------------------------------------------------- HAVE_PY3=no -# check with-enable first +# check with-python3 first AC_MSG_CHECKING([Python3 --with-python3]) -AC_ARG_WITH([f2py], [ --with-python3=PATH path to: ../python3], +AC_ARG_WITH([python3], [ --with-python3=PATH path to: ../python3], PY3="$withval") # if --with-python3 is not empty -if test -n "$PY3"; then +if test -n ${PY3}; then # check if user provided python3 is >= 3.2 -python3 -c "import sys; sys.exit(sys.version < '3.2')" >/dev/null 2>&1 - +${PY3} -c "import sys; sys.exit(sys.version < '3.2')" >/dev/null 2>&1 if test "$?" != "0"; then - HAVE_PY3=no + HAVE_PY3="no" AC_MSG_RESULT([no]) else - HAVE_PY3=yes - PY3_PATH="$PY3" - PY3V=`$PY3 -V` + HAVE_PY3="yes" + PY3_PATH=${PY3} + PY3V=`${PY3} -V` AC_DEFINE([HAVE_PY3], [1]) AC_DEFINE_UNQUOTED([PY3_PATH], ["${PY3}"], [Path to Python3]) AC_SUBST([PYTHON], ["${PY3}"]) @@ -128,6 +151,7 @@ else fi # if not user supplied, check by calling python + if test "$HAVE_PY3" = "no"; then AC_MSG_CHECKING([Python3 using: python]) @@ -172,7 +196,7 @@ dnl ------------------------------------ HAVE_F2PY=no -# check with-enable first +# check with-f2py first AC_MSG_CHECKING([F2PY --with-f2py]) AC_ARG_WITH([f2py], [ --with-f2py=PATH path to: ../f2py ../f2py3], F2PY="$withval") @@ -244,13 +268,23 @@ dnl ------------------------------------ dnl check gfortran dnl ---------------------------------------------------------------------------- +AC_MSG_CHECKING([gfortran --with-gfortran]) +AC_ARG_WITH([gfortran], [ --with-gfortran=PATH path to: ../gfortran],]) + +# if --with-gfortran is not empty +if test -n ${withval}; then + gfortran="${withval}" + gfpath=`${gfortran} --print-file-name=|awk -F/ '{print $1 "/" $2 "/" $3 "/" $4 "/" $5}'` + LDFLAGS="-L${gfpath} ${LDFLAGS}" +fi + AC_CHECK_LIB([gfortran], [_gfortran_st_write], [], []) if test "$ac_cv_lib_gfortran__gfortran_st_write" != "yes"; then HAVE_GFORTRAN=0 else HAVE_GFORTRAN=1 - FC=gfortran + FC=${gfortran} FCV=gnu95 FC_LIB_PATH=`${FC} -print-file-name=` AC_DEFINE_UNQUOTED([FC_LIB_PATH], ["${FC_LIB_PATH}"], [Path to Gfortran libs.]) @@ -266,12 +300,14 @@ fi dnl ---------------------------------------------------------------------------- dnl check portaudio dnl ---------------------------------------------------------------------------- +# AC_CHECK_LIB([portaudio], [Pa_Initialize], [], []) if test "$ac_cv_lib_portaudio_Pa_Initialize" = "yes"; then - LIBS="-lportaudio ${LIBS}" + LIBS="-lportaudio ${LIBS}" fi + # if headers and libs found, set define if test "$ac_cv_header_portaudio_h" = "yes" -a "$ac_cv_lib_portaudio_Pa_Initialize" = "yes"; then HAVE_PORTAUDIO=1 @@ -279,7 +315,6 @@ if test "$ac_cv_header_portaudio_h" = "y AC_DEFINE([HAVE_PORTAUDIO_LIB], [1], [Portaudio Lib]) fi - dnl ---------------------------------------------------------------------------- dnl check fftw3 dnl ---------------------------------------------------------------------------- @@ -322,8 +357,10 @@ dnl ------------------------------------ _LBU=$(echo "-lpthread $LIBS" |tr ' ' '\n'|sort -su |tr '\n' ' ') LIBS="$_LBU" -_LDU=$(echo "$LDFLAGS" |tr ' ' '\n'|sort -su |tr '\n' ' ') -LDFLAGS="$_LDU" +# This of course destroys FreeBSD builds +#_LDU=$(echo "$LDFLAGS" |tr ' ' '\n'|sort -su |tr '\n' ' ') +#LDFLAGS="$_LDU" + _CPPU=$(echo "-I/usr/include -I/usr/local/include $CPPFLAGS" |tr ' ' '\n'|sort -su |tr '\n' ' ') CPPFLAGS="$_CPPU" @@ -355,6 +392,10 @@ case "${host_os}" in FFLAGS="-O2 -m64 -Wall -fbounds-check -fno-second-underscore \ -Wno-conversion -Wno-character-truncation -fPIC" ;; + *freebsd* ) + CFLAGS="${CFLAGS} -fpic" + FFLAGS="-O2 -m"$(/usr/bin/getconf LONG_BIT)" -Wall -fbounds-check -fno-second-underscore \ +-Wno-conversion -Wno-character-truncation -fPIC" ;; *) AC_MSG_ERROR([Unsupported System: ${host_os}.]) ;; @@ -377,10 +418,6 @@ if test "$HAVE_PY3" = "no"; then echo echo 'Example:' echo './configure --with-python3="/home/$USER/test/python3"' -else - # add python3 path to wspr.sh script - sed -i '/wspr.py/d' wspr.sh - echo "$PY3_PATH -O wspr.py" >> wspr.sh fi @@ -502,7 +539,7 @@ AC_SUBST([PREFIX], ["$prefix"]) AC_SUBST([PROGRAM], ["$PACKAGE_NAME"]) AC_SUBST([VERSION], ["$PACKAGE_VERSION"]) AC_SUBST([WEB], ["$PACKAGE_URL"]) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile wspr.sh]) AC_OUTPUT @@ -523,7 +560,7 @@ fi echo " Package: .........: ${PROGRAM} ${VERSION}" echo " Python3: .........: ${PYTHON}" echo " F2py: ............: ${F2PY}" -echo " Fcomplier: .......: ${FC}" +echo " Fcompiler: .......: ${FC}" echo " Samplerate: ......: ${srstatus}" echo " FFTW3: ...........: ${ffstatus}" echo " Portaudio: .......: ${pastatus}"