1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(Tools/CmdLine/IccDumpProfile/iccDumpProfile.cpp)
3
4dnl Checks for target
5AC_CANONICAL_TARGET
6
7SAMPLEICC_MAJOR_VERSION=1
8SAMPLEICC_MINOR_VERSION=6
9SAMPLEICC_MICRO_VERSION=8
10
11SAMPLEICC_VERSION=$SAMPLEICC_MAJOR_VERSION.$SAMPLEICC_MINOR_VERSION.${SAMPLEICC_MICRO_VERSION}
12AC_SUBST(SAMPLEICC_VERSION)
13
14LIBTOOL_CURRENT=2
15LIBTOOL_REVISION=3
16LIBTOOL_AGE=0
17LIBTOOL_VERSION=$LIBTOOL_CURRENT:$LIBTOOL_REVISION:$LIBTOOL_AGE
18AC_SUBST(LIBTOOL_VERSION)
19
20dnl GNU automake support.
21AM_INIT_AUTOMAKE(SampleICC, ${SAMPLEICC_VERSION})
22AM_MAINTAINER_MODE
23
24dnl Checks for programs.
25AC_PROG_CXX
26AC_PROG_INSTALL
27AC_PROG_CC
28AC_PROG_LN_S
29AM_PROG_LIBTOOL
30AC_PROG_MAKE_SET
31
32dnl Checks for libraries.
33
34dnl Checks for header files.
35AC_HEADER_STDC
36AC_CHECK_HEADERS(limits.h unistd.h)
37
38dnl Checks for typedefs, structures, and compiler characteristics.
39AC_C_CONST
40AC_C_INLINE
41AC_TYPE_SIZE_T
42
43dnl Checks for library functions.
44AC_CHECK_FUNCS(strerror)
45
46dnl Checks for libtiff.
47dnl Basically a cut-and-paste of ab_lib_id3.m4 from Oskar Liljeblad
48dnl (oskar@osk.mine.nu) as published in the autoconf archive, downloadable
49dnl at http://autoconf-archive.cryp.to/ac_lib_id3.m4.
50dnl
51dnl This macro will check for the existence of libtiff
52dnl (http://www.libtiff.org/). It does this by checking for the
53dnl header file tiff.h and the TIFF library object file. A --with-tifflib
54dnl option is supported as well. The following output variables are set
55dnl with AC_SUBST:
56dnl
57dnl   TIFF_CPPFLAGS
58dnl   TIFF_LDFLAGS
59dnl   TIFF_LIBS
60dnl
61dnl You can use them like this in Makefile.am:
62dnl
63dnl   AM_CPPFLAGS = $(TIFF_CPPFLAGS)
64dnl   AM_LDFLAGS = $(TIFF_LDFLAGS)
65dnl   program_LDADD = $(TIFF_LIBS)
66dnl
67dnl Additionally, the C preprocessor symbol HAVE_TIFFLIB will be defined
68dnl with AC_DEFINE if libtiff is available.
69
70AC_DEFUN([AC_LIB_TIFF], [
71  AH_TEMPLATE([HAVE_TIFFLIB], [Define if libtiff is available])
72  AC_ARG_WITH(tifflib, [  --with-tifflib=DIR       prefix for TIFF library files and headers], [
73    if test x"$withval" = "xno"; then
74      ac_tiff_path=
75      $2
76    elif test x"$withval" = x"yes"; then
77      ac_tiff_path=/opt/local
78    else
79      ac_tiff_path="$withval"
80    fi
81  ],[ac_tiff_path=/opt/local])
82  if test x"$ac_tiff_path" != "x"; then
83    saved_CPPFLAGS="$CPPFLAGS"
84    CPPFLAGS="$CPPFLAGS -I$ac_tiff_path/include"
85    AC_CHECK_HEADER([tiff.h], [
86      saved_LDFLAGS="$LDFLAGS"
87      LDFLAGS="$LDFLAGS -L$ac_tiff_path/lib"
88      AC_CHECK_LIB(tiff, TIFFOpen, [
89        AC_SUBST(TIFF_CPPFLAGS, [-I$ac_tiff_path/include])
90        AC_SUBST(TIFF_LDFLAGS, [-L$ac_tiff_path/lib])
91        AC_SUBST(TIFF_LIBS, [-ltiff])
92        AC_SUBST(SICC_ICC_APPLY_PROFILES, [IccApplyProfiles])
93	AC_DEFINE([HAVE_TIFFLIB])
94        $1
95      ], [AC_MSG_WARN([
96*** SampleICC requires a recent version of libtiff (3.6.1 or newer), which
97*** you don't appear to have, if it is to create the iccApplyProfiles
98*** command-line executable.
99***
100*** Interestingly, you have a tiff.h header, but the run-time linker is not
101*** finding libtiff, or it is finding the wrong version, or there is some other
102*** problem trying a test link against libtiff.
103***
104*** If you believe you have the TIFF headers and libraries, but they are not
105*** in the standard locations (e.g. /usr/include or /opt/local/include) then
106*** supply the root of this hierarchy to configure with --with-tifflib.  For
107*** example if you keep the headers in /usr/people/fred/include and the libraries
108*** in /usr/people/fred/lib, then specify --with-tifflib=/usr/people/fred.
109***
110*** On some systems, you'll need
111*** to set your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf
112*** to point to the proper version.  Also, make sure you have run ldconfig if
113*** that is required on your system.
114***
115*** In the meantime, the generated hierarchy of Makefiles will not attempt to
116*** build an iccApplyProfiles command-line executable, but everything else
117*** (the SampleICC library and the other command-line executables) will be built.
118			   ])
119          AC_SUBST(SICC_ICC_APPLY_PROFILES, [])],
120	-lm)
121      LDFLAGS="$saved_LDFLAGS"
122    ], [
123      AC_MSG_WARN([
124*** SampleICC requires the header files and libraries for a recent version of
125*** the TIFF libraries (libtiff 3.6.1 or newer), if it is to create the
126*** iccApplyProfiles command-line executable after it compiles the SampleICC
127*** library and the other command-line executables.
128***
129*** You don't have the expected tiff.h header, so the link-time check for
130*** a static or dynamic TIFF library was skipped.
131***
132*** If you believe you have the TIFF headers and libraries, but they are not
133*** in the standard locations (e.g. /usr/include or /opt/local/include) then
134*** supply the root of this hierarchy to configure with --with-tifflib.  For
135*** example if you keep the headers in /usr/people/fred/include and the libraries
136*** in /usr/people/fred/lib, then specify --with-tifflib=/usr/people/fred.
137***
138*** In the meantime, the generated hierarchy of Makefiles will not attempt to
139*** build an iccApplyProfiles executable, but everything else will be built.
140			   ])
141      AC_SUBST(SICC_ICC_APPLY_PROFILES, [])
142    ])
143    CPPFLAGS="$saved_CPPFLAGS"
144  fi
145])
146
147AC_LIB_TIFF
148
149dnl Platform-specific stuff
150case "$host" in
151*irix*)
152  AC_DEFINE(PLATFORM_IRIX)
153  ;;
154*solaris*)
155  AC_DEFINE(PLATFORM_SUNOS5)
156  ;;
157*osf*)
158  AC_DEFINE(PLATFORM_OSF1)
159  ;;
160*darwin*)
161  AC_DEFINE(PLATFORM_DARWIN_PPC)
162  OSX_APPLICATION_LIBS="-framework ApplicationServices"
163  ;;
164esac
165
166dnl Processor-specific optimizations
167AC_MSG_CHECKING(for processor-specific optimizations)
168case $target_cpu in
169i686) EXTRA_CPU_CFLAGS=$(if $CC -march=i686 -S -o /dev/null -xc /dev/null > /dev/null; then echo "-march=i686"; fi) ;;
170*athlon*)  EXTRA_CPU_CFLAGS=$(if $CC -march=i686 -S -o /dev/null -xc /dev/null > /dev/null; then echo "-march=i686"; fi) ;;
171esac
172AC_MSG_RESULT([$EXTRA_CPU_CFLAGS])
173
174AM_CFLAGS="$EXTRA_OPT_CFLAGS $EXTRA_CPU_CFLAGS"
175AM_CXXFLAGS="$EXTRA_OPT_CFLAGS $EXTRA_CPU_CFLAGS"
176
177AC_SUBST(AM_CFLAGS)
178AC_SUBST(AM_CXXFLAGS)
179AC_SUBST(OSX_APPLICATION_LIBS)
180AC_SUBST(SAMPLEICC_MAJOR_VERSION)
181AC_SUBST(SAMPLEICC_MINOR_VERSION)
182AC_SUBST(SAMPLEICC_MICRO_VERSION)
183
184AC_OUTPUT([
185Makefile
186sampleicc.pc
187IccProfLib/Makefile
188Tools/Makefile
189Tools/CmdLine/Makefile
190Tools/CmdLine/IccApplyNamedCmm/Makefile
191Tools/CmdLine/IccApplyProfiles/Makefile
192Tools/CmdLine/IccDumpProfile/Makefile
193Tools/CmdLine/IccGamutMapGirdle/Makefile
194Tools/CmdLine/IccGetBPCInfo/Makefile
195Tools/CmdLine/IccProfLibTest/Makefile
196Tools/CmdLine/IccRoundTrip/Makefile
197Tools/CmdLine/IccStripUnknownTags/Makefile
198Tools/CmdLine/IccV4ToMPE/Makefile
199Contrib/Makefile
200Contrib/CmdLine/Makefile
201Contrib/CmdLine/create_CLUT_profile/Makefile
202Contrib/CmdLine/create_CLUT_profile_from_probe/Makefile
203Contrib/CmdLine/create_display_profile/Makefile
204Contrib/ICC_utils/Makefile
205Contrib/Mac_OS_X/Makefile
206Contrib/Mac_OS_X/create_probe/Makefile
207Contrib/Mac_OS_X/extract_probe_data/Makefile
208Contrib/examples/Makefile
209Contrib/examples/RSR/Makefile
210Contrib/tests/Makefile
211Contrib/tests/flatten_AToB_tag/Makefile
212Contrib/tests/generate_device_codes/Makefile
213Contrib/tests/reconstruct_measurements/Makefile
214Contrib/tests/round_trip_PCS_LAB/Makefile
215])
216