From 55d034c83433dbc1b57eec6c9e07ab652de3b910 Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Thu, 27 Sep 2012 14:22:07 -0500 Subject: [PATCH] Build system: Syntax and formatting cleanup Cleaned up M4sh syntax for variable quoting, replaced shell 'if' conditionals with M4sh AS_IF macro and shell 'case' with AS_CASE macro. Properly quoted macro variables. Added comments to configure.ac describing actions, commented out obsolete macros, commented obsolecent macros, and added comments for major sections. Corrected a Mingw linker error on the .EXE files adding '--enable-auto-import' to their LD flags. Testing this commit on win32 shows that rigctld is now working properly. Will need to port this to the Stable branch and test. Replaced older local macros with newer replacements from GNU Autoconf archive. --- configure.ac | 707 +++++++++++------- macros/Makefile.am | 7 +- macros/ax_append_flag.m4 | 69 ++ macros/ax_cflags_warn_all.m4 | 122 +++ ...{ac_python_devel.m4 => ax_python_devel.m4} | 23 +- tests/Makefile.am | 14 +- 6 files changed, 639 insertions(+), 303 deletions(-) create mode 100644 macros/ax_append_flag.m4 create mode 100644 macros/ax_cflags_warn_all.m4 rename macros/{ac_python_devel.m4 => ax_python_devel.m4} (95%) diff --git a/configure.ac b/configure.ac index b7e07ed0f..25d0e055d 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ dnl Autoconf 2.67 is in Debian Squeeze--is an older version needed dnl for some other distribution? ## FIXME: Is this too new? ## -AC_PREREQ(2.67) +AC_PREREQ([2.67]) ## ------------------------ ## @@ -13,10 +13,16 @@ dnl Please do not use '-' in the version number, as package managers will fail, dnl however, the use of '~' should be fine as apt (others?) will treat dnl it as an earlier version than the actual release. TNX KA6MAL dnl PACKAGE_NAME + " " + PACKAGE_VERSION must not exceed 20 chars! -AC_INIT([Hamlib],[3.0~git],[hamlib-developer@lists.sourceforge.net],[hamlib],[http://www.hamlib.org]) +AC_INIT([Hamlib], + [3.0~git], + [hamlib-developer@lists.sourceforge.net], + [hamlib], + [http://www.hamlib.org]) + AC_CONFIG_SRCDIR([include/hamlib/rig.h]) AC_CONFIG_MACRO_DIR([macros]) + ## ------------------------ ## ## Automake Initialisation. ## ## ------------------------ ## @@ -24,29 +30,48 @@ dnl Passing AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION to AM_INIT_AUTOMAKE is dnl obsolete as these values are obtained from the AC_INIT macro. AM_INIT_AUTOMAKE([-Wall]) AC_CONFIG_HEADERS([include/config.h]) + +dnl Clean compilation output makes compiler warnings more visible m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +dnl TODO: Maintainer mode has arguments against its use. +dnl Consider its removal at some point. AM_MAINTAINER_MODE -## ------------------------------- ## -## Hamlib specific configuration. ## -## ------------------------------- ## + +## ------------------------------ ## +## Hamlib specific configuration. ## +## ------------------------------ ## +dnl New backends must be listed here! Also the new Makefile path must be +dnl added to AC_CONFIG_FILES near the end of this file. See README.developer +BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc drake lowe rft rs kit skanti prm80 tapr flexradio wj racal tuner adat" +ROT_BACKEND_LIST="dummy easycomm fodtrack gs232a heathkit kit rotorez sartek spid ars m2 amsat ts7400 celestron" + ABI_VERSION=3 -dnl Pick up the Hamlib macros. -AM_ACLOCAL_INCLUDE([macros]) +AC_DEFINE_UNQUOTED([ABI_VERSION], [$ABI_VERSION], [Frontend ABI version]) +AC_SUBST([ABI_VERSION]) -AC_DEFINE_UNQUOTED(ABI_VERSION, $ABI_VERSION, [Frontend ABI version]) -AC_SUBST(ABI_VERSION) +dnl Pick up the Hamlib macros. +dnl macros/aclocal-include.m4 +dnl AM_ACLOCAL_INCLUDE([macros]) dnl directory for docs (html) hamlibdocdir=$datadir/doc/hamlib -AC_SUBST(hamlibdocdir) +AC_SUBST([hamlibdocdir]) +# Add Hamlib header include paths +AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/include -I\$(top_srcdir)/src -I\$(top_srcdir)/lib" + + +## --------------- ## +## Program checks ## +## --------------- ## dnl Checks for programs. AC_PROG_CC AC_PROG_CXX -AC_PROG_AWK AC_PROG_CPP +AC_PROG_AWK AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET @@ -61,23 +86,35 @@ dnl AC_MINIX dnl AC_PROG_CC dnl AC_DIAGNOSE([obsolete],[AM_PROG_CC_STDC: -dnl your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon -dnl 'ac_cv_prog_cc_stdc'. Remove this warning and the assignment when -dnl you adjust the code. You can also remove the above call to -dnl AC_PROG_CC if you already called it elsewhere.]) +dnl your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon +dnl 'ac_cv_prog_cc_stdc'. Remove this warning and the assignment when +dnl you adjust the code. You can also remove the above call to +dnl AC_PROG_CC if you already called it elsewhere.]) dnl am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc -AC_PROG_GCC_TRADITIONAL +## ----------------------------------- ## +## Miscellaneous configuration macros ## +## ----------------------------------- ## +dnl The latest Autoconf manual (2.69) states these macros are obsolecent. +AC_PROG_GCC_TRADITIONAL AC_C_CONST + AC_C_INLINE -LF_SET_WARNINGS +dnl Set warnings for compilation +dnl LF_SET_WARNINGS +# macros/ax_cflags_warn_all.m4 +AX_CFLAGS_WARN_ALL +AX_CXXFLAGS_WARN_ALL dnl Automake macro for rigmem compilation AM_PROG_CC_C_O -dnl Checks for header files. + +## ------------------------------------------ ## +## Various parts of Hamlib need these headers ## +## ------------------------------------------ ## AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS([alloca.h argz.h malloc.h memory.h string.h strings.h]) @@ -88,25 +125,30 @@ AC_CHECK_HEADERS([linux/ppdev.h linux/parport.h linux/ioctl.h linux/hidraw.h]) AC_CHECK_HEADERS([dev/ppbus/ppi.h dev/ppbus/ppbconf.h]) AC_CHECK_HEADERS([sys/socket.h netinet/in.h netdb.h arpa/inet.h ws2tcpip.h]) + +## ------------------------------------ ## +## System capability and library checks ## +## ------------------------------------ ## dnl Check for Mingw (Win32 Sleep) support +# macros/gr_pwin32.m4 GR_PWIN32 +dnl macros/ax_pthread.m4 AX_PTHREAD -if test x"$ax_pthread_ok" = xyes; then - CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" - CXXFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" -fi +AS_IF([test x"$ax_pthread_ok" = xyes], [ + CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" + CXXFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" +]) AC_SYS_POSIX_TERMIOS() -# Add Hamlib header include paths -AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/include -I\$(top_srcdir)/src -I\$(top_srcdir)/lib" dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T AC_HEADER_TIME dnl AC_TYPE_SIGNAL -AC_CHECK_TYPES([siginfo_t],[],[],[#include ]) +AC_CHECK_TYPES([siginfo_t],[],[],[[#include ]]) + dnl Checks for libraries. @@ -117,13 +159,16 @@ dnl Checks for libraries. # On a few very rare systems, all of the libm.a stuff is # already in libc.a. Set compiler flags accordingly. #-------------------------------------------------------------------- -AC_CHECK_FUNC(sin, [MATH_LIBS=""], [MATH_LIBS="-lm"]) +AC_CHECK_FUNC([sin], [MATH_LIBS=""], [MATH_LIBS="-lm"]) +AC_SUBST([MATH_LIBS]) + +dnl Interactive UNIX? You've got to be kidding! +dnl #-------------------------------------------------------------------- +dnl # Interactive UNIX requires -linet instead of -lsocket, plus it +dnl # needs net/errno.h to define the socket-related error codes. +dnl #-------------------------------------------------------------------- +dnl AC_CHECK_LIB([inet], [main], [LIBS="$LIBS -linet"], [], []) -#-------------------------------------------------------------------- -# Interactive UNIX requires -linet instead of -lsocket, plus it -# needs net/errno.h to define the socket-related error codes. -#-------------------------------------------------------------------- -AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"], [], []) #-------------------------------------------------------------------- # Check for the existence of the -lsocket and -lnsl libraries. # The order here is important, so that they end up in the right @@ -143,39 +188,70 @@ AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"], [], []) #-------------------------------------------------------------------- hl_checkBoth=0 hl_oldLibs=$LIBS -AC_CHECK_FUNC(connect, hl_checkSocket=0, hl_checkSocket=1) -if test "$hl_checkSocket" = 1; then - AC_CHECK_LIB(socket, main, [NET_LIBS="$NET_LIBS -lsocket"], [hl_checkBoth=1], []) -fi -if test "$hl_checkBoth" = 1; then - hl2_oldLibs=$LIBS - LIBS="$LIBS -lsocket -lnsl" - AC_CHECK_FUNC(accept, hl_checkNsl=0, [LIBS=$hl2_oldLibs]) -fi -AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, - [NET_LIBS="$NET_LIBS -lnsl"], [], [])) + +AC_CHECK_FUNC([connect], [hl_checkSocket=0], [hl_checkSocket=1]) + +AS_IF([test "$hl_checkSocket" = 1], [ + AC_CHECK_LIB([socket], + [main], + [NET_LIBS="$NET_LIBS -lsocket"], + [hl_checkBoth=1], + []) + ]) + +AS_IF([test "$hl_checkBoth" = 1], [ + hl2_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + AC_CHECK_FUNC([accept], [hl_checkNsl=0], [LIBS=$hl2_oldLibs]) + ]) + +AC_CHECK_FUNC([gethostbyname],[], + [AC_CHECK_LIB([nsl], + [main], + [NET_LIBS="$NET_LIBS -lnsl"], + [], + []) + ]) + # Winsock2 -AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(ws2_32, main, - [NET_LIBS="$NET_LIBS -lws2_32"], [], [])) +AC_CHECK_FUNC([gethostbyname], [], + [AC_CHECK_LIB([ws2_32], + [main], + [NET_LIBS="$NET_LIBS -lws2_32"], + [], + []) + ]) + LIBS="$LIBS $NET_LIBS" + +dnl macros/hl_getaddrinfo.m4 HL_GETADDRINFO LIBS=$hl_oldLibs -AC_SUBST(NET_LIBS) -AC_SUBST(MATH_LIBS) +AC_SUBST([NET_LIBS]) +## End Hamlib socket test ## -AC_CHECK_LIB(syslog,syslog) # OS/2 needs this +dnl No source file tests for HAVE_LIBSYSLOG set by the following +dnl AC_CHECK_LIB macro so commenting. May remove later. +dnl # OS/2 needs this +dnl AC_CHECK_LIB(syslog,syslog) dnl Checks for library functions. AC_CHECK_FUNCS([atexit snprintf select memmove memset]) AC_CHECK_FUNCS([strcasecmp strchr strdup strerror strrchr strstr strtol]) AC_CHECK_FUNCS([cfmakeraw setitimer ioctl sigaction]) AC_FUNC_ALLOCA -#AC_FUNC_MALLOC -AC_FUNC_VPRINTF -AC_LIBOBJ(termios) -AC_LIBOBJ(dummy) + +dnl Doesn't seem to be needed anymore +dnl AC_FUNC_MALLOC + +dnl Obsolecent macro +dnl AC_FUNC_VPRINTF + +AC_LIBOBJ([termios]) +AC_LIBOBJ([dummy]) + ## ------------------------ ## ## libtool Initialisation. ## @@ -189,86 +265,117 @@ dnl AC_PROG_LIBTOOL dnl AM_PROG_LIBTOOL INCLTDL="" LIBLTDL="-lltdl" -AC_SUBST(INCLTDL) -AC_SUBST(LIBLTDL) +AC_SUBST([INCLTDL]) +AC_SUBST([LIBLTDL]) -case "$host_os" in -freebsd*) - AM_CPPFLAGS="-I/usr/local/include ${AM_CPPFLAGS}" - AM_LDFLAGS="${AM_LDFLAGS} -L/usr/local/lib" - AC_SUBST([AM_LDFLAGS]) - ;; -darwin* | rhapsody*) - # Trick from http://fink.sourceforge.net/doc/porting/ - # TODO: check the compiler actually does support these options - CFLAGS="${CFLAGS} -no-cpp-precomp" - CXXFLAGS="${CXXFLAGS} -no-cpp-precomp" - # Tell the OS X linker to allocate enough space inside the - # libhamlib.X.dylib shared object for install_name_tool(1) to - # work. This is useful when including hamlib in an app bundle. - OSXLDFLAGS="-Wl,-headerpad_max_install_names" - AC_SUBST([OSXLDFLAGS]) - ;; -mingw* | pw32* | cygwin*) - WINLDFLAGS="-Wl,--output-def,libhamlib.def -Wl,--add-stdcall-alias" - AC_SUBST([WINLDFLAGS]) - # Prerequisite for Mingw build (import and build internal ./libltdl): - # $ libtoolize --ltdl - # $ ( cd libltdl; ./configure --host=i586-mingw32msvc && make ) - # Use internal ./libltdl during configure: - CFLAGS="${CFLAGS} -I./libltdl" - # use internal $(top_builddir)/libltdl during build: - INCLTDL="-I\$(top_builddir)/libltdl" - # - use internal $(top_builddir)/libltdl during build and library 'ltdlc': - LIBLTDL="-L\$(top_builddir)/libltdl -lltdlc" - AC_SUBST(INCLTDL) - AC_SUBST(LIBLTDL) - ;; -esac +## ---------------------------------- ## +## Custom host libtool configurations ## +## ---------------------------------- ## +AS_CASE(["$host_os"], + [freebsd*], [ + AM_CPPFLAGS="-I/usr/local/include ${AM_CPPFLAGS}" + AM_LDFLAGS="${AM_LDFLAGS} -L/usr/local/lib" + AC_SUBST([AM_LDFLAGS])], + + [darwin* | rhapsody*], [ + # Trick from http://fink.sourceforge.net/doc/porting/ + # TODO: check the compiler actually does support these options + CFLAGS="${CFLAGS} -no-cpp-precomp" + CXXFLAGS="${CXXFLAGS} -no-cpp-precomp" + + # Tell the OS X linker to allocate enough space inside the + # libhamlib.X.dylib shared object for install_name_tool(1) to + # work. This is useful when including hamlib in an app bundle. + OSXLDFLAGS="-Wl,-headerpad_max_install_names" + AC_SUBST([OSXLDFLAGS])], + + [mingw* | pw32* | cygwin*], [ + WINLDFLAGS="-Wl,--output-def,libhamlib.def -Wl,--add-stdcall-alias" + AC_SUBST([WINLDFLAGS]) + + # Prerequisite for Mingw build (import and build internal ./libltdl): + # $ libtoolize --ltdl + # $ ( cd libltdl; ./configure --host=i586-mingw32msvc && make ) + # Use internal ./libltdl during configure: + CFLAGS="${CFLAGS} -I./libltdl" + + # use internal $(top_builddir)/libltdl during build: + INCLTDL="-I\$(top_builddir)/libltdl" + AC_SUBST([INCLTDL]) + + # - use internal $(top_builddir)/libltdl during build and library 'ltdlc': + LIBLTDL="-L\$(top_builddir)/libltdl -lltdlc" + AC_SUBST([LIBLTDL]) + + # Enable ld's "auto import" for executables + WINEXELDFLAGS="-Wl,--enable-auto-import" + AC_SUBST([WINEXELDFLAGS]) + ]) + +## ---------------------- ## +## External package tests ## +## ---------------------- ## dnl Check whether we can actually find ltdl.h -AC_CHECK_HEADER([ltdl.h], [AC_MSG_RESULT([yes])], - [ AC_MSG_ERROR([ltdl.h not found. Please install the libltdl development +AC_CHECK_HEADER([ltdl.h], + [AC_MSG_RESULT([yes])], + [AC_MSG_ERROR([ltdl.h not found. Please install the libltdl development files package which provides /usr/include/ltdl.h -(perhaps called 'libltdl-dev' or 'libltdl-devel').]) ]) +(perhaps called 'libltdl-dev' or 'libltdl-devel').]) + ]) + dnl Check if C99 struct initializers are supported -AC_MSG_CHECKING(whether C99 struct/array initializers are supported) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[struct{char a;int b;}s[8]={[3]={.b=5}};]])],[AC_MSG_RESULT(yes)],[AC_MSG_ERROR( "" - "You need a C99 compliant C compiler that supports struct/array intializers." - "Have you considered GCC lately?.")]); +AC_MSG_CHECKING([whether C99 struct/array initializers are supported]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], + [[struct{char a;int b;}s[8]={[3]={.b=5}};]])], + [AC_MSG_RESULT(yes)], + [AC_MSG_ERROR(["" +"You need a C99 compliant C compiler that supports struct/array intializers." +"Have you considered GCC lately?."]) + ]) + dnl libxml2 required rigmem xml support -PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], - [AC_DEFINE(HAVE_XML2,[1],[Define if libxml2 is available])], - [AC_MSG_WARN([libxml-2.0 pkg-config not found, XML support will be disabled])]) -AC_SUBST(LIBXML2_LIBS) -AC_SUBST(LIBXML2_CFLAGS) +PKG_CHECK_MODULES([LIBXML2], + [libxml-2.0], + [AC_DEFINE([HAVE_XML2], + [1], + [Define if libxml2 is available])], + [AC_MSG_WARN([libxml-2.0 pkg-config not found, XML support will be disabled]) + ]) + +AC_SUBST([LIBXML2_LIBS]) +AC_SUBST([LIBXML2_CFLAGS]) + dnl Check if libgd-dev is installed, so we can enable rigmatrix +AC_ARG_ENABLE([rigmatrix], + [AS_HELP_STRING([--enable-rigmatrix], + [generate rigmatrix tool (requires libgd)])], + [AC_CHECK_HEADERS([gd.h], + [AC_CHECK_LIB([gd], + [gdImageCreate], + [enable_rigmatrix=yes], + [enable_rigmatrix=no], + [-lz]) + ])], + [enable_rigmatrix=no]) -AC_ARG_WITH(rigmatrix, - [ --with-rigmatrix Generate rigmatrix tool (requires libgd)], - [AC_CHECK_HEADERS([gd.h], - [AC_CHECK_LIB([gd],[gdImageCreate], [enable_rigmatrix=yes], - [enable_rigmatrix=no],[-lz]) - ]) - ], - [enable_rigmatrix=no]) +AC_MSG_CHECKING([whether to build rigmatrix]) +AC_MSG_RESULT([$enable_rigmatrix]) +AS_IF([test "${enable_rigmatrix}" = "no"], + [RIGMATRIX=], + [RIGMATRIX="rigmatrix"]) -AC_MSG_CHECKING(whether to build rigmatrix) -AC_MSG_RESULT($enable_rigmatrix) -if test "${enable_rigmatrix}" = "no"; then - RIGMATRIX= -else - RIGMATRIX="rigmatrix" -fi -AC_SUBST(RIGMATRIX) +AC_SUBST([RIGMATRIX]) -BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc drake lowe rft rs kit skanti prm80 tapr flexradio wj racal tuner adat" -ROT_BACKEND_LIST="dummy easycomm fodtrack gs232a heathkit kit rotorez sartek spid ars m2 amsat ts7400 celestron" +## ----------------- ## +## Language bindings ## +## ----------------- ## + BINDINGS="" BINDING_ALL="" BINDING_CHECK="" @@ -280,207 +387,241 @@ BINDING_UNINSTALL="" BINDING_LIST="" BINDING_LIB_TARGETS="" + dnl Check if cxx-binding not wanted, default is to build it +# C++ binding # TODO: check whether CXX is functional -AC_CHECK_PROG(cf_with_cxx, "${CXX}", [yes], [no]) +AC_CHECK_PROG([cf_with_cxx], ["${CXX}"], [yes], [no]) -AC_MSG_CHECKING(whether to build C++ binding and demo) -AC_ARG_WITH(cxx-binding, - [ --without-cxx-binding do not build C++ binding and demo], - [cf_with_cxx_binding=$withval], - [cf_with_cxx_binding=$cf_with_cxx]) -AC_MSG_RESULT($cf_with_cxx_binding) +AC_MSG_CHECKING([whether to build C++ binding and demo]) +AC_ARG_WITH([cxx-binding], + [AS_HELP_STRING([--without-cxx-binding], + [do not build C++ binding and demo @<:@default=yes@:>@])], + [cf_with_cxx_binding=$withval], + [cf_with_cxx_binding=$cf_with_cxx]) +AC_MSG_RESULT([$cf_with_cxx_binding]) + +AS_IF([test "${cf_with_cxx_binding}" = "yes"], + [BINDINGS="${BINDINGS} c++"]) -if test "${cf_with_cxx_binding}" = "yes" ; then - BINDINGS="${BINDINGS} c++" -fi dnl Check if perl-binding not wanted, default is to not build it -AC_MSG_CHECKING(whether to build perl binding and demo) -AC_ARG_WITH(perl-binding, - [ --with-perl-binding build perl binding and demo], - [cf_with_perl_binding=$withval], - [cf_with_perl_binding=no]) -AC_MSG_RESULT($cf_with_perl_binding) +# Perl binding +AC_MSG_CHECKING([whether to build perl binding and demo]) +AC_ARG_WITH([perl-binding], + [AS_HELP_STRING([--with-perl-binding], + [build perl binding and demo @<:@default=no@:>@])], + [cf_with_perl_binding=$withval], + [cf_with_perl_binding=no]) +AC_MSG_RESULT([$cf_with_perl_binding]) + +dnl SC_PATH_PERLINC from macros/perl.m4 +AS_IF([test "${cf_with_perl_binding}" = "yes"],[ + SC_PATH_PERLINC + BINDING_LIST="${BINDING_LIST} perl" + BINDING_ALL="${BINDING_ALL} all-perl" + BINDING_CHECK="${BINDING_CHECK} check-perl" + BINDING_CLEAN="${BINDING_CLEAN} clean-perl" + BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-perl" + BINDING_DISTCHECK="${BINDING_DISTCHECK} distcheck-perl" + BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-perl" + BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-perl"]) -if test "${cf_with_perl_binding}" = "yes" ; then - SC_PATH_PERLINC - BINDING_LIST="${BINDING_LIST} perl" - BINDING_ALL="${BINDING_ALL} all-perl" - BINDING_CHECK="${BINDING_CHECK} check-perl" - BINDING_CLEAN="${BINDING_CLEAN} clean-perl" - BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-perl" - BINDING_DISTCHECK="${BINDING_DISTCHECK} distcheck-perl" - BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-perl" - BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-perl" -fi dnl Kylix binding has been removed because unmaintained. Volunteers welcome. -# Tcl bindings +# Tcl binding AC_MSG_CHECKING([Whether to build Tcl bindings and demos]) -AC_ARG_ENABLE([tcl-binding], - [AS_HELP_STRING([--enable-tcl-binding], - [Build Tcl binding and demo (default: no)])], - [build_tcl=$enableval], - [build_tcl=no]) -AC_MSG_RESULT($build_tcl) -if test x"${build_tcl}" = "xyes"; then - SC_PATH_TCLCONFIG - SC_LOAD_TCLCONFIG - tcl_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC" - AC_CHECK_HEADERS([tcl.h], - [], - [AC_MSG_ERROR([Unable to find Tcl headers])]) - CPPFLAGS=$tcl_save_CPPFLAGS +AC_ARG_WITH([tcl-binding], + [AS_HELP_STRING([--with-tcl-binding], + [build Tcl binding and demo @<:@default=no@:>@])], + [build_tcl=$withval], + [build_tcl=no]) +AC_MSG_RESULT([$build_tcl]) - BINDING_LIST="${BINDING_LIST} tcl" - BINDING_ALL="${BINDING_ALL} all-tcl" - BINDING_CHECK="${BINDING_CHECK} check-tcl" - BINDING_CLEAN="${BINDING_CLEAN} clean-tcl" - BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-tcl" - BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-tcl" - BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-tcl" - BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)" -fi -AM_CONDITIONAL(ENABLE_TCL, test x"${build_tcl}" = "xyes") -AC_SUBST(TCL_LIB_SPEC) -AC_SUBST(TCL_INCLUDE_SPEC) -AC_SUBST(TCL_SHLIB_SUFFIX) +dnl SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG from macros/tcl.m4 +AS_IF([test x"${build_tcl}" = "xyes"],[ + SC_PATH_TCLCONFIG + SC_LOAD_TCLCONFIG + tcl_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC" + AC_CHECK_HEADERS([tcl.h], + [], + [AC_MSG_ERROR([Unable to find Tcl headers])]) + CPPFLAGS=$tcl_save_CPPFLAGS + + BINDING_LIST="${BINDING_LIST} tcl" + BINDING_ALL="${BINDING_ALL} all-tcl" + BINDING_CHECK="${BINDING_CHECK} check-tcl" + BINDING_CLEAN="${BINDING_CLEAN} clean-tcl" + BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-tcl" + BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-tcl" + BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-tcl" + BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)"]) + + +AM_CONDITIONAL([ENABLE_TCL], [test x"${build_tcl}" = "xyes"]) +AC_SUBST([TCL_LIB_SPEC]) +AC_SUBST([TCL_INCLUDE_SPEC]) +AC_SUBST([TCL_SHLIB_SUFFIX]) + + +dnl Not sure where this goes... # TODO: require "${ac_cv_header_sys_socket_h}" = "no" + dnl Check for python availability, so we can enable HamlibPy +# Python bindings +AC_MSG_CHECKING([whether to build python binding and demo]) +AC_ARG_WITH([python-binding], + [AS_HELP_STRING([--with-python-binding], + [build python binding and demo @<:@default=no@:>@])], + [cf_with_python_binding=$withval], + [cf_with_python_binding=no]) +AC_MSG_RESULT([$cf_with_python_binding]) -AC_MSG_CHECKING(whether to build python binding and demo) -AC_ARG_WITH(python-binding, - [ --with-python-binding build python binding and demo], - [cf_with_python_binding=$withval], - [cf_with_python_binding=no]) -AC_MSG_RESULT($cf_with_python_binding) +dnl AX_PYTHON_DEVEL from macros/ax_python_devel.m4 +AS_IF([test "${cf_with_python_binding}" = "yes"],[ + AM_PATH_PYTHON([2.1],, [:]) + AX_PYTHON_DEVEL -if test "${cf_with_python_binding}" = "yes" ; then - AM_PATH_PYTHON([2.1],, [:]) - AC_PYTHON_DEVEL - BINDING_LIST="${BINDING_LIST} python" - BINDING_ALL="${BINDING_ALL} all-py" - BINDING_CHECK="${BINDING_CHECK} check-py" - BINDING_CLEAN="${BINDING_CLEAN} clean-py" - BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-py" - BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-py" - BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-py" - BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(python_ltlib)" -fi -AM_CONDITIONAL(ENABLE_PYTHON, test x"${cf_with_python_binding}" = "xyes") + BINDING_LIST="${BINDING_LIST} python" + BINDING_ALL="${BINDING_ALL} all-py" + BINDING_CHECK="${BINDING_CHECK} check-py" + BINDING_CLEAN="${BINDING_CLEAN} clean-py" + BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-py" + BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-py" + BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-py" + BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(python_ltlib)"]) + +AM_CONDITIONAL([ENABLE_PYTHON], [test x"${cf_with_python_binding}" = "xyes"]) +## ----------------- ## +## Optional backends ## +## ----------------- ## dnl Backend list -# Winradio only under Linux (until someone port it on other os) -AC_MSG_CHECKING(whether to build winradio backend) -AC_ARG_WITH(winradio, - [ --without-winradio do not build winradio backend], - [cf_with_winradio="no"], - [cf_with_winradio="yes"]) -AC_MSG_RESULT($cf_with_winradio) +# Winradio only under Linux (until someone ports it on other os) +AC_MSG_CHECKING([whether to build winradio backend]) +AC_ARG_ENABLE([winradio], + [AS_HELP_STRING([--disable-winradio], + [do not build winradio backend @<:@default=yes@:>@])], + [cf_with_winradio="no"], + [cf_with_winradio="yes"]) +AC_MSG_RESULT([$cf_with_winradio]) -if test "${cf_with_winradio}" = "yes" ; then - BACKEND_LIST="$BACKEND_LIST winradio" -fi - -if test "${cf_with_cxx}" = "yes" ; then - # stuff that requires C++ support - - AC_MSG_CHECKING(whether to build USRP backend) - AC_ARG_WITH(usrp, - [ --with-usrp build USRP backend], - [cf_with_usrp=$withval], - [cf_with_usrp="no"]) - AC_MSG_RESULT($cf_with_usrp) - - if test "${cf_with_usrp}" = "yes" ; then - PKG_CHECK_MODULES(USRP, usrp >= 0.8, - [AC_DEFINE(HAVE_USRP,[1],[Define if usrp is available])]) - fi -fi -AM_CONDITIONAL(ENABLE_CXX, test x"${cf_with_cxx}" = "xyes") -AM_CONDITIONAL(HAVE_USRP, test x"${cf_with_usrp}" = "xyes") +AS_IF([test "${cf_with_winradio}" = "yes"], + [BACKEND_LIST="$BACKEND_LIST winradio"]) -PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1, , - [AC_MSG_WARN([libusb pkg-config not found, USB backends will be disabled])]) +AS_IF([test "${cf_with_cxx}" = "yes"],[ + # stuff that requires C++ support + + AC_MSG_CHECKING([whether to build USRP backend]) + AC_ARG_ENABLE([usrp], + [AS_HELP_STRING([--enable-usrp], + [build USRP backend @<:@default=no@:>@])], + [cf_with_usrp=$enableval], + [cf_with_usrp="no"]) + AC_MSG_RESULT([$cf_with_usrp]) + + AS_IF([test "${cf_with_usrp}" = "yes"],[ + PKG_CHECK_MODULES([USRP], + [usrp >= 0.8], + [AC_DEFINE([HAVE_USRP],[1],[Define if usrp is available]) + ]) + ]) + ]) +AM_CONDITIONAL([ENABLE_CXX], [test x"${cf_with_cxx}" = "xyes"]) +AM_CONDITIONAL([HAVE_USRP], [test x"${cf_with_usrp}" = "xyes"]) + + +PKG_CHECK_MODULES([LIBUSB], [libusb >= 0.1], [], + [AC_MSG_WARN([libusb pkg-config not found, USB backends will be disabled])]) + CFLAGS="${CFLAGS} ${LIBUSB_CFLAGS}" CXXFLAGS="${CXXFLAGS} ${LIBUSB_CFLAGS}" + AC_CHECK_HEADERS([usb.h]) -AC_MSG_CHECKING(whether to build USB backends) -if test x"${LIBUSB_LIBS}" = x; then - cf_with_libusb="no" -else - cf_with_libusb="yes" - AC_DEFINE(HAVE_LIBUSB,[1],[Define if libusb is available]) -fi -AC_MSG_RESULT($cf_with_libusb) +AC_MSG_CHECKING([whether to build USB backends]) + +AS_IF([test x"${LIBUSB_LIBS}" = x], + [cf_with_libusb="no"], + [cf_with_libusb="yes"], + [AC_DEFINE([HAVE_LIBUSB],[1],[Define if libusb is available]) + ]) +AC_MSG_RESULT([$cf_with_libusb]) + + +## -------------------------------- ## +## Prepare rig backend dependencies ## +## -------------------------------- ## -# prepare backend dependencies # otherwise parallel 'make -jn' will fail + for be in ${BACKEND_LIST} ; do - BACKENDEPS="${BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la" + BACKENDEPS="${BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la" done -# prepare backend dependencies -# otherwise parallel 'make -jn' will fail -for be in ${ROT_BACKEND_LIST} ; do - ROT_BACKENDEPS="${ROT_BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la" -done - - # dlopen force or preopen self for static version ? BACKENDLNK="-dlopen force" for be in ${BACKEND_LIST} ; do - BACKENDLNK="${BACKENDLNK} -dlopen \$(top_builddir)/${be}/hamlib-${be}.la" + BACKENDLNK="${BACKENDLNK} -dlopen \$(top_builddir)/${be}/hamlib-${be}.la" +done +AC_SUBST([BACKEND_LIST]) +AC_SUBST([BACKENDLNK]) +AC_SUBST([BACKENDEPS]) + + +## ---------------------------------- ## +## Prepare rotor backend dependencies ## +## ---------------------------------- ## + +# otherwise parallel 'make -jn' will fail + +for be in ${ROT_BACKEND_LIST} ; do + ROT_BACKENDEPS="${ROT_BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la" done -AC_SUBST(BACKEND_LIST) -AC_SUBST(BACKENDLNK) -AC_SUBST(BACKENDEPS) # dlopen force or preopen self for static version ? ROT_BACKENDLNK="-dlopen force" for be in ${ROT_BACKEND_LIST} ; do - ROT_BACKENDLNK="${ROT_BACKENDLNK} -dlopen \$(top_builddir)/${be}/hamlib-${be}.la" + ROT_BACKENDLNK="${ROT_BACKENDLNK} -dlopen \$(top_builddir)/${be}/hamlib-${be}.la" done -AC_SUBST(ROT_BACKEND_LIST) -AC_SUBST(ROT_BACKENDLNK) -AC_SUBST(ROT_BACKENDEPS) +AC_SUBST([ROT_BACKEND_LIST]) +AC_SUBST([ROT_BACKENDLNK]) +AC_SUBST([ROT_BACKENDEPS]) -AC_CHECK_PROG(cf_with_bindings, [swig], [yes], [no], [$PATH]) -if test "${cf_with_bindings}" = "yes"; -then - cf_with_bindings=no - SWIG_PROG(1.3.22) - if test "${SWIG}" != "false" -a "x${BINDING_ALL}" != "x"; then - BINDINGS="${BINDINGS} bindings" - cf_with_bindings=yes - fi -fi -AC_MSG_CHECKING(whether to build bindings) -AC_MSG_RESULT($cf_with_bindings) -AC_SUBST(BINDINGS) -AC_SUBST(BINDING_ALL) -AC_SUBST(BINDING_CHECK) -AC_SUBST(BINDING_CLEAN) -AC_SUBST(BINDING_DISTCLEAN) -AC_SUBST(BINDING_DISTCHECK) -AC_SUBST(BINDING_INSTALL_EXEC) -AC_SUBST(BINDING_UNINSTALL) -AC_SUBST(BINDING_LIST) -AC_SUBST(BINDING_LIB_TARGETS) +AC_CHECK_PROG([cf_with_bindings], [swig], [yes], [no], [$PATH]) +AS_IF([test "${cf_with_bindings}" = "yes"], [ + cf_with_bindings=no -AC_SUBST(AM_CPPFLAGS) + SWIG_PROG(1.3.22) + AS_IF([test "${SWIG}" != "false" -a "x${BINDING_ALL}" != "x"], [ + BINDINGS="${BINDINGS} bindings" + cf_with_bindings=yes]) + ]) + +AC_MSG_CHECKING([whether to build bindings]) +AC_MSG_RESULT([$cf_with_bindings]) +AC_SUBST([BINDINGS]) +AC_SUBST([BINDING_ALL]) +AC_SUBST([BINDING_CHECK]) +AC_SUBST([BINDING_CLEAN]) +AC_SUBST([BINDING_DISTCLEAN]) +AC_SUBST([BINDING_DISTCHECK]) +AC_SUBST([BINDING_INSTALL_EXEC]) +AC_SUBST([BINDING_UNINSTALL]) +AC_SUBST([BINDING_LIST]) +AC_SUBST([BINDING_LIB_TARGETS]) + +AC_SUBST([AM_CPPFLAGS]) AC_CONFIG_FILES([Makefile macros/Makefile @@ -531,8 +672,8 @@ adat/Makefile ts7400/Makefile celestron/Makefile scripts/Makefile -hamlib.pc] -) +hamlib.pc]) + AC_OUTPUT echo \ @@ -540,20 +681,20 @@ echo \ ${PACKAGE_NAME} Version ${PACKAGE_VERSION} configuration: - Prefix ${prefix} - Compiler ${CC} ${CFLAGS} ${CPPFLAGS} + Prefix ${prefix} + Compiler ${CC} ${CFLAGS} ${CPPFLAGS} Package features: - With C++ binding ${cf_with_cxx_binding} - With Perl binding ${cf_with_perl_binding} - With Python binding ${cf_with_python_binding} - With TCL binding ${build_tcl} - Enable Rig Matrix ${enable_rigmatrix} - Enable WinRadio ${cf_with_winradio} - Enable USRP ${cf_with_usrp} - Enable USB backends ${cf_with_libusb} - Enable shared libs ${enable_shared} - Enable static libs ${enable_static} + With C++ binding ${cf_with_cxx_binding} + With Perl binding ${cf_with_perl_binding} + With Python binding ${cf_with_python_binding} + With TCL binding ${build_tcl} + Enable Rig Matrix ${enable_rigmatrix} + Enable WinRadio ${cf_with_winradio} + Enable USRP ${cf_with_usrp} + Enable USB backends ${cf_with_libusb} + Enable shared libs ${enable_shared} + Enable static libs ${enable_static} -----------------------------------------------------------------------" diff --git a/macros/Makefile.am b/macros/Makefile.am index 84fea0f94..20478059e 100644 --- a/macros/Makefile.am +++ b/macros/Makefile.am @@ -2,14 +2,15 @@ MACROS = \ aclocal-include.m4 \ - acx_pthread.m4 \ - lf_warnings.m4 \ + ax_append_flag.m4 \ + ax_cflags_warn_all.m4 \ + ax_pthread.m4 \ + ax_python_devel.m4 \ gr_doxygen.m4 \ gr_pwin32.m4 \ gr_swig.m4 \ hl_getaddrinfo.m4 \ perl.m4 \ - ac_python_devel.m4 \ tcl.m4 diff --git a/macros/ax_append_flag.m4 b/macros/ax_append_flag.m4 new file mode 100644 index 000000000..1d38b76fb --- /dev/null +++ b/macros/ax_append_flag.m4 @@ -0,0 +1,69 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) +# +# DESCRIPTION +# +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space +# added in between. +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly +# FLAG. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_APPEND_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl +AS_VAR_SET_IF(FLAGS, + [case " AS_VAR_GET(FLAGS) " in + *" $1 "*) + AC_RUN_LOG([: FLAGS already contains $1]) + ;; + *) + AC_RUN_LOG([: FLAGS="$FLAGS $1"]) + AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"]) + ;; + esac], + [AS_VAR_SET(FLAGS,["$1"])]) +AS_VAR_POPDEF([FLAGS])dnl +])dnl AX_APPEND_FLAG diff --git a/macros/ax_cflags_warn_all.m4 b/macros/ax_cflags_warn_all.m4 new file mode 100644 index 000000000..0fa3e186b --- /dev/null +++ b/macros/ax_cflags_warn_all.m4 @@ -0,0 +1,122 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# +# DESCRIPTION +# +# Try to find a compiler option that enables most reasonable warnings. +# +# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result +# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default. +# +# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX, +# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and +# Intel compilers. For a given compiler, the Fortran flags are much more +# experimental than their C equivalents. +# +# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS +# - $2 add-value-if-not-found : nothing +# - $3 action-if-found : add value to shellvariable +# - $4 action-if-not-found : nothing +# +# NOTE: These macros depend on AX_APPEND_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2010 Rhys Ulerich +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 14 + +AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl +AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl +AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl +AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], +VAR,[VAR="no, unknown" +ac_save_[]FLAGS="$[]FLAGS" +for ac_arg dnl +in "-warn all % -warn all" dnl Intel + "-pedantic % -Wall" dnl GCC + "-xstrconst % -v" dnl Solaris C + "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix + "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX + "-ansi -ansiE % -fullwarn" dnl IRIX + "+ESlit % +w1" dnl HP-UX C + "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) + "-h conform % -h msglevel 2" dnl Cray C (Unicos) + # +do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) +done +FLAGS="$ac_save_[]FLAGS" +]) +AS_VAR_POPDEF([FLAGS])dnl +AC_REQUIRE([AX_APPEND_FLAG]) +case ".$VAR" in + .ok|.ok,*) m4_ifvaln($3,$3) ;; + .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; + *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;; +esac +AS_VAR_POPDEF([VAR])dnl +])dnl AX_FLAGS_WARN_ALL +dnl implementation tactics: +dnl the for-argument contains a list of options. The first part of +dnl these does only exist to detect the compiler - usually it is +dnl a global option to enable -ansi or -extrawarnings. All other +dnl compilers will fail about it. That was needed since a lot of +dnl compilers will give false positives for some option-syntax +dnl like -Woption or -Xoption as they think of it is a pass-through +dnl to later compile stages or something. The "%" is used as a +dnl delimiter. A non-option comment can be given after "%%" marks +dnl which will be shown but not added to the respective C/CXXFLAGS. + +AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([C]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([C]) +]) + +AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([C++]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([C++]) +]) + +AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([Fortran]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([Fortran]) +]) diff --git a/macros/ac_python_devel.m4 b/macros/ax_python_devel.m4 similarity index 95% rename from macros/ac_python_devel.m4 rename to macros/ax_python_devel.m4 index 261040511..a62b860de 100644 --- a/macros/ac_python_devel.m4 +++ b/macros/ax_python_devel.m4 @@ -1,10 +1,10 @@ # =========================================================================== -# http://autoconf-archive.cryp.to/ac_python_devel.html +# http://www.gnu.org/software/autoconf-archive/ax_python_devel.html # =========================================================================== # # SYNOPSIS # -# AC_PYTHON_DEVEL([version]) +# AX_PYTHON_DEVEL([version]) # # DESCRIPTION # @@ -66,7 +66,10 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -AC_DEFUN([AC_PYTHON_DEVEL],[ +#serial 8 + +AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) +AC_DEFUN([AX_PYTHON_DEVEL],[ # # Allow the use of a (user set) custom python version # @@ -116,7 +119,7 @@ to something else than an empty string. ver = sys.version.split ()[[0]]; \ print (ver $1)"` if test "$ac_supports_python_ver" = "True"; then - AC_MSG_RESULT([yes]) + AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) AC_MSG_ERROR([this package requires Python $1. @@ -149,9 +152,9 @@ $ac_distutils_result]) AC_MSG_CHECKING([for Python include path]) if test -z "$PYTHON_CPPFLAGS"; then python_path=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_inc ());"` + print (distutils.sysconfig.get_python_inc ());"` if test -n "${python_path}"; then - python_path="-I$python_path" + python_path="-I$python_path" fi PYTHON_CPPFLAGS=$python_path fi @@ -251,7 +254,7 @@ EOD` AC_MSG_CHECKING([for Python site-packages path]) if test -z "$PYTHON_SITE_PKG"; then PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_lib(0,0));"` + print (distutils.sysconfig.get_python_lib(0,0));"` fi AC_MSG_RESULT([$PYTHON_SITE_PKG]) AC_SUBST([PYTHON_SITE_PKG]) @@ -260,12 +263,10 @@ EOD` # libraries which must be linked in when embedding # AC_MSG_CHECKING(python extra libraries) - # Do not reference LOCALMODLIBS, else it will add libraries to our - # link line (e.g -lssl) which are not necessarily installed. if test -z "$PYTHON_EXTRA_LIBS"; then PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ - print (conf('LIBS'))"` + print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"` fi AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) AC_SUBST(PYTHON_EXTRA_LIBS) @@ -287,6 +288,8 @@ EOD` # AC_MSG_CHECKING([consistency of all components of python development environment]) # save current global flags + ac_save_LIBS="$LIBS" + ac_save_CPPFLAGS="$CPPFLAGS" LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS" CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" AC_LANG_PUSH([C]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 93799a028..0243730db 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -35,13 +35,13 @@ dumpmem_LDFLAGS = @BACKENDLNK@ testrig_LDFLAGS = @BACKENDLNK@ rig_bench_LDFLAGS = $(top_builddir)/lib/libmisc.la @BACKENDLNK@ testtrn_LDFLAGS = @BACKENDLNK@ -rigctl_LDFLAGS = @BACKENDLNK@ -rigswr_LDFLAGS = @BACKENDLNK@ -rigsmtr_LDFLAGS = @BACKENDLNK@ -rigmem_LDFLAGS = @BACKENDLNK@ @LIBXML2_LIBS@ -rotctl_LDFLAGS = @ROT_BACKENDLNK@ -rigctld_LDFLAGS = @BACKENDLNK@ @PTHREAD_LIBS@ @NET_LIBS@ -rotctld_LDFLAGS = @ROT_BACKENDLNK@ @PTHREAD_LIBS@ @NET_LIBS@ +rigctl_LDFLAGS = @BACKENDLNK@ @WINEXELDFLAGS@ +rigswr_LDFLAGS = @BACKENDLNK@ @WINEXELDFLAGS@ +rigsmtr_LDFLAGS = @BACKENDLNK@ @WINEXELDFLAGS@ +rigmem_LDFLAGS = @BACKENDLNK@ @LIBXML2_LIBS@ @WINEXELDFLAGS@ +rotctl_LDFLAGS = @ROT_BACKENDLNK@ @WINEXELDFLAGS@ +rigctld_LDFLAGS = @BACKENDLNK@ @PTHREAD_LIBS@ @NET_LIBS@ @WINEXELDFLAGS@ +rotctld_LDFLAGS = @ROT_BACKENDLNK@ @PTHREAD_LIBS@ @NET_LIBS@ @WINEXELDFLAGS@ # temporary hack testbcd_LDFLAGS = -dlpreopen self