1## Process this file with autoconf to create configure. -*- autoconf -*- 2 3dnl Autoconf 2.67 is in Debian Squeeze--is an older version needed 4dnl for some other distribution? 5## FIXME: Is this too new? ## 6AC_PREREQ([2.69]) 7 8 9## ------------------------ ## 10## Autoconf initialisation. ## 11## ------------------------ ## 12 13dnl Please do not use '-' in the version number, as package managers will fail, 14dnl however, the use of '~' should be fine as apt (others?) will treat 15dnl it as an earlier version than the actual release. TNX KA6MAL 16dnl PACKAGE_NAME + " " + PACKAGE_VERSION must not exceed 20 chars! 17AC_INIT([Hamlib],[4.3.1],[hamlib-developer@lists.sourceforge.net],[hamlib],[http://www.hamlib.org]) 18 19AC_CONFIG_SRCDIR([include/hamlib/rig.h]) 20AC_CONFIG_MACRO_DIR([macros]) 21AC_CONFIG_HEADERS([include/config.h]) 22 23dnl Place build system provided programs in this directory. 24AC_CONFIG_AUX_DIR([build-aux]) 25 26AC_USE_SYSTEM_EXTENSIONS 27 28 29## ------------------------ ## 30## Automake Initialisation. ## 31## ------------------------ ## 32 33dnl Passing AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION to AM_INIT_AUTOMAKE is 34dnl obsolete as these values are obtained from the AC_INIT macro. 35AM_INIT_AUTOMAKE([-Wall subdir-objects]) 36 37dnl Clean compilation output makes compiler warnings more visible 38m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 39 40 41## ------------------------------ ## 42## Hamlib specific configuration. ## 43## ------------------------------ ## 44 45dnl New backends must be listed here! Also the new Makefile path must be 46dnl added to AC_CONFIG_FILES near the end of this file. See README.developer 47dnl Beware of duplication should a backend directory include both rig and 48dnl rotor definitions, e.g. "dummy". Optional backends will not be listed 49dnl here but will be added later, e.g. "winradio". 50RIG_BACKEND_LIST="rigs/adat rigs/alinco rigs/aor rigs/barrett rigs/dorji rigs/drake rigs/dummy rigs/elad rigs/flexradio rigs/icom rigs/icmarine rigs/jrc rigs/kachina rigs/kenwood rigs/kit rigs/lowe rigs/pcr rigs/prm80 rigs/racal rigs/rft rigs/rs rigs/skanti rigs/tapr rigs/tentec rigs/tuner rigs/uniden rigs/winradio rigs/wj rigs/yaesu" 51ROT_BACKEND_LIST="rotators/amsat rotators/ars rotators/celestron rotators/cnctrk rotators/easycomm rotators/ether6 rotators/fodtrack rotators/gs232a rotators/heathkit rotators/m2 rotators/meade rotators/rotorez rotators/sartek rotators/spid rotators/ts7400 rotators/prosistel rotators/ioptron rotators/satel rotators/radant" 52# Amplifiers are all in the amplifiers directory 53AMP_BACKEND_LIST="amplifiers/elecraft" 54 55dnl See README.release on setting these values 56# Values given to -version-info when linking. See libtool documentation. 57# Set them here to keep c++/Makefile and src/Makefile in sync. 58ABI_VERSION=4 59ABI_REVISION=3 60ABI_AGE=0 61 62AC_DEFINE_UNQUOTED([ABI_VERSION], [$ABI_VERSION], [Frontend ABI version]) 63AC_DEFINE_UNQUOTED([ABI_REVISION], [$ABI_REVISION], [Frontend ABI revision]) 64AC_DEFINE_UNQUOTED([ABI_AGE], [$ABI_AGE], [Frontend ABI age]) 65 66AC_SUBST([ABI_VERSION]) 67AC_SUBST([ABI_REVISION]) 68AC_SUBST([ABI_AGE]) 69 70# Add Hamlib define needed to link DLLs 71AM_CPPFLAGS="${AM_CPPFLAGS} -DIN_HAMLIB" 72 73# Add Hamlib header include paths 74AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/include -I\$(top_srcdir)/src -I\$(top_srcdir)/lib" 75 76 77## --------------- ## 78## Program checks ## 79## --------------- ## 80 81dnl Checks for programs. 82AC_PROG_CC 83AC_PROG_CXX 84AC_PROG_CPP 85AC_PROG_AWK 86AC_PROG_INSTALL 87AC_PROG_LN_S 88 89# TODO: check whether CXX is functional 90AC_PATH_PROG([cf_with_cxx], ["${CXX}"], [yes], [no]) 91 92AM_CONDITIONAL([ENABLE_CXX], [test x"${cf_with_cxx}" = "xyes"]) 93 94dnl Broke on older Automake, so test for its existence. 95m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 96 97 98## ----------------------------------- ## 99## Miscellaneous configuration macros ## 100## ----------------------------------- ## 101 102AC_C_INLINE 103 104dnl Set warnings for compilation 105dnl CFLAGS and CXXFLAGS are reserved for user, so set their AM_* counterparts. 106# macros/ax_cflags_warn_all.m4 107AX_CFLAGS_WARN_ALL([AM_CFLAGS]) 108AX_CXXFLAGS_WARN_ALL([AM_CXXFLAGS]) 109 110dnl Automake macro for rigmem compilation 111AM_PROG_CC_C_O 112 113 114## ------------------------------------------ ## 115## Various parts of Hamlib need these headers ## 116## ------------------------------------------ ## 117 118AC_CHECK_HEADERS([errno.h fcntl.h getopt.h limits.h locale.h malloc.h \ 119netdb.h sgtty.h stddef.h termio.h termios.h values.h \ 120arpa/inet.h dev/ppbus/ppbconf.hdev/ppbus/ppi.h \ 121linux/hidraw.h linux/ioctl.h linux/parport.h linux/ppdev.h netinet/in.h \ 122sys/ioccom.h sys/ioctl.h sys/param.h sys/socket.h sys/stat.h sys/time.h \ 123sys/select.h glob.h ]) 124 125dnl set host_os variable 126AC_CANONICAL_HOST 127 128dnl ws2tcpip.h not provided by cygwin and its test causes a configure warning. 129dnl wspiapi.h provides needed freeaddrinfo function on W2k systems. 130AS_IF([test "${host_os}" != "cygwin"], [ 131 AC_CHECK_HEADERS([ws2tcpip.h wspiapi.h]) 132]) 133 134 135## ------------------------------------ ## 136## System capability and library checks ## 137## ------------------------------------ ## 138 139dnl Check for Mingw (Win32 Sleep) support 140# macros/gr_pwin32.m4 141GR_PWIN32 142 143dnl If pthread support is found, this macro defines HAVE_PTHREAD and 144dnl AC_SUBST's PTHREAD_LIBS, PTHREAD_CFLAGS, and PTHREAD_CC making those 145dnl variables available in Makefiles. 146# macros/ax_pthread.m4 147AX_PTHREAD 148 149AC_SYS_POSIX_TERMIOS() 150 151 152dnl Checks for typedefs, structures, and compiler characteristics. 153AC_TYPE_SIZE_T 154AC_CHECK_TYPES([siginfo_t],[],[],[[#include <signal.h>]]) 155AC_CHECK_TYPES([sig_atomic_t],[],[],[[#include <signal.h>]]) 156 157 158dnl Checks for libraries. 159 160# The following comes from SC_TCL_LINK_LIBS 161# we redefine them here because we want a separate NET_LIBS var 162 163#-------------------------------------------------------------------- 164# On a few very rare systems, all of the libm.a stuff is 165# already in libc.a. Set compiler flags accordingly. 166#-------------------------------------------------------------------- 167AC_CHECK_FUNC([sin], [MATH_LIBS=""], [MATH_LIBS="-lm"]) 168AC_SUBST([MATH_LIBS]) 169 170#-------------------------------------------------------------------- 171# Check for the existence of the -lsocket and -lnsl libraries. 172# The order here is important, so that they end up in the right 173# order in the command line generated by make. Here are some 174# special considerations: 175# 1. Use "connect" and "accept" to check for -lsocket, and 176# "gethostbyname" to check for -lnsl. 177# 2. Use each function name only once: cannot redo a check because 178# autoconf caches the results of the last check and will not redo it. 179# 3. Use -lnsl and -lsocket only if they supply procedures that 180# are not already present in the normal libraries. This is because 181# IRIX 5.2 has libraries, but they aren't needed and they're 182# bogus: they goof up name resolution if used. 183# 4. On some SVR4 systems, can't use -lsocket without -lnsl too. 184# To get around this problem, check for both libraries together 185# if -lsocket doesn't work by itself. 186#-------------------------------------------------------------------- 187hl_checkBoth=0 188hl_oldLibs=$LIBS 189 190AC_CHECK_FUNC([connect], [hl_checkSocket=0], [hl_checkSocket=1]) 191 192AS_IF([test "$hl_checkSocket" = 1], [ 193 AC_CHECK_LIB([socket], 194 [main], 195 [NET_LIBS="$NET_LIBS -lsocket"], 196 [hl_checkBoth=1], 197 []) 198 ]) 199 200AS_IF([test "$hl_checkBoth" = 1], [ 201 hl2_oldLibs=$LIBS 202 LIBS="$LIBS -lsocket -lnsl" 203 AC_CHECK_FUNC([accept], [hl_checkNsl=0], [LIBS=$hl2_oldLibs]) 204 ]) 205 206# separate Name Service Library 207AC_CHECK_FUNC([gethostbyname], 208 [], 209 [AC_CHECK_LIB([nsl], 210 [main], 211 [NET_LIBS="$NET_LIBS -lnsl"], 212 [], 213 []) 214 ]) 215 216# Winsock2 32 bit 217AC_CHECK_FUNC([gethostbyname], 218 [], 219 [AC_CHECK_LIB([ws2_32], 220 [main], 221 [NET_LIBS="$NET_LIBS -lws2_32"], 222 [], 223 []) 224 ]) 225 226LIBS="$LIBS $NET_LIBS" 227 228# macros/hl_getaddrinfo.m4 229HL_GETADDRINFO 230 231LIBS=$hl_oldLibs 232AC_SUBST([NET_LIBS]) 233## End Hamlib socket test ## 234 235 236dnl Checks for library functions. 237AC_CHECK_FUNCS([cfmakeraw floor getpagesize getpagesize gettimeofday inet_ntoa \ 238ioctl memchr memmove memset pow rint select setitimer setlocale sigaction signal \ 239snprintf socket sqrt strchr strdup strerror strncasecmp strrchr strstr strtol \ 240glob socketpair ]) 241AC_FUNC_ALLOCA 242 243dnl AC_LIBOBJ replacement functions directory 244AC_CONFIG_LIBOBJ_DIR([lib]) 245 246dnl Use Hamlib's termios 247AC_LIBOBJ([termios]) 248 249dnl Assure libmisc is not empty 250AC_LIBOBJ([dummy]) 251 252 253## ------------------------ ## 254## libtool Initialisation. ## 255## ------------------------ ## 256 257AR_FLAGS="cr" 258LT_PREREQ([2.2.6b]) 259 260dnl N.B. LT_INIT([win32-dll]) does not work for older libtool 261dnl so require new enough version above. 262LT_INIT([win32-dll]) 263 264 265## -------------------------- ## 266## Custom host configurations ## 267## -------------------------- ## 268 269dnl The host_os variable is set by the AC_CANONICAL_HOST macro above. 270AS_CASE(["$host_os"], 271 [freebsd*], [ 272 AM_CPPFLAGS="-I/usr/local/include ${AM_CPPFLAGS}" 273 AM_LDFLAGS="${AM_LDFLAGS} -L/usr/local/lib" 274 AC_SUBST([AM_LDFLAGS])], 275 276 [darwin* | rhapsody*], [ 277 # Tell the OS X linker to allocate enough space inside the 278 # libhamlib.X.dylib shared object for install_name_tool(1) to 279 # work. This is useful when including hamlib in an app bundle. 280 OSXLDFLAGS="-Wl,-headerpad_max_install_names" 281 AC_SUBST([OSXLDFLAGS])], 282 283 [mingw* | pw32* | cygwin*], [ 284 WINLDFLAGS="-Wl,--output-def,libhamlib.def -Wl,--add-stdcall-alias" 285 AC_SUBST([WINLDFLAGS]) 286 287 # Enable ld's "auto import" for executables 288 WINEXELDFLAGS="-Wl,--enable-auto-import" 289 AC_SUBST([WINEXELDFLAGS]) 290 ]) 291 292 293## ---------------------- ## 294## External package tests ## 295## ---------------------- ## 296 297dnl Check if C99 struct initializers are supported 298AC_MSG_CHECKING([whether C99 struct/array initializers are supported]) 299 300AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], 301 [[struct{char a;int b;}s[8]={[3]={.b=5}};]])], 302 [AC_MSG_RESULT(yes)], 303 [AC_MSG_ERROR(["" 304"You need a C99 compliant C compiler that supports struct/array initializers." 305"Have you considered GCC lately?."]) 306 ]) 307 308dnl Check for libusb, treat LIBUSB_LIBS and LIBUSB_CFLAGS as precious variables 309AC_MSG_CHECKING([whether to build USB dependent backends]) 310AC_ARG_WITH([libusb], 311 [AS_HELP_STRING([--without-libusb], 312 [disable USB dependent backends @<:@default=yes@:>@])], 313 [cf_with_libusb=no], 314 [cf_with_libusb=yes] 315 ) 316 317AC_MSG_RESULT([$cf_with_libusb]) 318AM_CONDITIONAL([HAVE_LIBUSB], [test x"${cf_with_libusb}" = "xyes"]) 319 320LIBUSB="" 321AC_ARG_VAR([LIBUSB_CFLAGS], [C compiler flags for libusb, overriding configure defaults]) 322AC_ARG_VAR([LIBUSB_LIBS], [linker flags for libusb, overriding configure check (useful for specifying static libusb-1.0.a (see INSTALL))]) 323 324AS_IF([test x"${cf_with_libusb}" = "xyes"], 325 [AS_IF([test -z $LIBUSB_LIBS], 326 [AC_CHECK_LIB([usb-1.0], [libusb_init], [LIBUSB_LIBS="-lusb-1.0"], 327 [AC_MSG_WARN([libusb_init was not found in libusb-1.0--USB backends will be disabled])]) 328 ], [cf_with_libusb="yes"]) 329 330 AS_IF([test x"${cf_with_libusb}" = "xyes"], 331 [AC_CHECK_HEADERS([libusb.h libusb-1.0/libusb.h]) 332 AC_DEFINE([HAVE_LIBUSB], 333 [1], 334 [Define if libusb-1.0 is available]) 335 LIBUSB="libusb-1.0"])]) 336 337# Only used in hamlib.pc.in 338AC_SUBST([LIBUSB]) 339 340 341dnl Check if readline support in rigctl/rotctl is wanted 342AC_MSG_CHECKING([whether to use readline in rigctl/rotctl]) 343AC_ARG_WITH([readline], 344 [AS_HELP_STRING([--without-readline], 345 [disable readline in rigctl/rotctl @<:@default=yes@:>@])], 346 [cf_with_readline_support=no], 347 [cf_with_readline_support=yes] 348 ) 349 350AC_MSG_RESULT([$cf_with_readline_support]) 351 352AS_IF([test x"$cf_with_readline_support" != "xno"], [ 353 # macros/ax_lib_readline.m4 354 AX_LIB_READLINE 355 ]) 356 357AS_IF([test x"$ax_cv_lib_readline" = "xno"], [ 358 AC_MSG_WARN([readline support not found, using internal input handling.]) 359 cf_with_readline_support=no 360 ]) 361 362dnl Check if INDI support in rigctl/rotctl is wanted 363AC_MSG_CHECKING([whether to use INDI in rigctl/rotctl]) 364AC_ARG_WITH([indi], 365 [AS_HELP_STRING([--without-indi], 366 [disable INDI in rigctl/rotctl @<:@default=yes@:>@])], 367 [cf_with_indi_support=no], 368 [cf_with_indi_support=yes] 369 ) 370 371AS_IF([test x"$cf_with_indi_support" != "xno"], [ 372 # INDI support needs a C++ compiler, tested for presence above. 373 AS_IF([test x"${cf_with_cxx}" != "xyes"], [ 374 AC_MSG_WARN([INDI support needs a C++ compiler.]) 375 cf_with_indi_support=no 376 ]) 377]) 378 379AS_IF([test x"$cf_with_indi_support" != "xno"], [ 380 # macros/ax_lib_nova.m4 381 AX_LIB_NOVA 382 383 AS_IF([test x"$ax_cv_lib_nova" = "xno"], [ 384 AC_MSG_WARN([libnova support not found, required by INDI.]) 385 cf_with_indi_support=no 386 ]) 387 388 AS_IF([test x"$ax_cv_lib_nova" != "xno"], [ 389 # macros/ax_lib_indi.m4 390 AX_LIB_INDI 391 392 AS_IF([test x"$ax_cv_lib_indi" = "xno"], [ 393 AC_MSG_WARN([INDI support not found.]) 394 cf_with_indi_support=no 395 ]) 396 397 AS_IF([test x"$cf_with_indi_support" != "xno"], [ 398 ROT_BACKEND_LIST="$ROT_BACKEND_LIST rotators/indi" 399 ]) 400 ]) 401]) 402 403dnl Check if libgd-dev is installed, so we can enable rigmatrix 404AC_MSG_CHECKING([whether to build HTML rig feature matrix]) 405AC_ARG_ENABLE([html-matrix], 406 [AS_HELP_STRING([--disable-html-matrix], 407 [do not generate HTML rig feature matrix (requires libgd-dev) @<:@default=check@:>@])], 408 [cf_enable_html_matrix=no], 409 [cf_enable_html_matrix=check] 410 ) 411 412AC_MSG_RESULT([$cf_enable_html_matrix]) 413 414AS_IF([test x"$cf_enable_html_matrix" != "xno"], 415 [AC_CHECK_HEADERS([gd.h], 416 [AC_CHECK_LIB([gd], 417 [gdImageCreate], 418 [cf_enable_html_matrix=yes], 419 [cf_enable_html_matrix=no], 420 [-lz])], 421 [cf_enable_html_matrix=no] 422 ) 423 ]) 424 425AM_CONDITIONAL([HTML_MATRIX], [test x"${cf_enable_html_matrix}" = "xyes"]) 426 427 428## ------------------ ## 429## PKG Config support ## 430## ------------------ ## 431 432dnl These features rely on the external pkg-config functionality being available. 433dnl Test for pkg-config only when these features are enabled. 434 435# libxml2 required rigmem xml support, make it user optional 436AC_MSG_CHECKING([whether to build rigmem XML support]) 437AC_ARG_WITH([xml-support], 438 [AS_HELP_STRING([--with-xml-support], 439 [build rigmem with XML support @<:@default=no@:>@])], 440 [cf_with_xml_support=$withval], 441 [cf_with_xml_support=no]) 442AC_MSG_RESULT([$cf_with_xml_support]) 443 444 445# USRP needs a C++ compiler, tested for presence above. 446AS_IF([test x"${cf_with_cxx}" = "xyes"], [ 447 AC_MSG_CHECKING([whether to build USRP backend]) 448 AC_ARG_ENABLE([usrp], 449 [AS_HELP_STRING([--enable-usrp], 450 [build USRP backend @<:@default=no@:>@])], 451 [cf_with_usrp=$enableval], 452 [cf_with_usrp="no"]) 453 AC_MSG_RESULT([$cf_with_usrp]) 454 ]) 455 456dnl Only check for pkg-config when either of the dependent features are enabled. 457 458AS_IF([test x"${cf_with_xml_support}" = "xyes" || test x"${cf_with_usrp}" = "xyes"], [ 459dnl Check for pkg-config presence and if not installed define a dummy macro 460dnl to disable libxml2 and USRP use. Code borrowed from: 461dnl http://lists.gnu.org/archive/html/automake/2011-03/msg00008.html 462dnl 463dnl Check for pkg-config program, used for configuring some libraries. 464 m4_define_default([PKG_PROG_PKG_CONFIG], 465 [AC_MSG_CHECKING([pkg-config]) 466 AC_MSG_RESULT([no])]) 467 468 PKG_PROG_PKG_CONFIG 469 470dnl If the pkg-config autoconf support isn't installed, define its 471dnl autoconf macro to disable any packages depending on it. 472 m4_define_default([PKG_CHECK_MODULES], 473 [AC_MSG_CHECKING([$1]) 474 AC_MSG_RESULT([no]) 475 $4]) 476 ]) 477 478 479AS_IF([test x"${cf_with_xml_support}" = "xyes"], [ 480 PKG_CHECK_MODULES([LIBXML2], 481 [libxml-2.0], 482 [AC_DEFINE([HAVE_XML2], 483 [1], 484 [Define if libxml2 is available])], 485 [AC_MSG_WARN([libxml-2.0 pkg-config not found, XML support will be disabled]) 486 ]) 487 ]) 488 489AC_SUBST([LIBXML2_LIBS]) 490AC_SUBST([LIBXML2_CFLAGS]) 491 492 493## ----------------- ## 494## Language bindings ## 495## ----------------- ## 496 497BINDINGS="" 498BINDING_ALL="" 499BINDING_CHECK="" 500BINDING_CLEAN="" 501BINDING_DISTCLEAN="" 502BINDING_DISTCHECK="" 503BINDING_INSTALL_EXEC="" 504BINDING_UNINSTALL="" 505BINDING_LIST="" 506BINDING_LIB_TARGETS="" 507 508 509dnl Check if cxx-binding not wanted, default is to build it 510 511# C++ binding 512AC_MSG_CHECKING([whether to build C++ binding]) 513AC_ARG_WITH([cxx-binding], 514 [AS_HELP_STRING([--without-cxx-binding], 515 [do not build C++ binding @<:@default=yes@:>@])], 516 [cf_with_cxx_binding=$withval], 517 [cf_with_cxx_binding=$cf_with_cxx]) 518AC_MSG_RESULT([$cf_with_cxx_binding]) 519 520AS_IF([test x"${cf_with_cxx_binding}" = "xyes"], 521 [BINDINGS="${BINDINGS} c++"]) 522 523 524dnl Check if perl-binding is wanted, default is to not build it 525 526# Perl binding 527AC_MSG_CHECKING([whether to build perl binding]) 528AC_ARG_WITH([perl-binding], 529 [AS_HELP_STRING([--with-perl-binding], 530 [build perl binding @<:@default=no@:>@])], 531 [cf_with_perl_binding=$withval], 532 [cf_with_perl_binding=no]) 533AC_MSG_RESULT([$cf_with_perl_binding]) 534 535dnl SC_PATH_PERLINC from macros/perl.m4 536AS_IF([test x"${cf_with_perl_binding}" = "xyes"],[ 537 SC_PATH_PERLINC 538 BINDING_LIST="${BINDING_LIST} perl" 539 BINDING_ALL="${BINDING_ALL} all-perl" 540 BINDING_CHECK="${BINDING_CHECK} check-perl" 541 BINDING_CLEAN="${BINDING_CLEAN} clean-perl" 542 BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-perl" 543 BINDING_DISTCHECK="${BINDING_DISTCHECK} distcheck-perl" 544 BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-perl" 545 BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-perl" 546 ]) 547 548AM_CONDITIONAL([ENABLE_PERL], [test x"${cf_with_perl_binding}" = "xyes"]) 549 550 551dnl Check for python availability, so we can enable HamlibPy 552# Python bindings 553AC_MSG_CHECKING([whether to build python binding]) 554AC_ARG_WITH([python-binding], 555 [AS_HELP_STRING([--with-python-binding], 556 [build python binding @<:@default=no@:>@])], 557 [cf_with_python_binding=$withval], 558 [cf_with_python_binding=no]) 559AC_MSG_RESULT([$cf_with_python_binding]) 560 561dnl AX_PYTHON_DEVEL from macros/ax_python_devel.m4 562AS_IF([test x"${cf_with_python_binding}" = "xyes"],[ 563 dnl Order matters! AX_PYTHON_DEVEL must be first for PYTHON_VERSION to be honored. 564 AX_PYTHON_DEVEL([">='2.1'"]) 565 AM_PATH_PYTHON([2.1],, [:]) 566 567 BINDING_LIST="${BINDING_LIST} python" 568 BINDING_ALL="${BINDING_ALL} all-py" 569 BINDING_CHECK="${BINDING_CHECK} check-py" 570 BINDING_CLEAN="${BINDING_CLEAN} clean-py" 571 BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-py" 572 BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-py" 573 BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-py" 574 BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(python_ltlib)"]) 575 576AM_CONDITIONAL([ENABLE_PYTHON], [test x"${cf_with_python_binding}" = "xyes"]) 577 578dnl Determine whether to install pytest.py or py3test.py to $(docdir)/examples 579AM_PYTHON_CHECK_VERSION([${PYTHON}], [3.0], [pyver_3="yes"], [pyver_3="no"]) 580AM_CONDITIONAL([PYVER_3], [test x"${pyver_3}" = x"yes"]) 581 582# Tcl binding 583AC_MSG_CHECKING([Whether to build Tcl bindings]) 584AC_ARG_WITH([tcl-binding], 585 [AS_HELP_STRING([--with-tcl-binding], 586 [build Tcl binding @<:@default=no@:>@])], 587 [build_tcl=$withval], 588 [build_tcl=no]) 589AC_MSG_RESULT([$build_tcl]) 590 591dnl SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG from macros/tcl.m4 592AS_IF([test x"${build_tcl}" = "xyes"],[ 593 dnl Search for and load tclConfig.sh. 594 SC_PATH_TCLCONFIG 595 SC_LOAD_TCLCONFIG 596 597 tcl_save_CPPFLAGS=$CPPFLAGS 598 CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC" 599 AC_CHECK_HEADERS([tcl.h], 600 [], 601 [AC_MSG_ERROR([Unable to find Tcl headers])]) 602 CPPFLAGS=$tcl_save_CPPFLAGS 603 604 BINDING_LIST="${BINDING_LIST} tcl" 605 BINDING_ALL="${BINDING_ALL} all-tcl" 606 BINDING_CHECK="${BINDING_CHECK} check-tcl" 607 BINDING_CLEAN="${BINDING_CLEAN} clean-tcl" 608 BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-tcl" 609 BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-tcl" 610 BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-tcl" 611 BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)"]) 612 613AM_CONDITIONAL([ENABLE_TCL], [test x"${build_tcl}" = "xyes"]) 614dnl These variables are set once tclConfig.sh is loaded. 615AC_SUBST([TCL_VERSION]) 616AC_SUBST([TCL_LIB_SPEC]) 617AC_SUBST([TCL_INCLUDE_SPEC]) 618AC_SUBST([TCL_SHLIB_SUFFIX]) 619 620 621dnl Check for lua availability, so we can enable HamlibLua 622# Lua bindings 623AC_MSG_CHECKING([whether to build lua binding]) 624AC_ARG_WITH([lua-binding], 625 [AS_HELP_STRING([--with-lua-binding], 626 [build lua binding @<:@default=no@:>@])], 627 [cf_with_lua_binding=$withval], 628 [cf_with_lua_binding=no]) 629AC_MSG_RESULT([$cf_with_lua_binding]) 630 631dnl AX_LUA_DEVEL from macros/ax_lua_devel.m4 632AS_IF([test x"${cf_with_lua_binding}" = "xyes"],[ 633 634 AX_PROG_LUA([5.2], [5.5]) 635 AX_LUA_HEADERS 636 AX_LUA_LIBS 637 638 BINDING_LIST="${BINDING_LIST} lua" 639 BINDING_ALL="${BINDING_ALL} all-lua" 640 BINDING_CHECK="${BINDING_CHECK} check-lua" 641 BINDING_CLEAN="${BINDING_CLEAN} clean-lua" 642 BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-lua" 643 BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-lua" 644 BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-lua" 645 BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(lua_ltlib)"]) 646 647AM_CONDITIONAL([ENABLE_LUA], [test x"${cf_with_lua_binding}" = "xyes"]) 648 649 650dnl Only search for Swig if one or more bindings are enabled. 651AS_IF([test "x${BINDING_ALL}" != "x"], 652 [# macros/ax_pkg_swig.m4 653 AX_PKG_SWIG([3.0.12], 654 [BINDINGS="${BINDINGS} bindings" 655 cf_with_bindings="yes"], 656 [AC_MSG_ERROR([SWIG is required to build bindings...]) 657 ])], 658 [cf_with_bindings="no"]) 659 660AC_MSG_CHECKING([whether to build bindings]) 661AC_MSG_RESULT([$cf_with_bindings]) 662 663AC_SUBST([BINDINGS]) 664AC_SUBST([BINDING_ALL]) 665AC_SUBST([BINDING_CHECK]) 666AC_SUBST([BINDING_CLEAN]) 667AC_SUBST([BINDING_DISTCLEAN]) 668AC_SUBST([BINDING_DISTCHECK]) 669AC_SUBST([BINDING_INSTALL_EXEC]) 670AC_SUBST([BINDING_UNINSTALL]) 671AC_SUBST([BINDING_LIST]) 672AC_SUBST([BINDING_LIB_TARGETS]) 673 674 675## ----------------- ## 676## Optional backends ## 677## ----------------- ## 678 679dnl Winradio only under Linux (until someone ports it on other os) 680AC_MSG_CHECKING([whether to build winradio backend]) 681AC_ARG_ENABLE([winradio], 682 [AS_HELP_STRING([--disable-winradio], 683 [do not build winradio backend @<:@default=yes@:>@])], 684 [cf_with_winradio="no"], 685 [cf_with_winradio="yes" AC_DEFINE([HAVE_WINRADIO],[1],[Define if winradio backend is built])]) 686AC_MSG_RESULT([$cf_with_winradio]) 687 688DL_LIBS="" 689 690AS_IF([test x"${cf_with_winradio}" = "xyes"], 691 [RIGS_BACKEND_LIST="$RIGS_BACKEND_LIST rigs/winradio" 692dnl Check for libdl and set DL_LIBS if found--used for linradio WR-G313 backend. 693 AC_CHECK_LIB([dl], [dlopen], [DL_LIBS="-ldl"], 694 [AC_MSG_WARN([dlopen was not found in libdl--linradio backend will be disabled])]) 695 ]) 696 697# Still need -ldl if we have it 698AS_IF([test x"${cf_with_winradio}" = "xno"], 699 [RIGS_BACKEND_LIST="$RIGS_BACKEND_LIST" 700dnl Check for libdl and set DL_LIBS if found--used for linradio WR-G313 backend. 701 AC_CHECK_LIB([dl], [dlopen], [DL_LIBS="-ldl"], 702 [AC_MSG_WARN([dlopen was not found in libdl--linradio backend will be disabled])]) 703 ]) 704 705dnl Set conditional compilation for G-313. 706AS_CASE(["$host_os"], 707 [mingw* | pw32* | cygwin ], [ 708 AM_CONDITIONAL(G313_LINUX_GNU, false) 709 AM_CONDITIONAL(G313_WINDOWS, true) 710 ], 711dnl As g313-posix.c has a hard dependency on linux/types.h 712dnl via linradio/wrg313api.h, disable compilation on other POSIX. 713dnl (Certain systems have extra characters following "-gnu" such as 714dnl the Raspberry Pi which is "linux-gnueabihf"; presume that "linux-gnu" 715dnl is a sufficient test.) 716 [ *linux-gnu* ], [ 717 AM_CONDITIONAL(G313_LINUX_GNU, true) 718 AM_CONDITIONAL(G313_WINDOWS, false) 719 ], 720 [ 721 AM_CONDITIONAL(G313_LINUX_GNU, false) 722 AM_CONDITIONAL(G313_WINDOWS, false) 723 AC_DEFINE([OTHER_POSIX], [1], [Compilation on POSIX other than Linux]) 724 ]) 725 726dnl If libdl is present, check for its header file. 727AS_IF([test x"${DL_LIBS}" = "x-ldl"], 728 [AC_CHECK_HEADERS([dlfcn.h])]) 729 730AC_SUBST([DL_LIBS]) 731 732dnl check for c++11 733AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory]) 734 735 736dnl stuff that requires C++ support 737AS_IF([test x"${cf_with_usrp}" = "xyes"],[ 738 PKG_CHECK_MODULES([USRP], 739 [usrp >= 0.8], 740 [AC_DEFINE([HAVE_USRP],[1],[Define if usrp is available]) 741 ]) 742 ]) 743 744AM_CONDITIONAL([HAVE_USRP], [test x"${cf_with_usrp}" = "xyes"]) 745 746AM_CONDITIONAL(BUILD_OS_IS_UBUNTU, [test x"$build_os" = ubuntu]) 747AM_CONDITIONAL(BUILD_OS_IS_FEDORA, [test x"$build_os" = fedora]) 748echo Build_OS is $build_os 749 750 751 752## -------------------------------- ## 753## Prepare rig backend dependencies ## 754## -------------------------------- ## 755 756dnl otherwise parallel 'make -jn' will fail 757 758## ---------------------------------- ## 759## Prepare rig backend dependencies ## 760## ---------------------------------- ## 761 762for be in ${RIG_BACKEND_LIST} ; do 763 RIGDIR=$(echo $be | awk -F "/" '{print $2}') 764 RIG_BACKENDEPS="${RIG_BACKENDEPS} \$(top_builddir)/rigs/${RIGDIR}/libhamlib-${RIGDIR}.la" 765done 766 767AC_SUBST([RIG_BACKEND_LIST]) 768AC_SUBST([RIG_BACKENDEPS]) 769 770 771## ---------------------------------- ## 772## Prepare rotor backend dependencies ## 773## ---------------------------------- ## 774 775# otherwise parallel 'make -jn' will fail 776 777for be in ${ROT_BACKEND_LIST} ; do 778 ROTDIR=$(echo $be | awk -F "/" '{print $2}') 779 ROT_BACKENDEPS="${ROT_BACKENDEPS} \$(top_builddir)/rotators/${ROTDIR}/libhamlib-${ROTDIR}.la" 780done 781 782AC_SUBST([ROT_BACKEND_LIST]) 783AC_SUBST([ROT_BACKENDEPS]) 784 785## ---------------------------------- ## 786## Prepare amplifier backend dependencies ## 787## ---------------------------------- ## 788 789# otherwise parallel 'make -jn' will fail 790 791for be in ${AMP_BACKEND_LIST} ; do 792 AMPDIR=$(echo $be | awk -F "/" '{print $2}') 793 AMP_BACKENDEPS="${AMP_BACKENDEPS} \$(top_builddir)/amplifiers/${AMPDIR}/libhamlib-${AMPDIR}.la" 794done 795 796AC_SUBST([AMP_BACKEND_LIST]) 797AC_SUBST([AMP_BACKENDEPS]) 798 799 800 801## ------------ ## 802## Final output ## 803## ------------ ## 804 805dnl Output accumulated flags to the Makefile files. 806AC_SUBST([AM_CPPFLAGS]) 807AC_SUBST([AM_CFLAGS]) 808AC_SUBST([AM_CXXFLAGS]) 809 810 811AC_CONFIG_FILES([Makefile 812macros/Makefile 813include/Makefile 814lib/Makefile 815src/Makefile 816c++/Makefile 817bindings/Makefile 818doc/Makefile 819doc/hamlib.cfg 820rotators/amsat/Makefile 821rotators/ars/Makefile 822rotators/celestron/Makefile 823rotators/cnctrk/Makefile 824rotators/easycomm/Makefile 825rotators/ether6/Makefile 826rotators/fodtrack/Makefile 827rotators/gs232a/Makefile 828rotators/heathkit/Makefile 829rotators/ioptron/Makefile 830rotators/m2/Makefile 831rotators/meade/Makefile 832rotators/prosistel/Makefile 833rotators/rotorez/Makefile 834rotators/sartek/Makefile 835rotators/spid/Makefile 836rotators/ts7400/Makefile 837rotators/indi/Makefile 838rotators/satel/Makefile 839rotators/radant/Makefile 840rigs/adat/Makefile 841rigs/alinco/Makefile 842rigs/aor/Makefile 843rigs/barrett/Makefile 844rigs/dorji/Makefile 845rigs/drake/Makefile 846rigs/dummy/Makefile 847rigs/elad/Makefile 848rigs/flexradio/Makefile 849rigs/icmarine/Makefile 850rigs/icom/Makefile 851rigs/jrc/Makefile 852rigs/kachina/Makefile 853rigs/kenwood/Makefile 854rigs/kit/Makefile 855rigs/lowe/Makefile 856rigs/pcr/Makefile 857rigs/prm80/Makefile 858rigs/racal/Makefile 859rigs/rft/Makefile 860rigs/rs/Makefile 861rigs/skanti/Makefile 862rigs/tapr/Makefile 863rigs/tentec/Makefile 864rigs/tuner/Makefile 865rigs/uniden/Makefile 866rigs/winradio/Makefile 867rigs/wj/Makefile 868rigs/yaesu/Makefile 869tests/Makefile 870scripts/Makefile 871android/Makefile 872amplifiers/elecraft/Makefile 873hamlib.pc 874]) 875 876AC_OUTPUT 877 878echo \ 879"---------------------------------------------------------------------- 880 881 ${PACKAGE_NAME} Version ${PACKAGE_VERSION} configuration: 882 883 Prefix ${prefix} 884 Preprocessor ${CPP} ${CPPFLAGS} 885 C Compiler ${CC} ${CFLAGS} 886 C++ Compiler ${CXX} ${CXXFLAGS} 887 888 Package features: 889 With C++ binding ${cf_with_cxx_binding} 890 With Perl binding ${cf_with_perl_binding} 891 With Python binding ${cf_with_python_binding} 892 With TCL binding ${build_tcl} 893 With Lua binding ${cf_with_lua_binding} 894 With rigmem XML support ${cf_with_xml_support} 895 With Readline support ${cf_with_readline_support} 896 With INDI support ${cf_with_indi_support} 897 898 Enable HTML rig feature matrix ${cf_enable_html_matrix} 899 Enable WinRadio ${cf_with_winradio} 900 Enable USRP ${cf_with_usrp} 901 Enable USB backends ${cf_with_libusb} 902 Enable shared libs ${enable_shared} 903 Enable static libs ${enable_static} 904 905-----------------------------------------------------------------------" 906