Ticket #16604: socat-1.6.0.1-mac-CL.diff

File socat-1.6.0.1-mac-CL.diff, 8.9 KB (added by raimue (Rainer Müller), 16 years ago)

From the linked patch site, should go to the files dir

  • Makefile.in

    diff -ru socat-1.6.0.1/Makefile.in socat-1.6.0.1mac/Makefile.in
    old new  
    1515
    1616BINDEST = @bindir@
    1717
     18datarootdir = @datarootdir@
    1819MANDEST = @mandir@
    1920
    2021srcdir = @srcdir@
     
    124125strip: progs
    125126        strip $(PROGS)
    126127
    127 install: progs doc/socat.1
     128install: progs $(srcdir)/doc/socat.1
    128129        mkdir -p $(DESTDIR)$(BINDEST)
    129130        $(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)
    130131        $(INSTALL) -m 755 procan $(DESTDIR)$(BINDEST)
    131132        $(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
    132133        mkdir -p $(DESTDIR)$(MANDEST)/man1
    133         $(INSTALL) -m 644 doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
     134        $(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/
    134135
    135136uninstall:
    136137        rm -f $(DESTDIR)$(BINDEST)/socat
  • configure.in

    diff -ru socat-1.6.0.1/configure.in socat-1.6.0.1mac/configure.in
    old new  
    5555AC_CHECK_HEADERS(pty.h)
    5656AC_CHECK_HEADERS(netinet/in.h netinet/in_systm.h netinet/ip.h netinet/tcp.h)
    5757AC_CHECK_HEADERS(netinet6/in6.h)        # found on OpenBSD, used for IPV6_*
    58 AC_CHECK_HEADERS(arpa/nameser.h resolv.h)
    59 AC_CHECK_HEADERS(termios.h net/if.h linux/if_tun.h)
     58AC_CHECK_HEADERS(net/if.h, [], [], [AC_INCLUDES_DEFAULT
     59        #if HAVE_SYS_SOCKET_H
     60        #include <sys/socket.h>
     61        #endif])        # Mac OS X requires including sys/socket.h
     62AC_CHECK_HEADERS(arpa/nameser.h)
     63AC_HEADER_RESOLV()
     64AC_CHECK_HEADERS(termios.h linux/if_tun.h)
    6065AC_CHECK_HEADERS(sys/utsname.h sys/select.h sys/file.h)
    6166AC_CHECK_HEADERS(util.h libutil.h sys/stropts.h regex.h)
    6267AC_CHECK_HEADERS(linux/fs.h linux/ext2_fs.h)
    6368
    6469
     70dnl Link libresolv if necessary (for Mac OS X)
     71AC_SEARCH_LIBS([res_9_init], [resolv])
     72
     73
    6574dnl Check for extra socket library (for Solaris)
    6675AC_CHECK_FUNC(hstrerror,  , AC_CHECK_LIB(resolv, hstrerror, [LIBS="$LIBS -lresolv"; AC_DEFINE(HAVE_HSTRERROR)]))
    6776AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
     
    185194if test "$WITH_IP6"; then
    186195  AC_CHECK_HEADERS([netinet/ip6.h],
    187196    [AC_DEFINE(HAVE_NETINET_IP6_H) AC_DEFINE(WITH_IP6)],
    188     [AC_MSG_WARN([include file netinet/ip6.h not found, disabling IP6])])
     197    [AC_MSG_WARN([include file netinet/ip6.h not found, disabling IP6])],
     198    [AC_INCLUDES_DEFAULT
     199     #ifdef HAVE_NETINET_IN_H
     200     # include <netinet/in.h>
     201     #endif])
    189202fi
    190203
    191204AC_MSG_CHECKING(whether to include raw IP support)
     
    284297               esac],
    285298               [AC_MSG_RESULT(yes);   WITH_READLINE=1 ])
    286299
    287 # check if we find the components of GNU readline
    288300if test -n "$WITH_READLINE"; then
    289   # first, we need to find the include file <readline.h>
    290   AC_MSG_NOTICE(checking for components of readline)
    291   #AC_CHECK_HEADERS(readline/readline.h readline/history.h)
    292   AC_CACHE_VAL(sc_cv_have_readline_h,
    293     [AC_TRY_COMPILE([#include <stdio.h> /* FreeBSD needs "FILE *" */
    294 #include <readline/readline.h>
    295 #include <readline/history.h>],[;],
    296       [sc_cv_have_readline_h=yes; READLINE_ROOT=""; ],
    297       [sc_cv_have_readline_h=no
    298        for D in "/sw" "/usr/local" "/opt/freeware" "/usr/sfw"; do
    299         I="$D/include"
    300         i="$I/readline/readline.h"
    301         if test -r "$i"; then
    302           #V_INCL="$V_INCL -I$I/"
    303           CPPFLAGS="$CPPFLAGS -I$I"
    304           AC_MSG_NOTICE(found $i)
    305           sc_cv_have_readline_h=yes; READLINE_ROOT="$D"
    306           break;
    307         fi
    308       done])
    309   ])
    310   if test "$sc_cv_have_readline_h" = "yes"; then
    311     AC_DEFINE(HAVE_READLINE_READLINE_H)
    312     AC_DEFINE(HAVE_READLINE_HISTORY_H)
    313   fi
    314   AC_MSG_NOTICE(checked for readline.h... $sc_cv_have_readline_h)
    315 fi      # end checking for readline.h
    316 #
    317 if test -n "$WITH_READLINE" -a "$sc_cv_have_readline_h" = yes; then
    318   # next, we search for the readline library (libreadline.*)
    319   AC_MSG_CHECKING(for libreadline)
    320   AC_CACHE_VAL(sc_cv_have_libreadline,
    321     [ LIBS0="$LIBS"
    322       if test -n "$READLINE_ROOT"; then
    323         L="$READLINE_ROOT/lib"; LIBS="$LIBS0 -L$L -lreadline"
    324       else
    325         LIBS="$LIBS0 -lreadline"
    326       fi
    327       AC_TRY_LINK([#include <stdio.h>   /* FreeBSD needs FILE * */
    328 #include <readline/readline.h>
    329 #include <readline/history.h>],
    330         [readline(NULL)],
    331         [sc_cv_have_libreadline='yes'],
    332         [sc_cv_have_libreadline='no'
    333           LIBS1="$LIBS"
    334           LIBS="$LIBS -lcurses"
    335           AC_TRY_LINK([#include <stdio.h>       /* FreeBSD needs FILE * */
    336 #include <readline/readline.h>
    337 #include <readline/history.h>],
    338             [readline(NULL)],
    339             [sc_cv_have_libreadline='yes'],
    340             [sc_cv_have_libreadline='no'
    341               LIBS="$LIBS1 -lncurses"           # eg for SuSE52
    342               AC_TRY_LINK([#include <stdio.h>   /* FreeBSD needs FILE * */
    343 #include <readline/readline.h>
    344 #include <readline/history.h>],
    345                 [readline(NULL)],
    346                 [sc_cv_have_libreadline='yes'],
    347                 [sc_cv_have_libreadline='no'])
    348       ])]
    349       )
    350       if test "$sc_cv_have_libreadline" != 'yes'; then
    351         LIBS="$LIBS0"
    352       fi
    353     ]
    354 #! missing libcurses dependency; missing freeware places
    355 #    # we test if libcurses is available and if it can be used without further libs
    356 #    AC_CHECK_LIB(ncurses, main, , AC_CHECK_LIB(curses, main))  # some Linux work with this
    357 #    # we test if readline can be used without further libs
    358 #    AC_CHECK_LIB(readline, readline)
    359 #    # we see if using_history() is already in $LIBS; if not, we try it with curses
    360 #    AC_CHECK_FUNC(using_history, , AC_CHECK_LIB(history, using_history,,, -lcurses))
    361 #fi
    362   )
    363   if test "$sc_cv_have_libreadline" = 'yes'; then
    364     AC_DEFINE(HAVE_LIBREADLINE)
    365   fi
    366   AC_MSG_RESULT($sc_cv_have_libreadline)
    367 fi
    368 #
    369 if test -n "$WITH_READLINE"; then
    370   if test "$sc_cv_have_readline_h" = "yes" -a "$sc_cv_have_libreadline" = "yes"; then
    371     AC_DEFINE(WITH_READLINE)
    372   else
    373     AC_MSG_WARN([not all components of readline found, disabling it]);
     301  CPPFLAGS_ORIG=$CPPFLAGS
     302  CFLAGS_ORIG=$CFLAGS
     303  LIBS_ORIG=$LIBS
     304  sc_usable_readline_found=
     305 
     306  for D in "" "/usr/local" "/opt/local" "/sw" "/opt/freeware" "/usr/sfw"; do   
     307    if test -n "$D" ; then
     308      CPPFLAGS="$CPPFLAGS -I$D/include"
     309      CFLAGS="$CFLAGS -L$D/lib"
     310      DLOC="in location $D"
     311    else
     312      DLOC="in default location"
     313    fi
     314    AC_MSG_CHECKING(for usable readline $DLOC)
     315   
     316    # Some systems require -lcurses, some require -lncurses.
     317    # Mac OS X 10.4 (and others) ships with libedit masquerading as readline,
     318    # but it doesn't work well with socat. It can be recognized by the absence
     319    # of append_history.
     320   
     321    for L in "" "-lcurses" "-lncurses"; do
     322      LIBS="$LIBS_ORIG -lreadline $L"
     323      AC_TRY_LINK(
     324        [ #include <stdio.h>
     325          #include <readline/readline.h>
     326          #include <readline/history.h>],
     327        [ readline(NULL);
     328          append_history(0, NULL); ],
     329        [ sc_usable_readline_found=1
     330          break ])
     331    done
     332   
     333    if test -n "$sc_usable_readline_found"; then
     334      AC_MSG_RESULT(yes)
     335      AC_DEFINE(HAVE_READLINE_READLINE_H,1)
     336      AC_DEFINE(HAVE_READLINE_HISTORY_H,1)
     337      AC_DEFINE(HAVE_LIBREADLINE,1)
     338      AC_DEFINE(WITH_READLINE,1)
     339      break
     340    else
     341      AC_MSG_RESULT(no)
     342      CPPFLAGS=$CPPFLAGS_ORIG
     343      CFLAGS=$CFLAGS_ORIG
     344      LIBS=$LIBS_ORIG
     345    fi
     346  done
     347 
     348  if test -z "$sc_usable_readline_found"; then
     349    AC_MSG_WARN([no suitable version of readline found; perhaps you need to install a newer version])
    374350  fi
    375351fi
    376352
  • socat-1.6.0.

    diff -ru socat-1.6.0.1/test.sh socat-1.6.0.1mac/test.sh
    old new  
    8383OpenBSD)IFCONFIG=/sbin/ifconfig ;;
    8484OSF1)  IFCONFIG=/sbin/ifconfig ;;
    8585SunOS) IFCONFIG=/sbin/ifconfig ;;
     86Darwin)IFCONFIG=/sbin/ifconfig ;;
    8687#*)     IFCONFIG=/sbin/ifconfig ;;
    8788esac
    8889
     
    140141PRINTF="printf"
    141142
    142143case "$TERM" in
    143 vt100|vt320|linux|xterm|cons25|dtterm|aixterm|sun-color)
     144vt100|vt320|linux|xterm|cons25|dtterm|aixterm|sun-color|xterm-color)
    144145        # there are different behaviours of printf (and echo)
    145146        # on some systems, echo behaves different than printf...
    146147        if [ $($PRINTF "\0101") = "A" ]; then
     
    15941595    OpenBSD)l=$($IFCONFIG -a |fgrep 'inet 127.0.0.1 ');;
    15951596    OSF1)  l=$($IFCONFIG -a |grep ' inet ') ;;
    15961597    SunOS) l=$($IFCONFIG -a |grep 'inet ') ;;
     1598    Darwin)l=$($IFCONFIG lo0 |fgrep 'inet 127.0.0.1 ') ;;
    15971599#    *)     l=$($IFCONFIG -a |grep ' ::1[^:0-9A-Fa-f]') ;;
    15981600    esac
    15991601    [ -z "$l" ] && return 1   
     
    16191621    NetBSD)l=$(/sbin/ifconfig -a |grep 'inet6 ::1 ');;
    16201622    OSF1)  l=$(/sbin/ifconfig -a |grep ' inet6 ') ;;
    16211623    SunOS) l=$(/sbin/ifconfig -a |grep 'inet6 ') ;;
     1624    Darwin)l=$(/sbin/ifconfig lo0 |grep 'inet6 ::1 ') ;;
    16221625    *)     l=$(/sbin/ifconfig -a |grep ' ::1[^:0-9A-Fa-f]') ;;
    16231626    esac
    16241627    [ -z "$l" ] && return 1   
    16251628    # existence of interface might not suffice, check for routeability:
    16261629    case "$UNAME" in
    1627     Darwin) ping -c 1 ::1; l="$?" ;;
     1630    Darwin) ping6 -c 1 ::1; l="$?" ;;
    16281631    Linux)  ping6 -c 1 ::1; l="$?" ;;
    16291632    *) if [ -n "$l" ]; then l=0; else l=1; fi ;;
    16301633    esac