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.

402 lines
8.9KB

  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@
  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/FL/images; then
  74. CFLAGS="-I$includedir/FL/images $CFLAGS"
  75. CXXFLAGS="-I$includedir/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-forms] use forms compatibility layer
  96. [--use-cairo] use cairo graphics lib
  97. Options telling what information we request:
  98. [--cc] return C compiler used to compile FLTK
  99. [--cxx] return C++ compiler used to compile FLTK
  100. [--optim] return compiler optimization used to compile FLTK
  101. [--cflags] return flags to compile C using FLTK
  102. [--cxxflags] return flags to compile C++ using FLTK
  103. [--ldflags] return flags to link against FLTK
  104. [--ldstaticflags] return flags to link against static FLTK library
  105. even if there are DSOs installed
  106. [--libs] return FLTK libraries full path for dependencies
  107. [--prefix] return FLTK install time --prefix directory
  108. [--includedir] return FLTK install time include directory
  109. Options to compile and link an application:
  110. [-g] compile the program with debugging information
  111. [-Dname[=value]] compile the program with the given define
  112. [--compile program.cxx]
  113. [--post program] prepare the program for desktop use
  114. "
  115. exit $1
  116. }
  117. if test $# -eq 0; then
  118. usage 1
  119. fi
  120. no_plugins=no
  121. compile=
  122. post=
  123. debug=
  124. # Parse command line options
  125. while test $# -gt 0
  126. do
  127. case "$1" in
  128. -*=*)
  129. optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
  130. ;;
  131. *)
  132. optarg=
  133. ;;
  134. esac
  135. case $1 in
  136. --version)
  137. echo $VERSION
  138. ;;
  139. --api-version)
  140. echo $APIVERSION
  141. ;;
  142. --cc)
  143. echo $CC
  144. ;;
  145. --cxx)
  146. echo $CXX
  147. ;;
  148. --optim)
  149. echo_optim=yes
  150. ;;
  151. --use-gl | --use-glut)
  152. use_gl=yes
  153. ;;
  154. --use-forms)
  155. use_forms=yes
  156. ;;
  157. --use-images)
  158. use_images=yes
  159. ;;
  160. --use-cairo)
  161. use_cairo=yes
  162. ;;
  163. --cflags)
  164. echo_cflags=yes
  165. ;;
  166. --cxxflags)
  167. echo_cxxflags=yes
  168. ;;
  169. --ldflags)
  170. echo_ldflags=yes
  171. ;;
  172. --ldstaticflags)
  173. echo_ldstaticflags=yes
  174. ;;
  175. --libs)
  176. echo_libs=yes
  177. ;;
  178. --prefix)
  179. echo_prefix=yes
  180. ;;
  181. --includedir)
  182. echo_includedir=yes
  183. ;;
  184. -g)
  185. debug=-g
  186. ;;
  187. -D*)
  188. CXXFLAGS="$CXXFLAGS $1"
  189. ;;
  190. --compile)
  191. compile="$2"
  192. shift
  193. ;;
  194. --post)
  195. post="$2"
  196. shift
  197. ;;
  198. *)
  199. echo_help=yes
  200. ;;
  201. esac
  202. shift
  203. done
  204. if test "$includedir" != /usr/include; then
  205. includes=-I$includedir
  206. else
  207. includes=
  208. fi
  209. if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then
  210. libs=-L$libdir
  211. else
  212. libs=
  213. fi
  214. # Calculate needed libraries
  215. LDSTATIC="$libdir/libntk.a $LDLIBS"
  216. LDLIBS="-lntk$SHAREDSUFFIX $LDLIBS"
  217. if test x$use_forms = xyes; then
  218. LDLIBS="-lntk_forms$SHAREDSUFFIX $LDLIBS"
  219. LDSTATIC="$libdir/libntk_forms.a $LDSTATIC"
  220. fi
  221. if test x$use_gl = xyes; then
  222. LDLIBS="-lntk_gl$SHAREDSUFFIX @GLLIB@ $LDLIBS"
  223. LDSTATIC="$libdir/libntk_gl.a @GLLIB@ $LDSTATIC"
  224. fi
  225. if test x$use_images = xyes; then
  226. LDLIBS="-lntk_images$SHAREDSUFFIX $IMAGELIBS $LDLIBS"
  227. LDSTATIC="$libdir/libntk_images.a $STATICIMAGELIBS $LDSTATIC"
  228. fi
  229. if test x$use_cairo = xyes; then
  230. LDLIBS="$CAIROLIBS $LDLIBS"
  231. LDSTATIC="$CAIROLIBS $LDSTATIC"
  232. fi
  233. LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS"
  234. LDSTATIC="$LDFLAGS $LDSTATIC"
  235. # Answer to user requests
  236. if test -n "$echo_help"; then
  237. usage 1
  238. fi
  239. if test -n "$compile"; then
  240. case "$compile" in
  241. *.cxx)
  242. prog="`basename \"$compile\" .cxx`"
  243. ;;
  244. *.cpp)
  245. prog="`basename \"$compile\" .cpp`"
  246. ;;
  247. *.cc)
  248. prog="`basename \"$compile\" .cc`"
  249. ;;
  250. *.C)
  251. prog="`basename \"$compile\" .C`"
  252. ;;
  253. *)
  254. echo "ERROR: Unknown/bad C++ source file extension on \"$compile\"!"
  255. exit 1
  256. ;;
  257. esac
  258. post="$prog"
  259. echo $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "'$prog'" "'$compile'" $LDSTATIC
  260. $CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o "$prog" "$compile" $LDSTATIC || exit 1
  261. fi
  262. if test -n "$post"; then
  263. case "`uname`" in
  264. Darwin)
  265. echo Creating "'$post.app'" bundle for desktop...
  266. id=`echo $post | tr ' ' '_'`
  267. # Make the bundle directory and move the executable there
  268. rm -rf "$post.app/Contents/MacOS"
  269. mkdir -p "$post.app/Contents/MacOS"
  270. mv "$post" "$post.app/Contents/MacOS"
  271. # Make a shell script that runs the bundled executable
  272. echo "#!/bin/sh" >"$post"
  273. echo 'dir="`dirname \"$0\"`"' >>"$post"
  274. echo 'exec "$dir/'"$post.app/Contents/MacOS/$post"'" "$@"' >>"$post"
  275. chmod +x "$post"
  276. # Make the simplest Info.plist needed for an application
  277. cat >"$post.app/Contents/Info.plist" <<EOF
  278. <?xml version="1.0" encoding="UTF-8"?>
  279. <plist version="0.9">
  280. <dict>
  281. <key>CFBundleInfoDictionaryVersion</key>
  282. <string>6.0</string>
  283. <key>CFBundleExecutable</key>
  284. <string>$post</string>
  285. <key>CFBundleIdentifier</key>
  286. <string>org.ntk.$id</string>
  287. <key>CFBundleName</key>
  288. <string>$post</string>
  289. <key>CFBundlePackageType</key>
  290. <string>APPL</string>
  291. </dict>
  292. </plist>
  293. EOF
  294. ;;
  295. esac
  296. fi
  297. if test "$echo_cflags" = "yes"; then
  298. echo $includes $CFLAGS
  299. fi
  300. if test "$echo_cxxflags" = "yes"; then
  301. echo $includes $CXXFLAGS
  302. fi
  303. if test "$echo_optim" = "yes"; then
  304. echo $OPTIM
  305. fi
  306. if test "$echo_ldflags" = "yes"; then
  307. my_libs=
  308. libdirs=$libs
  309. for i in $LDLIBS ; do
  310. if test $i != -L$libdir ; then
  311. if test -z "$my_libs" ; then
  312. my_libs="$i"
  313. else
  314. my_libs="$my_libs $i"
  315. fi
  316. fi
  317. done
  318. echo $libdirs $my_libs
  319. fi
  320. if test "$echo_ldstaticflags" = "yes"; then
  321. echo $LDSTATIC
  322. fi
  323. if test "$echo_libs" = "yes"; then
  324. USELIBS="$libdir/libntk.a"
  325. if test x$use_forms = xyes; then
  326. USELIBS="$libdir/libntk_forms.a $USELIBS"
  327. fi
  328. if test x$use_gl = xyes; then
  329. USELIBS="$libdir/libntk_gl.a $USELIBS"
  330. fi
  331. if test x$use_cairo = xyes; then
  332. USELIBS="$USELIBS"
  333. fi
  334. if test x$use_images = xyes; then
  335. USELIBS="$libdir/libntk_images.a $USELIBS"
  336. for lib in ntk_jpeg ntk_png ntk_z; do
  337. if test -f $libdir/lib$lib.a; then
  338. USELIBS="$libdir/lib$lib.a $USELIBS"
  339. fi
  340. done
  341. fi
  342. echo $USELIBS
  343. fi
  344. if test "$echo_prefix" = "yes"; then
  345. echo $prefix
  346. fi
  347. if test "$echo_includedir" = "yes"; then
  348. echo $includedir
  349. fi
  350. #
  351. # End of "$Id: ntk-config.in 8149 2011-01-01 00:10:38Z mike $".
  352. #