1#! /bin/sh 2 3# 4# Script to give the appropriate compiler flags and linker flags 5# to use when building code that uses libpcap. 6# 7prefix="@prefix@" 8exec_prefix="@exec_prefix@" 9includedir="@includedir@" 10libdir="@libdir@" 11V_RPATH_OPT="@V_RPATH_OPT@" 12LIBS="@LIBS@" 13 14static=0 15show_cflags=0 16show_libs=0 17while [ "$#" != 0 ] 18do 19 case "$1" in 20 21 --static) 22 static=1 23 ;; 24 25 --cflags) 26 show_cflags=1 27 ;; 28 29 --libs) 30 show_libs=1 31 ;; 32 33 --additional-libs) 34 show_additional_libs=1 35 ;; 36 esac 37 shift 38done 39if [ "$V_RPATH_OPT" != "" ] 40then 41 # 42 # If libdir isn't /usr/lib, add it to the run-time linker path. 43 # 44 if [ "$libdir" != "/usr/lib" ] 45 then 46 RPATH=$V_RPATH_OPT$libdir 47 fi 48fi 49if [ "@includedir@" != "/usr/include" ] 50then 51 i="-I@includedir@" 52fi 53if [ "@libdir@" != "/usr/lib" ] 54then 55 l="-L@libdir@" 56fi 57if [ -n "@LIBS@" ] 58then 59 L="@LIBS@" 60fi 61 62if [ "$static" = 1 ] 63then 64 # 65 # Include LIBS so that the flags include libraries containing 66 # routines that libpcap uses. 67 # 68 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] 69 then 70 echo "-I$includedir -L$libdir -lpcap $LIBS" 71 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] 72 then 73 echo "-I$includedir -L$libdir $LIBS" 74 elif [ "$show_cflags" = 1 ] 75 then 76 echo "-I$includedir" 77 elif [ "$show_libs" = 1 ] 78 then 79 echo "-L$libdir -lpcap $LIBS" 80 elif [ "$show_additional_libs" = 1 ] 81 then 82 echo "$LIBS" 83 fi 84else 85 # 86 # Omit LIBS - libpcap is assumed to be linked with those 87 # libraries, so there's no need to do so explicitly. 88 # 89 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] 90 then 91 echo "-I$includedir -L$libdir $RPATH -lpcap" 92 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] 93 then 94 echo "-I$includedir" 95 elif [ "$show_cflags" = 1 ] 96 then 97 echo "-I$includedir" 98 elif [ "$show_libs" = 1 ] 99 then 100 echo "-L$libdir $RPATH -lpcap" 101 fi 102fi 103