~ubuntu-branches/ubuntu/feisty/soqt/feisty

« back to all changes in this revision

Viewing changes to cfg/m4/check_pnglib.m4

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2004-05-29 02:58:50 UTC
  • Revision ID: james.westby@ubuntu.com-20040529025850-nkh0l2b0mixwkcgh
Tags: 1.0.2-3
Build against coin-2, rather than coin-1.  Closes: #241102.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# **************************************************************************
 
2
# SIM_AC_HAVE_LIBPNG_IFELSE( IF-FOUND, IF-NOT-FOUND )
 
3
#
 
4
# Variables:
 
5
#   sim_ac_have_libpng
 
6
#   sim_ac_libpng_cppflags
 
7
#   sim_ac_libpng_ldflags
 
8
#   sim_ac_libpng_libs
 
9
#
 
10
# Authors:
 
11
#   Lars J. Aas <larsa@coin3d.org>
 
12
#   Morten Eriksen <mortene@coin3d.org>
 
13
#
 
14
# Todo:
 
15
# - use AS_UNSET to unset internal variables to avoid polluting the environment
 
16
#
 
17
 
 
18
# **************************************************************************
 
19
 
 
20
AC_DEFUN([SIM_AC_HAVE_LIBPNG_IFELSE],
 
21
[: ${sim_ac_have_libpng=false}
 
22
AC_MSG_CHECKING([for libpng])
 
23
AC_ARG_WITH(
 
24
  [png],
 
25
  [AC_HELP_STRING([--with-png=PATH], [enable/disable libpng support])],
 
26
  [case $withval in
 
27
  yes | "") sim_ac_want_libpng=true ;;
 
28
  no)       sim_ac_want_libpng=false ;;
 
29
  *)        sim_ac_want_libpng=true
 
30
            sim_ac_libpng_path=$withval ;;
 
31
  esac],
 
32
  [sim_ac_want_libpng=true])
 
33
case $sim_ac_want_libpng in
 
34
true)
 
35
  $sim_ac_have_libpng && break
 
36
  sim_ac_libpng_save_CPPFLAGS=$CPPFLAGS
 
37
  sim_ac_libpng_save_LDFLAGS=$LDFLAGS
 
38
  sim_ac_libpng_save_LIBS=$LIBS
 
39
  sim_ac_libpng_debug=false
 
40
  test -n "`echo -- $CPPFLAGS $CFLAGS $CXXFLAGS | grep -- '-g\\>'`" &&
 
41
    sim_ac_libpng_debug=true
 
42
  # test -z "$sim_ac_libpng_path" -a x"$prefix" != xNONE &&
 
43
  #   sim_ac_libpng_path=$prefix
 
44
  sim_ac_libpng_name=png
 
45
  if test -n "$sim_ac_libpng_path"; then
 
46
    for sim_ac_libpng_candidate in \
 
47
      `( ls $sim_ac_libpng_path/lib/png*.lib;
 
48
         ls $sim_ac_libpng_path/lib/png*d.lib ) 2>/dev/null`
 
49
    do
 
50
      case $sim_ac_libpng_candidate in
 
51
      *d.lib)
 
52
        $sim_ac_libpng_debug &&
 
53
          sim_ac_libpng_name=`basename $sim_ac_libpng_candidate .lib` ;;
 
54
      *.lib)
 
55
        sim_ac_libpng_name=`basename $sim_ac_libpng_candidate .lib` ;;
 
56
      esac
 
57
    done
 
58
    sim_ac_libpng_cppflags="-I$sim_ac_libpng_path/include"
 
59
    CPPFLAGS="$sim_ac_libpng_cppflags $CPPFLAGS"
 
60
    sim_ac_libpng_ldflags="-L$sim_ac_libpng_path/lib"
 
61
    LDFLAGS="$sim_ac_libpng_ldflags $LDFLAGS"
 
62
    # unset sim_ac_libpng_candidate
 
63
    # unset sim_ac_libpng_path
 
64
  fi
 
65
  sim_ac_libpng_libs="-l$sim_ac_libpng_name"
 
66
  LIBS="$sim_ac_libpng_libs $LIBS"
 
67
  AC_TRY_LINK(
 
68
    [#include <png.h>],
 
69
    [(void)png_read_info(0L, 0L);],
 
70
    [sim_ac_have_libpng=true])
 
71
  CPPFLAGS=$sim_ac_libpng_save_CPPFLAGS
 
72
  LDFLAGS=$sim_ac_libpng_save_LDFLAGS
 
73
  LIBS=$sim_ac_libpng_save_LIBS
 
74
  # unset sim_ac_libpng_debug
 
75
  # unset sim_ac_libpng_name
 
76
  # unset sim_ac_libpng_save_CPPFLAGS
 
77
  # unset sim_ac_libpng_save_LDFLAGS
 
78
  # unset sim_ac_libpng_save_LIBS
 
79
  ;;
 
80
esac
 
81
if $sim_ac_want_libpng; then
 
82
  if $sim_ac_have_libpng; then
 
83
    AC_MSG_RESULT([success ($sim_ac_libpng_libs)])
 
84
    $1
 
85
  else
 
86
    AC_MSG_RESULT([failure])
 
87
    $2
 
88
  fi
 
89
else
 
90
  AC_MSG_RESULT([disabled])
 
91
  $2
 
92
fi
 
93
# unset sim_ac_want_libpng
 
94
])
 
95
 
 
96
# **************************************************************************
 
97
# Usage:
 
98
#  SIM_AC_CHECK_PNG_READY([ACTION-IF-READY[, ACTION-IF-NOT-READY]])
 
99
#
 
100
#  Try to link code which needs the PNG development system.
 
101
#
 
102
# Author: Morten Eriksen, <mortene@sim.no>.
 
103
 
 
104
AC_DEFUN([SIM_AC_CHECK_PNG_READY],
 
105
[AC_MSG_CHECKING([if we can use libpng without explicit linkage])
 
106
AC_TRY_LINK(
 
107
  [#include <png.h>],
 
108
  [(void)png_read_info(0L, 0L);],
 
109
  sim_ac_png_ready=true,
 
110
  sim_ac_png_ready=false)
 
111
if $sim_ac_png_ready; then
 
112
  AC_MSG_RESULT([yes])
 
113
  $1
 
114
else
 
115
  AC_MSG_RESULT([no])
 
116
  $2
 
117
fi
 
118
])
 
119
 
 
120
# EOF **********************************************************************