1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(src/main.cc)
3AC_CANONICAL_SYSTEM
4AM_INIT_AUTOMAKE(steghide, 0.5.1)
5AM_CONFIG_HEADER(config.h)
6
7dnl checks for programs.
8AC_PROG_CXX
9AC_PROG_INSTALL
10AC_PROG_AWK
11AC_PROG_LN_S
12
13dnl GNU gettext
14AC_CHECK_FUNCS(strchr)
15AM_GNU_GETTEXT
16AM_CONDITIONAL(USE_INTLDIR, test "$nls_cv_use_gnu_gettext" = yes)
17
18dnl check if debugging support is requested
19AC_MSG_CHECKING([wether to enable debugging])
20AC_ARG_ENABLE(debug,[  --enable-debug          enable debugging],
21	if test "$enableval" = yes ;
22	then
23		AC_MSG_RESULT([yes])
24		AC_DEFINE(DEBUG,1,[enable code used only for debugging])
25		CXXFLAGS="-O2 -Wall -g"
26	else
27		AC_MSG_RESULT([no])
28		CXXFLAGS="-O2 -Wall"
29	fi
30	,
31	AC_MSG_RESULT([no])
32	CXXFLAGS="-O2 -Wall"
33)
34
35dnl check if randomness should be disabled
36AC_MSG_CHECKING([wether to disable randomness])
37AC_ARG_ENABLE(randomness,[  --disable-randomness    disable randomness making every run exactly reproducible],
38		if test "$enableval" = yes ;
39		then
40			AC_MSG_RESULT([no])
41		else
42			AC_MSG_RESULT([yes])
43			AC_DEFINE(NORANDOM,1,[disable randomness making every run exactly reproducible])
44		fi
45		,
46		AC_MSG_RESULT([no])
47)
48
49dnl Checks for header files.
50AC_HEADER_STDC
51AC_HEADER_SYS_WAIT
52AC_CHECK_HEADERS(limits.h termios.h)
53
54dnl Checks for typedefs, structures, and compiler characteristics.
55AC_C_CONST
56AC_TYPE_SIZE_T
57
58dnl Check size of types
59AC_CHECK_SIZEOF(unsigned long int)
60AC_CHECK_SIZEOF(long int)
61AC_CHECK_SIZEOF(unsigned int)
62AC_CHECK_SIZEOF(int)
63AC_CHECK_SIZEOF(unsigned short int)
64AC_CHECK_SIZEOF(short int)
65AC_CHECK_SIZEOF(unsigned char)
66AC_CHECK_SIZEOF(signed char)
67
68dnl searching for unsigned 32 bit integer
69if test "$ac_cv_sizeof_unsigned_int" = 4;
70then
71	AC_DEFINE(TYPE_UWORD32,[unsigned int],[type of unsigned word with 32 bits])
72else
73if test "$ac_cv_sizeof_unsigned_long_int" = 4;
74then
75	AC_DEFINE(TYPE_UWORD32,[unsigned long int],[type of unsigned word with 32 bits])
76else
77	AC_MSG_ERROR([[There is no unsigned integer type with a size of 32 bits on your system. Cannot compile.]])
78fi
79fi
80
81dnl searching for signed 32 bit integer
82if test "$ac_cv_sizeof_int" = 4;
83then
84	AC_DEFINE(TYPE_SWORD32,[int],[type of signed word with 32 bits])
85else
86if test "$ac_cv_sizeof_long_int" = 4;
87then
88	AC_DEFINE(TYPE_SWORD32,[long int],[type of signed word with 32 bits])
89else
90	AC_MSG_ERROR([[There is no signed integer type with a size of 32 bits on your system. Cannot compile.]])
91fi
92fi
93
94dnl searching for unsigned 16 bit integer
95if test "$ac_cv_sizeof_unsigned_short_int" = 2;
96then
97	AC_DEFINE(TYPE_UWORD16,[unsigned short int],[type of unsigned word with 16 bits])
98else
99if test "$ac_cv_sizeof_unsigned_int" = 2;
100then
101	AC_DEFINE(TYPE_UWORD16,[unsigned int],[type of unsigned word with 16 bits])
102else
103	AC_MSG_ERROR([[There is no unsigned integer type with a size of 16 bits on your system. Cannot compile.]])
104fi
105fi
106
107dnl searching for signed 16 bit integer
108if test "$ac_cv_sizeof_short_int" = 2;
109then
110	AC_DEFINE(TYPE_SWORD16,[short int],[type of signed word with 16 bits])
111else
112if test "$ac_cv_sizeof_int" = 2;
113then
114	AC_DEFINE(TYPE_SWORD16,[int],[type of signed word with 16 bits])
115else
116	AC_MSG_ERROR([[There is no signed integer type with a size of 16 bits on your system. Cannot compile.]])
117fi
118fi
119
120dnl searching for unsigned 8 bit character
121if test "$ac_cv_sizeof_unsigned_char" = 1;
122then
123	AC_DEFINE(TYPE_BYTE,[unsigned char],[type of unsigned byte])
124else
125	AC_MSG_ERROR([[There is no unsigned character type with a size of 8 bits on your system. Cannot compile.]])
126fi
127
128dnl searching for signed 8 bit character
129if test "$ac_cv_sizeof_signed_char" = 1;
130then
131	AC_DEFINE(TYPE_SBYTE,[signed char],[type of signed byte])
132else
133	AC_MSG_ERROR([[There is no signed character type with a size of 8 bits on your system. Cannot compile.]])
134fi
135
136dnl check for doxygen
137AC_CHECK_PROG(ac_cv_prog_doxygen, "doxygen", yes, no)
138AM_CONDITIONAL(HAVE_DOXYGEN, test "$ac_cv_prog_doxygen" = yes)
139
140dnl check for perl
141AC_CHECK_PROG(ac_cv_prog_perl, "perl", yes, no)
142AM_CONDITIONAL(HAVE_PERL, test "$ac_cv_prog_perl" = yes)
143
144dnl Check for random sources
145AC_CHECK_FILE(/dev/urandom, [AC_DEFINE(HAVE_DEV_URANDOM,1,/dev/urandom is available)])
146AC_CHECK_FILE(/dev/random, [AC_DEFINE(HAVE_DEV_RANDOM,1,/dev/random is available)])
147
148dnl Checks for library functions.
149AC_FUNC_VPRINTF
150AC_CHECK_FUNCS(tcgetattr tcsetattr strtoul)
151
152dnl system-specific settings
153case "${target}" in
154	*-cygwin*)
155	AC_DEFINE(WIN32,1,target system is win32)
156	;;
157esac
158
159dnl Check for zlib
160AC_CHECK_LIB(z, zlibVersion)
161AC_CHECK_HEADER(zlib.h)
162
163dnl Check for libmhash
164AC_CHECK_LIB(mhash, mhash_init)
165AC_CHECK_HEADER(mhash.h)
166
167dnl Check for libmcrypt
168AC_CHECK_LIB(mcrypt, mcrypt_generic, , ,)
169AC_CHECK_HEADER(mcrypt.h)
170
171dnl Check for libjpeg
172AC_CHECK_LIB(jpeg, jpeg_read_coefficients)
173AC_CHECK_HEADER(jpeglib.h)
174
175dnl evaluate library tests
176if test "$ac_cv_header_jpeglib_h" = no || test "$ac_cv_lib_jpeg_jpeg_read_coefficients" = no ;
177then
178	echo "**********";
179	echo "libjpeg could not be found on your system. Steghide will be compiled without";
180	echo "support for jpeg files. You will not be able to read or write jpeg files!";
181	echo "libjpeg can be downloaded from http://www.ijg.org/";
182	echo "**********";
183else
184	AC_DEFINE(USE_LIBJPEG,1,[use the libjpeg library (header and lib are present)])
185fi
186
187if test "$ac_cv_header_mcrypt_h" = no || test "$ac_cv_lib_mcrypt_mcrypt_module_open" = no ;
188then
189	echo "**********";
190	echo "libmcrypt could not be found on your system. Steghide will be compiled without";
191	echo "support for encryption. You will not be able to extract encrypted data!";
192	echo "libmcrypt can be downloaded from http://mcrypt.sourceforge.net/";
193	echo "**********";
194else
195	AC_DEFINE(USE_LIBMCRYPT,1,[use the libmcrypt library (header and lib are present)])
196fi
197
198if test "$ac_cv_header_zlib_h" = no || test "$ac_cv_lib_z_zlibVersion" = no ;
199then
200	echo "**********";
201	echo "zlib could not be found on your system. Steghide will be compiled without";
202	echo "the ability to compress and uncompress embedded data!";
203	echo "zlib can be downloaded from http://www.gzip.org/zlib/";
204	echo "**********";
205else
206	AC_DEFINE(USE_ZLIB,1,[use the z compression library (header and lib are present)])
207fi
208
209if test "$ac_cv_header_mhash_h" = no || test "$ac_cv_lib_mhash_mhash_init" = no ;
210then
211	echo "**********";
212	echo "libmhash could not be found on your system but is needed to compile steghide.";
213	echo "libmhash can be downloaded from http://mhash.sourceforge.net/.";
214	echo "**********";
215	AC_MSG_ERROR([[libmhash not found]])
216fi
217
218dnl create Makefiles
219AC_OUTPUT([Makefile steghide.spec steghide.doxygen doc/Makefile po/Makefile.in src/Makefile tests/Makefile tests/data/Makefile m4/Makefile intl/Makefile])
220