fltk-config.cmake.in 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. #!/bin/sh
  2. #
  3. # "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $"
  4. #
  5. # FLTK configuration utility.
  6. #
  7. # Copyright 2000-2010 by Bill Spitzak and others.
  8. # Original version Copyright 2000 by James Dean Palmer
  9. # Adapted by Vincent Penne and Michael Sweet
  10. #
  11. # This library is free software. Distribution and use rights are outlined in
  12. # the file "COPYING" which should have been included with this file. If this
  13. # file is missing or damaged, see the license at:
  14. #
  15. # http://www.fltk.org/COPYING.php
  16. #
  17. # Please report all bugs and problems on the following page:
  18. #
  19. # http://www.fltk.org/str.php
  20. #
  21. MAJOR_VERSION=@FLTK_VERSION_MAJOR@
  22. MINOR_VERSION=@FLTK_VERSION_MINOR@
  23. PATCH_VERSION=@FLTK_VERSION_PATCH@
  24. VERSION=@FLTK_VERSION_FULL@
  25. APIVERSION=@FLTK_VERSION@
  26. ### BEGIN fltk-config
  27. selfdir=`dirname "$0"`
  28. prefix=@CMAKE_INSTALL_PREFIX@
  29. exec_prefix=${prefix}
  30. exec_prefix_set=no
  31. bindir=@PREFIX_BIN@
  32. includedir=@PREFIX_INCLUDE@
  33. libdir=@PREFIX_LIB@
  34. srcdir=.
  35. # compiler names
  36. CC="@CC@"
  37. CXX="@CXX@"
  38. # flags for C++ compiler:
  39. ARCHFLAGS="@OPTION_ARCHFLAGS@"
  40. CFLAGS="@C_FLAGS@"
  41. CXXFLAGS="@CAIROFLAGS@@C_FLAGS@"
  42. LDFLAGS="@LDFLAGS@"
  43. LDLIBS="@LD_LIBS@"
  44. OPTIM="@OPTION_OPTIM@"
  45. CAIROFLAGS="@CAIROFLAGS@"
  46. # Check for local invocation, and update paths accordingly...
  47. if test -f "$selfdir/bin/UseFLTK.cmake"; then
  48. bindir="$selfdir/bin/fluid"
  49. includedir="@FLTK_SOURCE_DIR@"
  50. libdir="$selfdir/lib"
  51. if test -f "$libdir/libfltk_jpeg.a"; then
  52. CFLAGS="-I$includedir/jpeg $CFLAGS"
  53. CXXFLAGS="-I$includedir/jpeg $CXXFLAGS"
  54. fi
  55. if test -f "$libdir/libfltk_z.a"; then
  56. CFLAGS="-I$includedir/zlib $CFLAGS"
  57. CXXFLAGS="-I$includedir/zlib $CXXFLAGS"
  58. fi
  59. if test -f "$libdir/libfltk_png.a"; then
  60. CFLAGS="-I$includedir/png $CFLAGS"
  61. CXXFLAGS="-I$includedir/png $CXXFLAGS"
  62. fi
  63. fi
  64. if test -d $includedir/FL/images; then
  65. CFLAGS="-I$includedir/FL/images $CFLAGS"
  66. CXXFLAGS="-I$includedir/FL/images $CXXFLAGS"
  67. fi
  68. if test -f "$libdir/libfltk_cairo.a"; then
  69. CFLAGS="$CAIROFLAGS $CFLAGS"
  70. CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
  71. fi
  72. # libraries to link with:
  73. LIBNAME="@LIBNAME@"
  74. DSONAME="@DSONAME@"
  75. DSOLINK="@DSOLINK@"
  76. IMAGELIBS="@IMAGELIBS@"
  77. STATICIMAGELIBS="@STATICIMAGELIBS@"
  78. CAIROLIBS="@CAIROLIBS@"
  79. SHAREDSUFFIX="@SHAREDSUFFIX@"
  80. usage ()
  81. {
  82. echo "Usage: fltk-config [OPTIONS]
  83. Options:
  84. [--version]
  85. [--api-version]
  86. Options telling what we are doing:
  87. [--use-gl] use GL
  88. [--use-images] use extra image formats (PNG, JPEG)
  89. [--use-glut] use glut compatibility layer
  90. [--use-forms] use forms compatibility layer
  91. [--use-cairo] use cairo graphics lib
  92. Options telling what information we request:
  93. [--cc] return C compiler used to compile FLTK
  94. [--cxx] return C++ compiler used to compile FLTK
  95. [--optim] return compiler optimization used to compile FLTK
  96. [--cflags] return flags to compile C using FLTK
  97. [--cxxflags] return flags to compile C++ using FLTK
  98. [--ldflags] return flags to link against FLTK
  99. [--ldstaticflags] return flags to link against static FLTK library
  100. even if there are DSOs installed
  101. [--libs] return FLTK libraries full path for dependencies
  102. [--prefix] return FLTK install time --prefix directory
  103. [--includedir] return FLTK install time include directory
  104. Options to compile and link an application:
  105. [-g] compile the program with debugging information
  106. [-Dname[=value]] compile the program with the given define
  107. [--compile program.cxx]
  108. [--post program] prepare the program for desktop use
  109. "
  110. exit $1
  111. }
  112. if test $# -eq 0; then
  113. usage 1
  114. fi
  115. no_plugins=no
  116. compile=
  117. post=
  118. debug=
  119. # Parse command line options
  120. while test $# -gt 0
  121. do
  122. case "$1" in
  123. -*=*)
  124. optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
  125. ;;
  126. *)
  127. optarg=
  128. ;;
  129. esac
  130. case $1 in
  131. --version)
  132. echo $VERSION
  133. ;;
  134. --api-version)
  135. echo $APIVERSION
  136. ;;
  137. --cc)
  138. echo $CC
  139. ;;
  140. --cxx)
  141. echo $CXX
  142. ;;
  143. --optim)
  144. echo_optim=yes
  145. ;;
  146. --use-gl | --use-glut)
  147. use_gl=yes
  148. ;;
  149. --use-forms)
  150. use_forms=yes
  151. ;;
  152. --use-images)
  153. use_images=yes
  154. ;;
  155. --use-cairo)
  156. use_cairo=yes
  157. ;;
  158. --cflags)
  159. echo_cflags=yes
  160. ;;
  161. --cxxflags)
  162. echo_cxxflags=yes
  163. ;;
  164. --ldflags)
  165. echo_ldflags=yes
  166. ;;
  167. --ldstaticflags)
  168. echo_ldstaticflags=yes
  169. ;;
  170. --libs)
  171. echo_libs=yes
  172. ;;
  173. --prefix)
  174. echo_prefix=yes
  175. ;;
  176. --includedir)
  177. echo_includedir=yes
  178. ;;
  179. -g)
  180. debug=-g
  181. ;;
  182. -D*)
  183. CXXFLAGS="$CXXFLAGS $1"
  184. ;;
  185. --compile)
  186. compile="$2"
  187. shift
  188. ;;
  189. --post)
  190. post="$2"
  191. shift
  192. ;;
  193. *)
  194. echo_help=yes
  195. ;;
  196. esac
  197. shift
  198. done
  199. if test "$includedir" != /usr/include; then
  200. includes=-I$includedir
  201. else
  202. includes=
  203. fi
  204. if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then
  205. libs=-L$libdir
  206. else
  207. libs=
  208. fi
  209. # Calculate needed libraries
  210. LDSTATIC="$libdir/libfltk.a $LDLIBS"
  211. LDLIBS="-lfltk$SHAREDSUFFIX $LDLIBS"
  212. if test x$use_forms = xyes; then
  213. LDLIBS="-lfltk_forms$SHAREDSUFFIX $LDLIBS"
  214. LDSTATIC="$libdir/libfltk_forms.a $LDSTATIC"
  215. fi
  216. if test x$use_gl = xyes; then
  217. LDLIBS="-lfltk_gl$SHAREDSUFFIX @GLLIB@ $LDLIBS"
  218. LDSTATIC="$libdir/libfltk_gl.a @GLLIB@ $LDSTATIC"
  219. fi
  220. if test x$use_images = xyes; then
  221. LDLIBS="-lfltk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
  222. LDSTATIC="$libdir/libfltk_images.a $STATICIMAGELIBS $LDSTATIC"
  223. fi
  224. if test x$use_cairo = xyes; then
  225. LDLIBS="-lfltk_cairo$SHAREDSUFFIX $CAIROLIBS $LDLIBS"
  226. LDSTATIC="$libdir/libfltk_cairo.a $CAIROLIBS $LDSTATIC"
  227. fi
  228. LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS"
  229. LDSTATIC="$LDFLAGS $LDSTATIC"
  230. # Answer to user requests
  231. if test -n "$echo_help"; then
  232. usage 1
  233. fi
  234. if test -n "$compile"; then
  235. case "$compile" in
  236. *.cxx)
  237. prog="`basename \"$compile\" .cxx`"
  238. ;;
  239. *.cpp)
  240. prog="`basename \"$compile\" .cpp`"
  241. ;;
  242. *.cc)
  243. prog="`basename \"$compile\" .cc`"
  244. ;;
  245. *.C)
  246. prog="`basename \"$compile\" .C`"
  247. ;;
  248. *)
  249. echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
  250. exit 1
  251. ;;
  252. esac
  253. post="$prog"
  254. echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
  255. $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1
  256. fi
  257. if test -n "$post"; then
  258. case "`uname`" in
  259. Darwin)
  260. echo Creating "'$post.app'" bundle for desktop...
  261. id=`echo $post | tr ' ' '_'`
  262. # Make the bundle directory and move the executable there
  263. rm -rf "$post.app/Contents/MacOS"
  264. mkdir -p "$post.app/Contents/MacOS"
  265. mv "$post" "$post.app/Contents/MacOS"
  266. # Make a shell script that runs the bundled executable
  267. echo "#!/bin/sh" >"$post"
  268. echo 'dir="`dirname '"'"'$0'"'"'`"' >>"$post"
  269. echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post"
  270. chmod +x "$post"
  271. # Make the simplest Info.plist needed for an application
  272. cat >"$post.app/Contents/Info.plist" <<EOF
  273. <?xml version="1.0" encoding="UTF-8"?>
  274. <plist version="0.9">
  275. <dict>
  276. <key>CFBundleInfoDictionaryVersion</key>
  277. <string>6.0</string>
  278. <key>CFBundleExecutable</key>
  279. <string>$post</string>
  280. <key>CFBundleIdentifier</key>
  281. <string>org.fltk.$id</string>
  282. <key>CFBundleName</key>
  283. <string>$post</string>
  284. <key>CFBundlePackageType</key>
  285. <string>APPL</string>
  286. <key>NSHighResolutionCapable</key>
  287. <true/>
  288. </dict>
  289. </plist>
  290. EOF
  291. ;;
  292. esac
  293. fi
  294. if test "$echo_cflags" = "yes"; then
  295. echo $includes $CFLAGS
  296. fi
  297. if test "$echo_cxxflags" = "yes"; then
  298. echo $includes $CXXFLAGS
  299. fi
  300. if test "$echo_optim" = "yes"; then
  301. echo $OPTIM
  302. fi
  303. if test "$echo_ldflags" = "yes"; then
  304. my_libs=
  305. libdirs=$libs
  306. for i in $LDLIBS ; do
  307. if test $i != -L$libdir ; then
  308. if test -z "$my_libs" ; then
  309. my_libs="$i"
  310. else
  311. my_libs="$my_libs $i"
  312. fi
  313. fi
  314. done
  315. echo $libdirs $my_libs
  316. fi
  317. if test "$echo_ldstaticflags" = "yes"; then
  318. echo $LDSTATIC
  319. fi
  320. if test "$echo_libs" = "yes"; then
  321. USELIBS="$libdir/libfltk.a"
  322. if test x$use_forms = xyes; then
  323. USELIBS="$libdir/libfltk_forms.a $USELIBS"
  324. fi
  325. if test x$use_gl = xyes; then
  326. USELIBS="$libdir/libfltk_gl.a $USELIBS"
  327. fi
  328. if test x$use_cairo = xyes; then
  329. USELIBS="$libdir/libfltk_cairo.a $USELIBS"
  330. fi
  331. if test x$use_images = xyes; then
  332. USELIBS="$libdir/libfltk_images.a $USELIBS"
  333. for lib in fltk_jpeg fltk_png fltk_z; do
  334. if test -f $libdir/lib$lib.a; then
  335. USELIBS="$libdir/lib$lib.a $USELIBS"
  336. fi
  337. done
  338. fi
  339. echo $USELIBS
  340. fi
  341. if test "$echo_prefix" = "yes"; then
  342. echo $prefix
  343. fi
  344. if test "$echo_includedir" = "yes"; then
  345. echo $includedir
  346. fi
  347. #
  348. # End of "$Id: fltk-config.in 6614 2009-01-01 16:11:32Z matt $".
  349. #