pcap-config.in 1.8 KB

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