You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

390 lines
8.6KB

  1. #!/bin/sh
  2. #
  3. # "$Id: ntk-config.in 8149 2011-01-01 00:10:38Z mike $"
  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; you can redistribute it and/or
  12. # modify it under the terms of the GNU Library General Public
  13. # License as published by the Free Software Foundation; either
  14. # version 2 of the License, or (at your option) any later version.
  15. #
  16. # This library is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. # Library General Public License for more details.
  20. #
  21. # You should have received a copy of the GNU Library General Public
  22. # License along with this library; if not, write to the Free Software
  23. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  24. # USA.
  25. #
  26. # Please report all bugs and problems on the following page:
  27. #
  28. # http://www.ntk.org/str.php
  29. #
  30. MAJOR_VERSION=@FL_MAJOR_VERSION@
  31. MINOR_VERSION=@FL_MINOR_VERSION@
  32. PATCH_VERSION=@FL_PATCH_VERSION@
  33. VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
  34. APIVERSION="$MAJOR_VERSION.$MINOR_VERSION"
  35. ### BEGIN ntk-config
  36. selfdir=`dirname "$0"`
  37. prefix=@prefix@
  38. exec_prefix=@exec_prefix@
  39. exec_prefix_set=no
  40. bindir=@bindir@
  41. includedir=@includedir@/ntk
  42. libdir=@libdir@
  43. srcdir=@srcdir@
  44. # compiler names
  45. CC="@CC@"
  46. CXX="@CXX@"
  47. # flags for C++ compiler:
  48. ARCHFLAGS="@ARCHFLAGS@"
  49. CFLAGS="@CFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
  50. CXXFLAGS="@CXXFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
  51. LDFLAGS="@LDFLAGS@"
  52. LDLIBS="@LIBS@"
  53. OPTIM="@OPTIM@"
  54. CAIROFLAGS="@CAIROFLAGS@"
  55. # Check for local invocation, and update paths accordingly...
  56. if test -f "$selfdir/FL/Fl_Window.H"; then
  57. bindir="$selfdir/fluid"
  58. includedir="$selfdir"
  59. libdir="$selfdir/lib"
  60. if test -f "$libdir/libntk_jpeg.a"; then
  61. CFLAGS="-I$includedir/jpeg $CFLAGS"
  62. CXXFLAGS="-I$includedir/jpeg $CXXFLAGS"
  63. fi
  64. if test -f "$libdir/libntk_z.a"; then
  65. CFLAGS="-I$includedir/zlib $CFLAGS"
  66. CXXFLAGS="-I$includedir/zlib $CXXFLAGS"
  67. fi
  68. if test -f "$libdir/libntk_png.a"; then
  69. CFLAGS="-I$includedir/png $CFLAGS"
  70. CXXFLAGS="-I$includedir/png $CXXFLAGS"
  71. fi
  72. fi
  73. if test -d $includedir/ntk/FL/images; then
  74. CFLAGS="-I$includedir/ntk/FL/images $CFLAGS"
  75. CXXFLAGS="-I$includedir/ntk/FL/images $CXXFLAGS"
  76. fi
  77. # libraries to link with:
  78. LIBNAME="@LIBNAME@"
  79. DSONAME="@DSONAME@"
  80. DSOLINK="@DSOLINK@"
  81. IMAGELIBS="@IMAGELIBS@"
  82. STATICIMAGELIBS="@STATICIMAGELIBS@"
  83. CAIROLIBS="@CAIROLIBS@"
  84. SHAREDSUFFIX="@SHAREDSUFFIX@"
  85. usage ()
  86. {
  87. echo "Usage: ntk-config [OPTIONS]
  88. Options:
  89. [--version]
  90. [--api-version]
  91. Options telling what we are doing:
  92. [--use-gl] use GL
  93. [--use-images] use extra image formats (PNG, JPEG)
  94. [--use-glut] use glut compatibility layer
  95. [--use-cairo] use cairo graphics lib
  96. Options telling what information we request:
  97. [--cc] return C compiler used to compile FLTK
  98. [--cxx] return C++ compiler used to compile FLTK
  99. [--optim] return compiler optimization used to compile FLTK
  100. [--cflags] return flags to compile C using FLTK
  101. [--cxxflags] return flags to compile C++ using FLTK
  102. [--ldflags] return flags to link against FLTK
  103. [--ldstaticflags] return flags to link against static FLTK library
  104. even if there are DSOs installed
  105. [--libs] return FLTK libraries full path for dependencies
  106. [--prefix] return FLTK install time --prefix directory
  107. [--includedir] return FLTK install time include directory
  108. Options to compile and link an application:
  109. [-g] compile the program with debugging information
  110. [-Dname[=value]] compile the program with the given define
  111. [--compile program.cxx]
  112. [--post program] prepare the program for desktop use
  113. "
  114. exit $1
  115. }
  116. if test $# -eq 0; then
  117. usage 1
  118. fi
  119. no_plugins=no
  120. compile=
  121. post=
  122. debug=
  123. # Parse command line options
  124. while test $# -gt 0
  125. do
  126. case "$1" in
  127. -*=*)
  128. optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
  129. ;;
  130. *)
  131. optarg=
  132. ;;
  133. esac
  134. case $1 in
  135. --version)
  136. echo $VERSION
  137. ;;
  138. --api-version)
  139. echo $APIVERSION
  140. ;;
  141. --cc)
  142. echo $CC
  143. ;;
  144. --cxx)
  145. echo $CXX
  146. ;;
  147. --optim)
  148. echo_optim=yes
  149. ;;
  150. --use-gl | --use-glut)
  151. use_gl=yes
  152. ;;
  153. --use-images)
  154. use_images=yes
  155. ;;
  156. --use-cairo)
  157. use_cairo=yes
  158. ;;
  159. --cflags)
  160. echo_cflags=yes
  161. ;;
  162. --cxxflags)
  163. echo_cxxflags=yes
  164. ;;
  165. --ldflags)
  166. echo_ldflags=yes
  167. ;;
  168. --ldstaticflags)
  169. echo_ldstaticflags=yes
  170. ;;
  171. --libs)
  172. echo_libs=yes
  173. ;;
  174. --prefix)
  175. echo_prefix=yes
  176. ;;
  177. --includedir)
  178. echo_includedir=yes
  179. ;;
  180. -g)
  181. debug=-g
  182. ;;
  183. -D*)
  184. CXXFLAGS="$CXXFLAGS $1"
  185. ;;
  186. --compile)
  187. compile="$2"
  188. shift
  189. ;;
  190. --post)
  191. post="$2"
  192. shift
  193. ;;
  194. *)
  195. echo_help=yes
  196. ;;
  197. esac
  198. shift
  199. done
  200. if test "$includedir" != /usr/include; then
  201. includes=-I$includedir
  202. else
  203. includes=
  204. fi
  205. if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then
  206. libs=-L$libdir
  207. else
  208. libs=
  209. fi
  210. # Calculate needed libraries
  211. LDSTATIC="$libdir/libntk.a $LDLIBS"
  212. LDLIBS="-lntk$SHAREDSUFFIX $LDLIBS"
  213. if test x$use_gl = xyes; then
  214. LDLIBS="-lntk_gl$SHAREDSUFFIX @GLLIB@ $LDLIBS"
  215. LDSTATIC="$libdir/libntk_gl.a @GLLIB@ $LDSTATIC"
  216. fi
  217. if test x$use_images = xyes; then
  218. LDLIBS="-lntk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
  219. LDSTATIC="$libdir/libntk_images.a $STATICIMAGELIBS $LDSTATIC"
  220. fi
  221. if test x$use_cairo = xyes; then
  222. LDLIBS="$CAIROLIBS $LDLIBS"
  223. LDSTATIC="$CAIROLIBS $LDSTATIC"
  224. fi
  225. LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS"
  226. LDSTATIC="$LDFLAGS $LDSTATIC"
  227. # Answer to user requests
  228. if test -n "$echo_help"; then
  229. usage 1
  230. fi
  231. if test -n "$compile"; then
  232. case "$compile" in
  233. *.cxx)
  234. prog="`basename \"$compile\" .cxx`"
  235. ;;
  236. *.cpp)
  237. prog="`basename \"$compile\" .cpp`"
  238. ;;
  239. *.cc)
  240. prog="`basename \"$compile\" .cc`"
  241. ;;
  242. *.C)
  243. prog="`basename \"$compile\" .C`"
  244. ;;
  245. *)
  246. echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
  247. exit 1
  248. ;;
  249. esac
  250. post="$prog"
  251. echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
  252. $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1
  253. fi
  254. if test -n "$post"; then
  255. case "`uname`" in
  256. Darwin)
  257. echo Creating "'$post.app'" bundle for desktop...
  258. id=`echo $post | tr ' ' '_'`
  259. # Make the bundle directory and move the executable there
  260. rm -rf "$post.app/Contents/MacOS"
  261. mkdir -p "$post.app/Contents/MacOS"
  262. mv "$post" "$post.app/Contents/MacOS"
  263. # Make a shell script that runs the bundled executable
  264. echo "#!/bin/sh" >"$post"
  265. echo 'dir="`dirname \"$0\"`"' >>"$post"
  266. echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post"
  267. chmod +x "$post"
  268. # Make the simplest Info.plist needed for an application
  269. cat >"$post.app/Contents/Info.plist" <<EOF
  270. <?xml version="1.0" encoding="UTF-8"?>
  271. <plist version="0.9">
  272. <dict>
  273. <key>CFBundleInfoDictionaryVersion</key>
  274. <string>6.0</string>
  275. <key>CFBundleExecutable</key>
  276. <string>$post</string>
  277. <key>CFBundleIdentifier</key>
  278. <string>org.ntk.$id</string>
  279. <key>CFBundleName</key>
  280. <string>$post</string>
  281. <key>CFBundlePackageType</key>
  282. <string>APPL</string>
  283. </dict>
  284. </plist>
  285. EOF
  286. ;;
  287. esac
  288. fi
  289. if test "$echo_cflags" = "yes"; then
  290. echo $includes $CFLAGS
  291. fi
  292. if test "$echo_cxxflags" = "yes"; then
  293. echo $includes $CXXFLAGS
  294. fi
  295. if test "$echo_optim" = "yes"; then
  296. echo $OPTIM
  297. fi
  298. if test "$echo_ldflags" = "yes"; then
  299. my_libs=
  300. libdirs=$libs
  301. for i in $LDLIBS ; do
  302. if test $i != -L$libdir ; then
  303. if test -z "$my_libs" ; then
  304. my_libs="$i"
  305. else
  306. my_libs="$my_libs $i"
  307. fi
  308. fi
  309. done
  310. echo $libdirs $my_libs
  311. fi
  312. if test "$echo_ldstaticflags" = "yes"; then
  313. echo $LDSTATIC
  314. fi
  315. if test "$echo_libs" = "yes"; then
  316. USELIBS="$libdir/libntk.a"
  317. if test x$use_gl = xyes; then
  318. USELIBS="$libdir/libntk_gl.a $USELIBS"
  319. fi
  320. if test x$use_cairo = xyes; then
  321. USELIBS="$USELIBS"
  322. fi
  323. if test x$use_images = xyes; then
  324. USELIBS="$libdir/libntk_images.a $USELIBS"
  325. for lib in ntk_jpeg ntk_png ntk_z; do
  326. if test -f $libdir/lib$lib.a; then
  327. USELIBS="$libdir/lib$lib.a $USELIBS"
  328. fi
  329. done
  330. fi
  331. echo $USELIBS
  332. fi
  333. if test "$echo_prefix" = "yes"; then
  334. echo $prefix
  335. fi
  336. if test "$echo_includedir" = "yes"; then
  337. echo $includedir
  338. fi
  339. #
  340. # End of "$Id: ntk-config.in 8149 2011-01-01 00:10:38Z mike $".
  341. #