From a1ef54e0bca77b29499d0fbe53fdda3c3c06d525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Fillod=2C=20F8CFE?= Date: Sun, 27 Jan 2002 23:43:36 +0000 Subject: [PATCH] optional binding cleanups, --enable-rigmatrix changed to --with-rigmatrix, autoconf math and net libs git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@926 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- configure.ac | 172 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 122 insertions(+), 50 deletions(-) diff --git a/configure.ac b/configure.ac index 79dc7c264..960d25af9 100644 --- a/configure.ac +++ b/configure.ac @@ -32,21 +32,13 @@ dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS([alloca.h argz.h malloc.h memory.h string.h strings.h]) -AC_CHECK_HEADERS([stdlib.h values.h rpc/rpc.h]) +AC_CHECK_HEADERS([stdlib.h values.h rpc/rpc.h net/errno.h]) AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h unistd.h getopt.h errno.h]) AC_CHECK_HEADERS([sys/ioccom.h linux/ppdev.h sgtty.h term.h termio.h termios.h]) AC_CHECK_HEADERS([windows.h winioctl.h winbase.h]) AM_SYS_POSIX_TERMIOS -AC_MSG_CHECKING(if you want 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) - - INCLUDES="${INCLUDES} -I\$(top_srcdir)/include -I\$(top_srcdir)/src -I\$(top_srcdir)/lib" CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE" if test "${ac_cv_c_compiler_gnu}" = "yes"; then @@ -66,9 +58,57 @@ AC_CHECK_TYPES([siginfo_t],[],[],[#include ]) dnl Checks for libraries. -dnl AC_CHECK_LIB(intl,gettext) -dnl AC_CHECK_LIB(nsl,gethostbyaddr) -dnl AC_CHECK_LIB(socket,socket) +# The following comes from SC_TCL_LINK_LIBS +# we redefine them here because we want a separate NET_LIBS var + +#-------------------------------------------------------------------- +# On a few very rare systems, all of the libm.a stuff is +# already in libc.a. Set compiler flags accordingly. +# Also, Linux requires the "ieee" library for math to work +# right (and it must appear before "-lm"). +#-------------------------------------------------------------------- +AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm") +AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) +#-------------------------------------------------------------------- +# 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 +# order in the command line generated by make. Here are some +# special considerations: +# 1. Use "connect" and "accept" to check for -lsocket, and +# "gethostbyname" to check for -lnsl. +# 2. Use each function name only once: can't redo a check because +# autoconf caches the results of the last check and won't redo it. +# 3. Use -lnsl and -lsocket only if they supply procedures that +# aren't already present in the normal libraries. This is because +# IRIX 5.2 has libraries, but they aren't needed and they're +# bogus: they goof up name resolution if used. +# 4. On some SVR4 systems, can't use -lsocket without -lnsl too. +# To get around this problem, check for both libraries together +# if -lsocket doesn't work by itself. +#-------------------------------------------------------------------- +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"])) +LIBS=$hl_oldLibs +AC_SUBST(NET_LIBS) +AC_SUBST(MATH_LIBS) + + AC_CHECK_LIB(syslog,syslog) # OS/2 needs this dnl Checks for library functions. @@ -96,54 +136,86 @@ AM_PROG_LIBTOOL dnl Configure libltdl AC_CONFIG_SUBDIRS(libltdl) + dnl Check if libgd-dev is installed, so we can enable rigmatrix -AC_ARG_ENABLE([rigmatrix], -[ --enable-rigmatrix Generate rigmatrix tool (requires libgd)], -[case "${enableval}" in - yes) wantrigmatrix=true ;; - no) wantrigmatrix=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-rigmatrix) ;; - esac],[wantrigmatrix=false]) +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]) -AM_CONDITIONAL(WANTRIGMATRIX, test x$wantrigmatrix = xtrue) - -if test "x${wantrigmatrix}" != "xfalse"; then -AC_CHECK_HEADERS([gd.h], - [AC_CHECK_LIB([gd],[gdImageCreate],[enable_rigmatrix=yes], [enable_rigmatrix=no],[-lz])]) +AC_MSG_CHECKING(whether to build rigmatrix) +AC_MSG_RESULT($enable_rigmatrix) if test "${enable_rigmatrix}" = "no"; then - echo "disabling rigmatrix generation" RIGMATRIX= else - echo "enabling rigmatrix generation" - RIGMATRIX=rigmatrix -fi -else - echo "disabling rigmatrix generation" - RIGMATRIX= + RIGMATRIX="rigmatrix" fi AC_SUBST(RIGMATRIX) -dnl Check if tcl includes are there, so we can enable HamlibTCL -dnl FIXME! -AC_CHECK_HEADERS(tcl8.2/tcl.h) -if test "${ac_cv_header_tcl8_2_tcl_h}" = "no" ; then - echo "disabling HamlibTCL support" - LIBHAMLIBTCL= - LTHAMLIBTCL= +BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc" +ROT_BACKEND_LIST="dummy easycomm" +BINDING_LIST="" + +dnl Check if cxx-binding not wanted, default is to build it + +if test x"${CXX}" = x; then + cf_with_cxx=no else - echo "enabling HamlibTCL support" - LIBHAMLIBTCL=libhamlibtcl.a - LTHAMLIBTCL=libhamlibtcl.la + cf_with_cxx=yes +fi +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) + +if test "${cf_with_cxx_binding}" = "yes" ; then + BINDING_LIST="$BINDING_LIST c++" +fi + +dnl Check if kylix-binding wanted, REM: nothing to build yet + +cf_with_kylix=no +AC_MSG_CHECKING(whether to build Kylix binding and demo) +AC_ARG_WITH(kylix-binding, + [ --with-kylix-binding build Kylix binding and demo], + [cf_with_kylix_binding=$withval], + [cf_with_kylix_binding=$cf_with_kylix]) +AC_MSG_RESULT($cf_with_kylix_binding) + +if test "${cf_with_kylix_binding}" = "yes" ; then + BINDING_LIST="$BINDING_LIST kylix" fi -AM_CONDITIONAL(HAMLIBTCL, test x$LTHAMLIBTCL != x) -AC_SUBST(LIBHAMLIBTCL) -AC_SUBST(LTHAMLIBTCL) +dnl Check for tcl-dev availability, so we can enable HamlibTCL + +SC_PATH_TCLCONFIG +SC_LOAD_TCLCONFIG +if test x"${TCL_LIB_SPEC}" = x; then + cf_with_tcl=no +else + cf_with_tcl=yes +fi +AC_MSG_CHECKING(whether to build tcl binding and demo) +AC_ARG_WITH(tcl-binding, + [ --with-tcl-binding build tcl binding and demo], + [cf_with_tcl_binding=$withval], + [cf_with_tcl_binding=$cf_with_tcl]) +AC_MSG_RESULT($cf_with_tcl_binding) + +if test "${cf_with_tcl_binding}" = "yes" ; then + BINDING_LIST="$BINDING_LIST tcl" +fi +AC_SUBST(TCL_LIB_SPEC) -AC_SUBST(INCLUDES) if test "${ac_cv_header_sys_socket_h}" = "no"; then echo "disabling NET port" @@ -155,11 +227,7 @@ fi AC_SUBST(NET) -BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc" -ROT_BACKEND_LIST="dummy easycomm" -BINDING_LIST="kylix c++ tcl" - -AC_SUBST(BINDING_LIST) +dnl Backend list case "$host_os" in linux-gnu*) @@ -194,10 +262,14 @@ AC_SUBST(ROT_BACKEND_LIST) AC_SUBST(ROT_BACKENDLNK) AC_SUBST(ROT_BACKENDEPS) +AC_SUBST(BINDING_LIST) + Xsed="sed -e s/^X//" LTLIBOBJS=`echo X"$LIBOBJS" | $Xsed -e "s,\.[^.]* ,.lo ,g;s,\.[^.]*\$,.lo,"` AC_SUBST(LIBOBJS) AC_SUBST(LTLIBOBJS) +AC_SUBST(INCLUDES) + AC_CONFIG_FILES([Makefile include/Makefile