diff options
author | jin-eld <jin at mediatomb dot cc> | 2013-08-13 21:55:32 +0300 |
---|---|---|
committer | jin-eld <jin at mediatomb dot cc> | 2013-08-24 03:25:07 +0300 |
commit | 50c8a820e5ab46acc129a49ab849f8848e40d915 (patch) | |
tree | 4eb66794fd31fd96cf0ac0c6cbb01bca5e122283 | |
parent | e658892793c42b2d058eed0937025ef2ddaaa372 (diff) |
Implemented autotools based build scripts
supported options:
--with-dependency-search=DIR will tell configure to look for various
dependencies in DIR/include and DIR/lib
Alternatively you can also specify libsodium header and libs location
with --with-libsodium-headers and --with-libsodium-libs if it is
installed elsewhere.
Ncurses and libconfig are handled via the default pkg-config way, see
./configure --help=short for detailed information.
The tox library is compiled as libtoxcore in shared and static variants,
public headers are installed to ${prefix}/include/tox
A pkg-config libtoxcore.pc configuration file is provided.
Use ./configure --help for a full list of configure options or
./configure --help=short for the options that I added.
To generate the configure script after pulling from git use:
autoreconf -i
To generate a release tarball use:
make dist
Unit tests are handled by the libcheck library integration that is provided
by autotools, use:
make check
to compile and run the tests.
Unit tests are currently optional, i.e. - if the check library is not
found on the system, then tests will be disabled. Same goes for nTox and
DHT bootstrap daemon - they will be enabled or disabled depending on the
availability of ncurses (for nTox) or libconfig (for DHT bootstrap
daemon).
The above can be also tuned by:
--enable-tests / --disable-tests
--enable-ntox / --disable-ntox
--enable-dht-bootstrap-daemon / --disable-dht-bootstrap-daemon
-rw-r--r-- | .gitignore | 24 | ||||
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | AUTHORS | 0 | ||||
-rw-r--r-- | ChangeLog | 0 | ||||
-rw-r--r-- | INSTALL | 365 | ||||
-rw-r--r-- | Makefile.am | 31 | ||||
-rw-r--r-- | NEWS | 0 | ||||
l--------- | README | 1 | ||||
-rw-r--r-- | auto_tests/Makefile.inc | 39 | ||||
-rw-r--r-- | build/Makefile.am | 10 | ||||
-rw-r--r-- | configure.ac | 336 | ||||
-rw-r--r-- | libtoxcore.pc.in | 12 | ||||
-rw-r--r-- | m4/pkg.m4 | 199 | ||||
-rw-r--r-- | other/Makefile.inc | 20 | ||||
-rw-r--r-- | other/bootstrap_serverdaemon/Makefile.inc | 27 | ||||
-rw-r--r-- | testing/Makefile.inc | 97 | ||||
-rw-r--r-- | toxcore/Makefile.inc | 42 |
17 files changed, 1203 insertions, 2 deletions
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | //nacl build | 3 | //nacl build |
4 | nacl/build/ | 4 | nacl/build/ |
5 | build | 5 | build/ |
6 | !build/Makefile.am | ||
6 | sodium | 7 | sodium |
7 | 8 | ||
8 | CMakeCache.txt | 9 | CMakeCache.txt |
@@ -22,11 +23,32 @@ tags | |||
22 | 23 | ||
23 | # Object files | 24 | # Object files |
24 | *.o | 25 | *.o |
26 | *.lo | ||
27 | *.a | ||
25 | 28 | ||
26 | # Executables | 29 | # Executables |
27 | *.exe | 30 | *.exe |
28 | *.out | 31 | *.out |
29 | *.app | 32 | *.app |
33 | *.swp | ||
34 | *.la | ||
35 | |||
36 | m4/* | ||
37 | !m4/pkg.m4 | ||
38 | configure | ||
39 | configure_aux | ||
40 | Makefile.in | ||
41 | aclocal.m4 | ||
42 | config.h* | ||
43 | config.log | ||
44 | config.status | ||
45 | stamp-h1 | ||
46 | autom4te.cache | ||
47 | libtoxcore.pc | ||
48 | libtool | ||
49 | |||
50 | .deps | ||
51 | .libs | ||
30 | 52 | ||
31 | #netbeans | 53 | #netbeans |
32 | nbproject | 54 | nbproject |
diff --git a/.travis.yml b/.travis.yml index c8b479f8..85b3251e 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -27,7 +27,7 @@ before_script: | |||
27 | - sudo apt-get install check | 27 | - sudo apt-get install check |
28 | 28 | ||
29 | script: | 29 | script: |
30 | - mkdir build && cd build | 30 | - mkdir -p build && cd build |
31 | - cmake .. | 31 | - cmake .. |
32 | - make -j3 | 32 | - make -j3 |
33 | - make test | 33 | - make test |
diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/AUTHORS | |||
diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/ChangeLog | |||
diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..7d1c323b --- /dev/null +++ b/INSTALL | |||
@@ -0,0 +1,365 @@ | |||
1 | Installation Instructions | ||
2 | ************************* | ||
3 | |||
4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, | ||
5 | 2006, 2007, 2008, 2009 Free Software Foundation, Inc. | ||
6 | |||
7 | Copying and distribution of this file, with or without modification, | ||
8 | are permitted in any medium without royalty provided the copyright | ||
9 | notice and this notice are preserved. This file is offered as-is, | ||
10 | without warranty of any kind. | ||
11 | |||
12 | Basic Installation | ||
13 | ================== | ||
14 | |||
15 | Briefly, the shell commands `./configure; make; make install' should | ||
16 | configure, build, and install this package. The following | ||
17 | more-detailed instructions are generic; see the `README' file for | ||
18 | instructions specific to this package. Some packages provide this | ||
19 | `INSTALL' file but do not implement all of the features documented | ||
20 | below. The lack of an optional feature in a given package is not | ||
21 | necessarily a bug. More recommendations for GNU packages can be found | ||
22 | in *note Makefile Conventions: (standards)Makefile Conventions. | ||
23 | |||
24 | The `configure' shell script attempts to guess correct values for | ||
25 | various system-dependent variables used during compilation. It uses | ||
26 | those values to create a `Makefile' in each directory of the package. | ||
27 | It may also create one or more `.h' files containing system-dependent | ||
28 | definitions. Finally, it creates a shell script `config.status' that | ||
29 | you can run in the future to recreate the current configuration, and a | ||
30 | file `config.log' containing compiler output (useful mainly for | ||
31 | debugging `configure'). | ||
32 | |||
33 | It can also use an optional file (typically called `config.cache' | ||
34 | and enabled with `--cache-file=config.cache' or simply `-C') that saves | ||
35 | the results of its tests to speed up reconfiguring. Caching is | ||
36 | disabled by default to prevent problems with accidental use of stale | ||
37 | cache files. | ||
38 | |||
39 | If you need to do unusual things to compile the package, please try | ||
40 | to figure out how `configure' could check whether to do them, and mail | ||
41 | diffs or instructions to the address given in the `README' so they can | ||
42 | be considered for the next release. If you are using the cache, and at | ||
43 | some point `config.cache' contains results you don't want to keep, you | ||
44 | may remove or edit it. | ||
45 | |||
46 | The file `configure.ac' (or `configure.in') is used to create | ||
47 | `configure' by a program called `autoconf'. You need `configure.ac' if | ||
48 | you want to change it or regenerate `configure' using a newer version | ||
49 | of `autoconf'. | ||
50 | |||
51 | The simplest way to compile this package is: | ||
52 | |||
53 | 1. `cd' to the directory containing the package's source code and type | ||
54 | `./configure' to configure the package for your system. | ||
55 | |||
56 | Running `configure' might take a while. While running, it prints | ||
57 | some messages telling which features it is checking for. | ||
58 | |||
59 | 2. Type `make' to compile the package. | ||
60 | |||
61 | 3. Optionally, type `make check' to run any self-tests that come with | ||
62 | the package, generally using the just-built uninstalled binaries. | ||
63 | |||
64 | 4. Type `make install' to install the programs and any data files and | ||
65 | documentation. When installing into a prefix owned by root, it is | ||
66 | recommended that the package be configured and built as a regular | ||
67 | user, and only the `make install' phase executed with root | ||
68 | privileges. | ||
69 | |||
70 | 5. Optionally, type `make installcheck' to repeat any self-tests, but | ||
71 | this time using the binaries in their final installed location. | ||
72 | This target does not install anything. Running this target as a | ||
73 | regular user, particularly if the prior `make install' required | ||
74 | root privileges, verifies that the installation completed | ||
75 | correctly. | ||
76 | |||
77 | 6. You can remove the program binaries and object files from the | ||
78 | source code directory by typing `make clean'. To also remove the | ||
79 | files that `configure' created (so you can compile the package for | ||
80 | a different kind of computer), type `make distclean'. There is | ||
81 | also a `make maintainer-clean' target, but that is intended mainly | ||
82 | for the package's developers. If you use it, you may have to get | ||
83 | all sorts of other programs in order to regenerate files that came | ||
84 | with the distribution. | ||
85 | |||
86 | 7. Often, you can also type `make uninstall' to remove the installed | ||
87 | files again. In practice, not all packages have tested that | ||
88 | uninstallation works correctly, even though it is required by the | ||
89 | GNU Coding Standards. | ||
90 | |||
91 | 8. Some packages, particularly those that use Automake, provide `make | ||
92 | distcheck', which can by used by developers to test that all other | ||
93 | targets like `make install' and `make uninstall' work correctly. | ||
94 | This target is generally not run by end users. | ||
95 | |||
96 | Compilers and Options | ||
97 | ===================== | ||
98 | |||
99 | Some systems require unusual options for compilation or linking that | ||
100 | the `configure' script does not know about. Run `./configure --help' | ||
101 | for details on some of the pertinent environment variables. | ||
102 | |||
103 | You can give `configure' initial values for configuration parameters | ||
104 | by setting variables in the command line or in the environment. Here | ||
105 | is an example: | ||
106 | |||
107 | ./configure CC=c99 CFLAGS=-g LIBS=-lposix | ||
108 | |||
109 | *Note Defining Variables::, for more details. | ||
110 | |||
111 | Compiling For Multiple Architectures | ||
112 | ==================================== | ||
113 | |||
114 | You can compile the package for more than one kind of computer at the | ||
115 | same time, by placing the object files for each architecture in their | ||
116 | own directory. To do this, you can use GNU `make'. `cd' to the | ||
117 | directory where you want the object files and executables to go and run | ||
118 | the `configure' script. `configure' automatically checks for the | ||
119 | source code in the directory that `configure' is in and in `..'. This | ||
120 | is known as a "VPATH" build. | ||
121 | |||
122 | With a non-GNU `make', it is safer to compile the package for one | ||
123 | architecture at a time in the source code directory. After you have | ||
124 | installed the package for one architecture, use `make distclean' before | ||
125 | reconfiguring for another architecture. | ||
126 | |||
127 | On MacOS X 10.5 and later systems, you can create libraries and | ||
128 | executables that work on multiple system types--known as "fat" or | ||
129 | "universal" binaries--by specifying multiple `-arch' options to the | ||
130 | compiler but only a single `-arch' option to the preprocessor. Like | ||
131 | this: | ||
132 | |||
133 | ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ | ||
134 | CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ | ||
135 | CPP="gcc -E" CXXCPP="g++ -E" | ||
136 | |||
137 | This is not guaranteed to produce working output in all cases, you | ||
138 | may have to build one architecture at a time and combine the results | ||
139 | using the `lipo' tool if you have problems. | ||
140 | |||
141 | Installation Names | ||
142 | ================== | ||
143 | |||
144 | By default, `make install' installs the package's commands under | ||
145 | `/usr/local/bin', include files under `/usr/local/include', etc. You | ||
146 | can specify an installation prefix other than `/usr/local' by giving | ||
147 | `configure' the option `--prefix=PREFIX', where PREFIX must be an | ||
148 | absolute file name. | ||
149 | |||
150 | You can specify separate installation prefixes for | ||
151 | architecture-specific files and architecture-independent files. If you | ||
152 | pass the option `--exec-prefix=PREFIX' to `configure', the package uses | ||
153 | PREFIX as the prefix for installing programs and libraries. | ||
154 | Documentation and other data files still use the regular prefix. | ||
155 | |||
156 | In addition, if you use an unusual directory layout you can give | ||
157 | options like `--bindir=DIR' to specify different values for particular | ||
158 | kinds of files. Run `configure --help' for a list of the directories | ||
159 | you can set and what kinds of files go in them. In general, the | ||
160 | default for these options is expressed in terms of `${prefix}', so that | ||
161 | specifying just `--prefix' will affect all of the other directory | ||
162 | specifications that were not explicitly provided. | ||
163 | |||
164 | The most portable way to affect installation locations is to pass the | ||
165 | correct locations to `configure'; however, many packages provide one or | ||
166 | both of the following shortcuts of passing variable assignments to the | ||
167 | `make install' command line to change installation locations without | ||
168 | having to reconfigure or recompile. | ||
169 | |||
170 | The first method involves providing an override variable for each | ||
171 | affected directory. For example, `make install | ||
172 | prefix=/alternate/directory' will choose an alternate location for all | ||
173 | directory configuration variables that were expressed in terms of | ||
174 | `${prefix}'. Any directories that were specified during `configure', | ||
175 | but not in terms of `${prefix}', must each be overridden at install | ||
176 | time for the entire installation to be relocated. The approach of | ||
177 | makefile variable overrides for each directory variable is required by | ||
178 | the GNU Coding Standards, and ideally causes no recompilation. | ||
179 | However, some platforms have known limitations with the semantics of | ||
180 | shared libraries that end up requiring recompilation when using this | ||
181 | method, particularly noticeable in packages that use GNU Libtool. | ||
182 | |||
183 | The second method involves providing the `DESTDIR' variable. For | ||
184 | example, `make install DESTDIR=/alternate/directory' will prepend | ||
185 | `/alternate/directory' before all installation names. The approach of | ||
186 | `DESTDIR' overrides is not required by the GNU Coding Standards, and | ||
187 | does not work on platforms that have drive letters. On the other hand, | ||
188 | it does better at avoiding recompilation issues, and works well even | ||
189 | when some directory options were not specified in terms of `${prefix}' | ||
190 | at `configure' time. | ||
191 | |||
192 | Optional Features | ||
193 | ================= | ||
194 | |||
195 | If the package supports it, you can cause programs to be installed | ||
196 | with an extra prefix or suffix on their names by giving `configure' the | ||
197 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. | ||
198 | |||
199 | Some packages pay attention to `--enable-FEATURE' options to | ||
200 | `configure', where FEATURE indicates an optional part of the package. | ||
201 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE | ||
202 | is something like `gnu-as' or `x' (for the X Window System). The | ||
203 | `README' should mention any `--enable-' and `--with-' options that the | ||
204 | package recognizes. | ||
205 | |||
206 | For packages that use the X Window System, `configure' can usually | ||
207 | find the X include and library files automatically, but if it doesn't, | ||
208 | you can use the `configure' options `--x-includes=DIR' and | ||
209 | `--x-libraries=DIR' to specify their locations. | ||
210 | |||
211 | Some packages offer the ability to configure how verbose the | ||
212 | execution of `make' will be. For these packages, running `./configure | ||
213 | --enable-silent-rules' sets the default to minimal output, which can be | ||
214 | overridden with `make V=1'; while running `./configure | ||
215 | --disable-silent-rules' sets the default to verbose, which can be | ||
216 | overridden with `make V=0'. | ||
217 | |||
218 | Particular systems | ||
219 | ================== | ||
220 | |||
221 | On HP-UX, the default C compiler is not ANSI C compatible. If GNU | ||
222 | CC is not installed, it is recommended to use the following options in | ||
223 | order to use an ANSI C compiler: | ||
224 | |||
225 | ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" | ||
226 | |||
227 | and if that doesn't work, install pre-built binaries of GCC for HP-UX. | ||
228 | |||
229 | On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot | ||
230 | parse its `<wchar.h>' header file. The option `-nodtk' can be used as | ||
231 | a workaround. If GNU CC is not installed, it is therefore recommended | ||
232 | to try | ||
233 | |||
234 | ./configure CC="cc" | ||
235 | |||
236 | and if that doesn't work, try | ||
237 | |||
238 | ./configure CC="cc -nodtk" | ||
239 | |||
240 | On Solaris, don't put `/usr/ucb' early in your `PATH'. This | ||
241 | directory contains several dysfunctional programs; working variants of | ||
242 | these programs are available in `/usr/bin'. So, if you need `/usr/ucb' | ||
243 | in your `PATH', put it _after_ `/usr/bin'. | ||
244 | |||
245 | On Haiku, software installed for all users goes in `/boot/common', | ||
246 | not `/usr/local'. It is recommended to use the following options: | ||
247 | |||
248 | ./configure --prefix=/boot/common | ||
249 | |||
250 | Specifying the System Type | ||
251 | ========================== | ||
252 | |||
253 | There may be some features `configure' cannot figure out | ||
254 | automatically, but needs to determine by the type of machine the package | ||
255 | will run on. Usually, assuming the package is built to be run on the | ||
256 | _same_ architectures, `configure' can figure that out, but if it prints | ||
257 | a message saying it cannot guess the machine type, give it the | ||
258 | `--build=TYPE' option. TYPE can either be a short name for the system | ||
259 | type, such as `sun4', or a canonical name which has the form: | ||
260 | |||
261 | CPU-COMPANY-SYSTEM | ||
262 | |||
263 | where SYSTEM can have one of these forms: | ||
264 | |||
265 | OS | ||
266 | KERNEL-OS | ||
267 | |||
268 | See the file `config.sub' for the possible values of each field. If | ||
269 | `config.sub' isn't included in this package, then this package doesn't | ||
270 | need to know the machine type. | ||
271 | |||
272 | If you are _building_ compiler tools for cross-compiling, you should | ||
273 | use the option `--target=TYPE' to select the type of system they will | ||
274 | produce code for. | ||
275 | |||
276 | If you want to _use_ a cross compiler, that generates code for a | ||
277 | platform different from the build platform, you should specify the | ||
278 | "host" platform (i.e., that on which the generated programs will | ||
279 | eventually be run) with `--host=TYPE'. | ||
280 | |||
281 | Sharing Defaults | ||
282 | ================ | ||
283 | |||
284 | If you want to set default values for `configure' scripts to share, | ||
285 | you can create a site shell script called `config.site' that gives | ||
286 | default values for variables like `CC', `cache_file', and `prefix'. | ||
287 | `configure' looks for `PREFIX/share/config.site' if it exists, then | ||
288 | `PREFIX/etc/config.site' if it exists. Or, you can set the | ||
289 | `CONFIG_SITE' environment variable to the location of the site script. | ||
290 | A warning: not all `configure' scripts look for a site script. | ||
291 | |||
292 | Defining Variables | ||
293 | ================== | ||
294 | |||
295 | Variables not defined in a site shell script can be set in the | ||
296 | environment passed to `configure'. However, some packages may run | ||
297 | configure again during the build, and the customized values of these | ||
298 | variables may be lost. In order to avoid this problem, you should set | ||
299 | them in the `configure' command line, using `VAR=value'. For example: | ||
300 | |||
301 | ./configure CC=/usr/local2/bin/gcc | ||
302 | |||
303 | causes the specified `gcc' to be used as the C compiler (unless it is | ||
304 | overridden in the site shell script). | ||
305 | |||
306 | Unfortunately, this technique does not work for `CONFIG_SHELL' due to | ||
307 | an Autoconf bug. Until the bug is fixed you can use this workaround: | ||
308 | |||
309 | CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash | ||
310 | |||
311 | `configure' Invocation | ||
312 | ====================== | ||
313 | |||
314 | `configure' recognizes the following options to control how it | ||
315 | operates. | ||
316 | |||
317 | `--help' | ||
318 | `-h' | ||
319 | Print a summary of all of the options to `configure', and exit. | ||
320 | |||
321 | `--help=short' | ||
322 | `--help=recursive' | ||
323 | Print a summary of the options unique to this package's | ||
324 | `configure', and exit. The `short' variant lists options used | ||
325 | only in the top level, while the `recursive' variant lists options | ||
326 | also present in any nested packages. | ||
327 | |||
328 | `--version' | ||
329 | `-V' | ||
330 | Print the version of Autoconf used to generate the `configure' | ||
331 | script, and exit. | ||
332 | |||
333 | `--cache-file=FILE' | ||
334 | Enable the cache: use and save the results of the tests in FILE, | ||
335 | traditionally `config.cache'. FILE defaults to `/dev/null' to | ||
336 | disable caching. | ||
337 | |||
338 | `--config-cache' | ||
339 | `-C' | ||
340 | Alias for `--cache-file=config.cache'. | ||
341 | |||
342 | `--quiet' | ||
343 | `--silent' | ||
344 | `-q' | ||
345 | Do not print messages saying which checks are being made. To | ||
346 | suppress all normal output, redirect it to `/dev/null' (any error | ||
347 | messages will still be shown). | ||
348 | |||
349 | `--srcdir=DIR' | ||
350 | Look for the package's source code in directory DIR. Usually | ||
351 | `configure' can determine that directory automatically. | ||
352 | |||
353 | `--prefix=DIR' | ||
354 | Use DIR as the installation prefix. *note Installation Names:: | ||
355 | for more details, including other options available for fine-tuning | ||
356 | the installation locations. | ||
357 | |||
358 | `--no-create' | ||
359 | `-n' | ||
360 | Run the configure checks, but stop before creating any output | ||
361 | files. | ||
362 | |||
363 | `configure' also accepts some other, not widely useful, options. Run | ||
364 | `configure --help' for more details. | ||
365 | |||
diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..7bead885 --- /dev/null +++ b/Makefile.am | |||
@@ -0,0 +1,31 @@ | |||
1 | SUBDIRS = build | ||
2 | |||
3 | ACLOCAL_AMFLAGS = -I m4 | ||
4 | |||
5 | pkgconfigdir = $(libdir)/pkgconfig | ||
6 | pkgconfig_DATA = $(top_srcdir)/libtoxcore.pc | ||
7 | |||
8 | BUILT_SOURCES = $(top_srcdir)/libtoxcore.pc | ||
9 | CLEANFILES = $(top_srcdir)/libtoxcore.pc | ||
10 | |||
11 | |||
12 | EXTRA_DIST = \ | ||
13 | $(top_srcdir)/libtoxcore.pc.in \ | ||
14 | $(top_srcdir)/cmake/FindCheck.cmake \ | ||
15 | $(top_srcdir)/cmake/FindLIBCONFIG.cmake \ | ||
16 | $(top_srcdir)/cmake/FindSphinx.cmake \ | ||
17 | $(top_srcdir)/cmake/FindSODIUM.cmake \ | ||
18 | $(top_srcdir)/cmake/FindNaCl.cmake \ | ||
19 | $(top_srcdir)/cmake/FindCursesw.cmake \ | ||
20 | $(top_srcdir)/docs/CMakeLists.txt \ | ||
21 | $(top_srcdir)/docs/commands.rst \ | ||
22 | $(top_srcdir)/docs/conf.py.in \ | ||
23 | $(top_srcdir)/docs/index.rst \ | ||
24 | $(top_srcdir)/docs/install.rst \ | ||
25 | $(top_srcdir)/docs/start_guide.de.rst \ | ||
26 | $(top_srcdir)/docs/start_guide.rst \ | ||
27 | $(top_srcdir)/CMakeLists.txt \ | ||
28 | $(top_srcdir)/tools/README \ | ||
29 | $(top_srcdir)/tools/astylerc \ | ||
30 | $(top_srcdir)/tools/pre-commit | ||
31 | |||
@@ -0,0 +1 @@ | |||
README.md \ No newline at end of file | |||
diff --git a/auto_tests/Makefile.inc b/auto_tests/Makefile.inc new file mode 100644 index 00000000..c15f1089 --- /dev/null +++ b/auto_tests/Makefile.inc | |||
@@ -0,0 +1,39 @@ | |||
1 | if BUILD_TESTS | ||
2 | |||
3 | TESTS = messenger_autotest crypto_test | ||
4 | |||
5 | check_PROGRAMS = messenger_autotest crypto_test | ||
6 | |||
7 | messenger_autotest_SOURCES = \ | ||
8 | $(top_srcdir)/auto_tests/messenger_test.c | ||
9 | |||
10 | messenger_autotest_CFLAGS = \ | ||
11 | $(LIBSODIUM_CFLAGS) \ | ||
12 | $(CHECK_CFLAGS) | ||
13 | |||
14 | messenger_autotest_LDADD = \ | ||
15 | $(LIBSODIUM_LDFLAGS) \ | ||
16 | libtoxcore.la \ | ||
17 | $(LIBSODIUM_LIBS) \ | ||
18 | $(CHECK_LIBS) | ||
19 | |||
20 | |||
21 | crypto_test_SOURCES = $(top_srcdir)/auto_tests/crypto_test.c | ||
22 | |||
23 | crypto_test_CFLAGS = $(LIBSODIUM_CFLAGS) \ | ||
24 | $(CHECK_CFLAGS) | ||
25 | |||
26 | crypto_test_LDADD = $(LIBSODIUM_LDFLAGS) \ | ||
27 | libtoxcore.la \ | ||
28 | $(LIBSODIUM_LIBS) \ | ||
29 | $(CHECK_LIBS) | ||
30 | |||
31 | endif | ||
32 | |||
33 | EXTRA_DIST += $(top_srcdir)/auto_tests/CMakeLists.txt \ | ||
34 | $(top_srcdir)/auto_tests/run_tests \ | ||
35 | $(top_srcdir)/auto_tests/cmake/messenger_test.cmake \ | ||
36 | $(top_srcdir)/auto_tests/cmake/crypto_test.cmake \ | ||
37 | $(top_srcdir)/auto_tests/cmake/friends_test.cmake \ | ||
38 | $(top_srcdir)/auto_tests/friends_test.c | ||
39 | |||
diff --git a/build/Makefile.am b/build/Makefile.am new file mode 100644 index 00000000..5cc735f9 --- /dev/null +++ b/build/Makefile.am | |||
@@ -0,0 +1,10 @@ | |||
1 | bin_PROGRAMS = | ||
2 | noinst_PROGRAMS = | ||
3 | noinst_bindir = $(top_builddir)/build | ||
4 | EXTRA_DIST= | ||
5 | |||
6 | include $(top_srcdir)/toxcore/Makefile.inc | ||
7 | include $(top_srcdir)/other/Makefile.inc | ||
8 | include $(top_srcdir)/testing/Makefile.inc | ||
9 | include $(top_srcdir)/other/bootstrap_serverdaemon/Makefile.inc | ||
10 | include $(top_srcdir)/auto_tests/Makefile.inc | ||
diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..248d87da --- /dev/null +++ b/configure.ac | |||
@@ -0,0 +1,336 @@ | |||
1 | # -*- Autoconf -*- | ||
2 | # Process this file with autoconf to produce a configure script. | ||
3 | |||
4 | AC_PREREQ([2.65]) | ||
5 | AC_INIT([tox], [0.0.0], [http://tox.im]) | ||
6 | AC_CONFIG_AUX_DIR(configure_aux) | ||
7 | AC_CONFIG_SRCDIR([toxcore/net_crypto.c]) | ||
8 | AC_CONFIG_HEADERS([config.h]) | ||
9 | AM_INIT_AUTOMAKE([1.10 -Wall]) | ||
10 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | ||
11 | AC_CONFIG_MACRO_DIR([m4]) | ||
12 | |||
13 | if test "x${prefix}" = "xNONE"; then | ||
14 | prefix="${ac_default_prefix}" | ||
15 | fi | ||
16 | |||
17 | BUILD_DHT_BOOTSTRAP_DAEMON="yes" | ||
18 | BUILD_NTOX="yes" | ||
19 | BUILD_TESTS="yes" | ||
20 | |||
21 | NCURSES_FOUND="no" | ||
22 | LIBCONFIG_FOUND="no" | ||
23 | LIBCHECK_FOUND="no" | ||
24 | |||
25 | AC_ARG_ENABLE([tests], | ||
26 | [AC_HELP_STRING([--disable-tests], [build unit tests (default: auto)]) ], | ||
27 | [ | ||
28 | if test "x$enableval" = "xno"; then | ||
29 | BUILD_TESTS="no" | ||
30 | elif test "x$enableval" = "xyes"; then | ||
31 | BUILD_TESTS="yes" | ||
32 | fi | ||
33 | ] | ||
34 | ) | ||
35 | |||
36 | AC_ARG_ENABLE([ntox], | ||
37 | [AC_HELP_STRING([--disable-ntox], [build nTox client (default: auto)]) ], | ||
38 | [ | ||
39 | if test "x$enableval" = "xno"; then | ||
40 | BUILD_NTOX="no" | ||
41 | elif test "x$enableval" = "xyes"; then | ||
42 | BUILD_NTOX="yes" | ||
43 | fi | ||
44 | ] | ||
45 | ) | ||
46 | |||
47 | AC_ARG_ENABLE([dht-bootstrap-daemon], | ||
48 | [AC_HELP_STRING([--disable-dht-boostrap-daemon], [build DHT bootstrap daemon (default: auto)]) ], | ||
49 | [ | ||
50 | if test "x$enableval" = "xno"; then | ||
51 | BUILD_DHT_BOOTSTRAP_DAEMON="no" | ||
52 | elif test "x$enableval" = "xyes"; then | ||
53 | BUILD_DHT_BOOTSTRAP_DAEMON="yes" | ||
54 | fi | ||
55 | ] | ||
56 | ) | ||
57 | |||
58 | DEPSEARCH= | ||
59 | LIBSODIUM_SEARCH_HEADERS= | ||
60 | LIBSODIUM_SEARCH_LIBS= | ||
61 | |||
62 | AC_ARG_WITH(dependency-search, | ||
63 | AC_HELP_STRING([--with-dependency-search=DIR], | ||
64 | [search for dependencies in DIR, i.e. look for libraries in | ||
65 | DIR/lib and for headers in DIR/include]), | ||
66 | [ | ||
67 | DEPSEARCH="$withval" | ||
68 | ] | ||
69 | ) | ||
70 | |||
71 | if test -n "$DEPSEARCH"; then | ||
72 | CFLAGS="$CFLAGS -I$DEPSEARCH/include" | ||
73 | CPPFLAGS="$CPPFLAGS -I$DEPSEARCH/include" | ||
74 | LDFLAGS="$LDFLAGS -L$DEPSEARCH/lib" | ||
75 | export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$DEPSEARCH/lib/pkgconfig | ||
76 | fi | ||
77 | |||
78 | AC_ARG_WITH(libsodium-headers, | ||
79 | AC_HELP_STRING([--with-libsodium-headers=DIR], | ||
80 | [search for libsodium header files in DIR]), | ||
81 | [ | ||
82 | LIBSODIUM_SEARCH_HEADERS="$withval" | ||
83 | AC_MSG_NOTICE([Will search for libsodium header files in $withval]) | ||
84 | ] | ||
85 | ) | ||
86 | |||
87 | AC_ARG_WITH(libsodium-libs, | ||
88 | AC_HELP_STRING([--with-libsodium-libs=DIR], | ||
89 | [search for libsodium libraries in DIR]), | ||
90 | [ | ||
91 | LIBSODIUM_SEARCH_LIBS="$withval" | ||
92 | AC_MSG_NOTICE([Will search for libsodium libraries in $withval]) | ||
93 | ] | ||
94 | ) | ||
95 | |||
96 | # Checks for programs. | ||
97 | AC_PROG_CC | ||
98 | AM_PROG_CC_C_O | ||
99 | AC_PROG_LIBTOOL | ||
100 | |||
101 | WIN32=no | ||
102 | AC_CANONICAL_HOST | ||
103 | case $host_os in | ||
104 | *mingw*) | ||
105 | WIN32="yes" | ||
106 | AC_MSG_WARN([nTox is not supported on $host_os yet, disabling]) | ||
107 | BUILD_NTOX="no" | ||
108 | ;; | ||
109 | *solaris*) | ||
110 | LIBS="$LIBS -lssp -lsocket -lnsl" | ||
111 | ;; | ||
112 | esac | ||
113 | AM_CONDITIONAL(WIN32, test "x$WIN32" = "xyes") | ||
114 | |||
115 | # Checks for libraries. | ||
116 | LIBSODIUM_LIBS= | ||
117 | LIBSODIUM_LDFLAGS= | ||
118 | LDFLAGS_SAVE="$LDFLAGS" | ||
119 | if test -n "$LIBSODIUM_SEARCH_LIBS"; then | ||
120 | LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS $LDFLAGS" | ||
121 | AC_CHECK_LIB(sodium, randombytes_random, | ||
122 | [ | ||
123 | LIBSODIUM_LDFLAGS="-L$LIBSODIUM_SEARCH_LIBS" | ||
124 | LIBSODIUM_LIBS="-lsodium" | ||
125 | ], | ||
126 | [ | ||
127 | AC_MSG_ERROR([required library libsodium was not found in requested location $LIBSODIUM_SEARCH_LIBS]) | ||
128 | ] | ||
129 | ) | ||
130 | else | ||
131 | AC_CHECK_LIB(sodium, randombytes_random, | ||
132 | [], | ||
133 | [ | ||
134 | AC_MSG_ERROR([required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/]) | ||
135 | ] | ||
136 | ) | ||
137 | fi | ||
138 | |||
139 | LDFLAGS="$LDFLAGS_SAVE" | ||
140 | AC_SUBST(LIBSODIUM_LIBS) | ||
141 | AC_SUBST(LIBSODIUM_LDFLAGS) | ||
142 | |||
143 | # Checks for header files. | ||
144 | AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h]) | ||
145 | |||
146 | LIBSODIUM_CFLAGS= | ||
147 | CFLAGS_SAVE="$CFLAGS" | ||
148 | CPPFLAGS_SAVE="$CPPFLAGS" | ||
149 | if test -n "$LIBSODIUM_SEARCH_HEADERS"; then | ||
150 | CFLAGS="-I$LIBSODIUM_SEARCH_HEADERS $CFLAGS" | ||
151 | CPPFLAGS="-I$LIBSODIUM_SEARCH_HEADERS $CPPFLAGS" | ||
152 | AC_CHECK_HEADER(sodium.h, | ||
153 | [ | ||
154 | LIBSODIUM_CFLAGS="-I$LIBSODIUM_SEARCH_HEADERS" | ||
155 | ], | ||
156 | [ | ||
157 | AC_MSG_ERROR([header files for required library libsodium was not found in requested location $LIBSODIUM_SEARCH_HEADERS]) | ||
158 | ] | ||
159 | ) | ||
160 | else | ||
161 | AC_CHECK_HEADER(sodium.h, | ||
162 | [], | ||
163 | [ | ||
164 | AC_MSG_ERROR([header files for required library libsodium was not found on your system, please check http://download.libsodium.org/libsodium/releases/]) | ||
165 | ] | ||
166 | ) | ||
167 | fi | ||
168 | CFLAGS="$CFLAGS_SAVE" | ||
169 | CPPFLAGS="$CPPFLAGS_SAVE" | ||
170 | AC_SUBST(LIBSODIUM_CFLAGS) | ||
171 | |||
172 | # Checks for typedefs, structures, and compiler characteristics. | ||
173 | AC_HEADER_STDBOOL | ||
174 | AC_TYPE_INT16_T | ||
175 | AC_TYPE_INT32_T | ||
176 | AC_TYPE_PID_T | ||
177 | AC_TYPE_SIZE_T | ||
178 | AC_TYPE_UINT16_T | ||
179 | AC_TYPE_UINT32_T | ||
180 | AC_TYPE_UINT64_T | ||
181 | AC_TYPE_UINT8_T | ||
182 | |||
183 | # Checks for library functions. | ||
184 | AC_FUNC_FORK | ||
185 | AC_FUNC_MALLOC | ||
186 | AC_FUNC_REALLOC | ||
187 | AC_CHECK_FUNCS([gettimeofday memset socket strchr]) | ||
188 | |||
189 | # pkg-config based tests | ||
190 | PKG_PROG_PKG_CONFIG | ||
191 | |||
192 | if test -n "$PKG_CONFIG"; then | ||
193 | if test "x$BUILD_TESTS" = "xyes"; then | ||
194 | PKG_CHECK_MODULES([CHECK], [check], | ||
195 | [ | ||
196 | LIBCHECK_FOUND="yes" | ||
197 | ], | ||
198 | [ | ||
199 | AC_MSG_WARN([libcheck not found, not building unit tests: $CHECK_PKG_ERRORS]) | ||
200 | BUILD_TESTS="no" | ||
201 | ]) | ||
202 | fi | ||
203 | |||
204 | if test "x$BUILD_DHT_BOOTSTRAP_DAEMON" = "xyes"; then | ||
205 | PKG_CHECK_MODULES([LIBCONFIG], [libconfig >= 1.4.6], | ||
206 | [ | ||
207 | LIBCONFIG_FOUND="yes" | ||
208 | ], | ||
209 | [ | ||
210 | AC_MSG_WARN([$LIBCONFIG_PKG_ERRORS]) | ||
211 | AC_MSG_WARN([libconfig not available, will not build DHT botstrap daemon]) | ||
212 | BUILD_DHT_BOOTSTRAP_DAEMON="no" | ||
213 | ]) | ||
214 | fi | ||
215 | |||
216 | if test "x$BUILD_NTOX" = "xyes"; then | ||
217 | PKG_CHECK_MODULES([NCURSES], [ncurses], | ||
218 | [ | ||
219 | NCURSES_FOUND="yes" | ||
220 | ], | ||
221 | [ | ||
222 | AC_MSG_WARN([$NCURSES_PKG_ERRORS]) | ||
223 | ]) | ||
224 | fi | ||
225 | else | ||
226 | AC_MSG_WARN([pkg-config was not found on your sytem]) | ||
227 | fi | ||
228 | |||
229 | if (test "x$BUILD_NTOX" = "xyes") && (test "x$NCURSES_FOUND" != "xyes"); then | ||
230 | AC_PATH_PROG([CURSES_CONFIG], [ncurses5-config], [no]) | ||
231 | if test "x$CURSES_CONFIG" != "xno"; then | ||
232 | AC_MSG_CHECKING(ncurses cflags) | ||
233 | NCURSES_CFLAGS=`${CURSES_CONFIG} --cflags` | ||
234 | AC_MSG_RESULT($NCURSES_CFLAGS) | ||
235 | |||
236 | AC_MSG_CHECKING(ncurses libraries) | ||
237 | NCURSES_LIBS=`${CURSES_CONFIG} --libs` | ||
238 | AC_MSG_RESULT($NCURSES_LIBS) | ||
239 | |||
240 | AC_SUBST(NCURSES_CFLAGS) | ||
241 | AC_SUBST(NCURSES_LIBS) | ||
242 | NCURSES_FOUND="yes" | ||
243 | fi | ||
244 | |||
245 | if test "x$NCURSES_FOUND" != "xyes"; then | ||
246 | AC_CHECK_HEADER([curses.h], | ||
247 | [], | ||
248 | [ | ||
249 | AC_MSG_WARN([not building nTox client because headers for the curses library were not found on your system]) | ||
250 | BUILD_NTOX="no" | ||
251 | ] | ||
252 | ) | ||
253 | if test "x$BUILD_NTOX" = "xyes"; then | ||
254 | AC_CHECK_LIB([ncurses], [clear], | ||
255 | [], | ||
256 | [ | ||
257 | unset ac_cv_lib_ncurses_clear | ||
258 | AC_CHECK_LIB([ncurses], [clear], | ||
259 | [], | ||
260 | [ | ||
261 | AC_MSG_WARN([not building nTox client because required library ncurses was not found on your system]) | ||
262 | BUILD_NTOX="no" | ||
263 | ], | ||
264 | [ | ||
265 | -ltinfo | ||
266 | ] | ||
267 | ) | ||
268 | ] | ||
269 | ) | ||
270 | fi | ||
271 | fi | ||
272 | fi | ||
273 | |||
274 | if (test "x$BUILD_DHT_BOOTSTRAP_DAEMON" = "xyes") && \ | ||
275 | (test "x$LIBCONFIG_FOUND" = "xno"); then | ||
276 | AC_CHECK_HEADER(libconfig.h, | ||
277 | [], | ||
278 | [ | ||
279 | AC_MSG_WARN([header files for library libconfig was not found on your system, not building DHT bootstrap daemon]) | ||
280 | BUILD_DHT_BOOTSTRAP_DAEMON="no" | ||
281 | ] | ||
282 | ) | ||
283 | |||
284 | if test "x$BUILD_DHT_BOOTSTRAP_DAEMON" = "xyes"; then | ||
285 | AC_CHECK_LIB(config, config_read, | ||
286 | [], | ||
287 | [ | ||
288 | AC_MSG_WARN([library libconfig was not found on the system]) | ||
289 | BUILD_DHT_BOOTSTRAP_DAEMON="no" | ||
290 | ] | ||
291 | ) | ||
292 | fi | ||
293 | fi | ||
294 | |||
295 | if (test "x$BUILD_TESTS" = "xyes") && (test "x$LIBCHECK_FOUND" = "xno"); then | ||
296 | AC_CHECK_HEADER([check.h], | ||
297 | [], | ||
298 | [ | ||
299 | AC_MSG_WARN([header file for check library was not found on your system, unit tests will be disabled]) | ||
300 | BUILD_TESTS="no" | ||
301 | ] | ||
302 | ) | ||
303 | |||
304 | if test "x$BUILD_TESTS" = "xyes"; then | ||
305 | AC_CHECK_LIB([check], [suite_create], | ||
306 | [], | ||
307 | [ | ||
308 | AC_MSG_WARN([library check was not found on the system, unit tests will be disabled]) | ||
309 | BUILD_TESTS="no" | ||
310 | ] | ||
311 | ) | ||
312 | fi | ||
313 | fi | ||
314 | |||
315 | if test "x$WIN32" = "xyes"; then | ||
316 | AC_CHECK_LIB(ws2_32, main, | ||
317 | [ | ||
318 | WINSOCK2_LIBS="-lws2_32" | ||
319 | AC_SUBST(WINSOCK2_LIBS) | ||
320 | ], | ||
321 | [ | ||
322 | AC_MSG_ERROR([required library was not found on the system, please check your MinGW installation]) | ||
323 | ] | ||
324 | ) | ||
325 | fi | ||
326 | |||
327 | AM_CONDITIONAL(BUILD_DHT_BOOTSTRAP_DAEMON, test "x$BUILD_DHT_BOOTSTRAP_DAEMON" = "xyes") | ||
328 | |||
329 | AM_CONDITIONAL(BUILD_TESTS, test "x$BUILD_TESTS" = "xyes") | ||
330 | AM_CONDITIONAL(BUILD_NTOX, test "x$BUILD_NTOX" = "xyes") | ||
331 | |||
332 | AC_CONFIG_FILES([Makefile | ||
333 | build/Makefile | ||
334 | libtoxcore.pc | ||
335 | ]) | ||
336 | AC_OUTPUT | ||
diff --git a/libtoxcore.pc.in b/libtoxcore.pc.in new file mode 100644 index 00000000..7286f43b --- /dev/null +++ b/libtoxcore.pc.in | |||
@@ -0,0 +1,12 @@ | |||
1 | prefix=@prefix@ | ||
2 | exec_prefix=@exec_prefix@ | ||
3 | libdir=@libdir@ | ||
4 | includedir=@includedir@ | ||
5 | |||
6 | Name: libtoxcore | ||
7 | Description: Tox protocol library | ||
8 | Requires: | ||
9 | Version: @PACKAGE_VERSION@ | ||
10 | Libs: -L${libdir} -ltoxcore @LIBS@ | ||
11 | Cflags: -I${includedir}/tox | ||
12 | |||
diff --git a/m4/pkg.m4 b/m4/pkg.m4 new file mode 100644 index 00000000..f26f84c9 --- /dev/null +++ b/m4/pkg.m4 | |||
@@ -0,0 +1,199 @@ | |||
1 | # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- | ||
2 | # serial 1 (pkg-config-0.24) | ||
3 | # | ||
4 | # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. | ||
5 | # | ||
6 | # This program is free software; you can redistribute it and/or modify | ||
7 | # it under the terms of the GNU General Public License as published by | ||
8 | # the Free Software Foundation; either version 2 of the License, or | ||
9 | # (at your option) any later version. | ||
10 | # | ||
11 | # This program is distributed in the hope that it will be useful, but | ||
12 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | # General Public License for more details. | ||
15 | # | ||
16 | # You should have received a copy of the GNU General Public License | ||
17 | # along with this program; if not, write to the Free Software | ||
18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | # | ||
20 | # As a special exception to the GNU General Public License, if you | ||
21 | # distribute this file as part of a program that contains a | ||
22 | # configuration script generated by Autoconf, you may include it under | ||
23 | # the same distribution terms that you use for the rest of that program. | ||
24 | |||
25 | # PKG_PROG_PKG_CONFIG([MIN-VERSION]) | ||
26 | # ---------------------------------- | ||
27 | AC_DEFUN([PKG_PROG_PKG_CONFIG], | ||
28 | [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) | ||
29 | m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) | ||
30 | m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) | ||
31 | AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) | ||
32 | AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) | ||
33 | AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) | ||
34 | |||
35 | if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then | ||
36 | AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) | ||
37 | fi | ||
38 | if test -n "$PKG_CONFIG"; then | ||
39 | _pkg_min_version=m4_default([$1], [0.9.0]) | ||
40 | AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) | ||
41 | if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then | ||
42 | AC_MSG_RESULT([yes]) | ||
43 | else | ||
44 | AC_MSG_RESULT([no]) | ||
45 | PKG_CONFIG="" | ||
46 | fi | ||
47 | fi[]dnl | ||
48 | ])# PKG_PROG_PKG_CONFIG | ||
49 | |||
50 | # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | ||
51 | # | ||
52 | # Check to see whether a particular set of modules exists. Similar | ||
53 | # to PKG_CHECK_MODULES(), but does not set variables or print errors. | ||
54 | # | ||
55 | # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | ||
56 | # only at the first occurence in configure.ac, so if the first place | ||
57 | # it's called might be skipped (such as if it is within an "if", you | ||
58 | # have to call PKG_CHECK_EXISTS manually | ||
59 | # -------------------------------------------------------------- | ||
60 | AC_DEFUN([PKG_CHECK_EXISTS], | ||
61 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | ||
62 | if test -n "$PKG_CONFIG" && \ | ||
63 | AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then | ||
64 | m4_default([$2], [:]) | ||
65 | m4_ifvaln([$3], [else | ||
66 | $3])dnl | ||
67 | fi]) | ||
68 | |||
69 | # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) | ||
70 | # --------------------------------------------- | ||
71 | m4_define([_PKG_CONFIG], | ||
72 | [if test -n "$$1"; then | ||
73 | pkg_cv_[]$1="$$1" | ||
74 | elif test -n "$PKG_CONFIG"; then | ||
75 | PKG_CHECK_EXISTS([$3], | ||
76 | [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` | ||
77 | test "x$?" != "x0" && pkg_failed=yes ], | ||
78 | [pkg_failed=yes]) | ||
79 | else | ||
80 | pkg_failed=untried | ||
81 | fi[]dnl | ||
82 | ])# _PKG_CONFIG | ||
83 | |||
84 | # _PKG_SHORT_ERRORS_SUPPORTED | ||
85 | # ----------------------------- | ||
86 | AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], | ||
87 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | ||
88 | if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then | ||
89 | _pkg_short_errors_supported=yes | ||
90 | else | ||
91 | _pkg_short_errors_supported=no | ||
92 | fi[]dnl | ||
93 | ])# _PKG_SHORT_ERRORS_SUPPORTED | ||
94 | |||
95 | |||
96 | # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], | ||
97 | # [ACTION-IF-NOT-FOUND]) | ||
98 | # | ||
99 | # | ||
100 | # Note that if there is a possibility the first call to | ||
101 | # PKG_CHECK_MODULES might not happen, you should be sure to include an | ||
102 | # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac | ||
103 | # | ||
104 | # | ||
105 | # -------------------------------------------------------------- | ||
106 | AC_DEFUN([PKG_CHECK_MODULES], | ||
107 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | ||
108 | AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl | ||
109 | AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl | ||
110 | |||
111 | pkg_failed=no | ||
112 | AC_MSG_CHECKING([for $1]) | ||
113 | |||
114 | _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) | ||
115 | _PKG_CONFIG([$1][_LIBS], [libs], [$2]) | ||
116 | |||
117 | m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS | ||
118 | and $1[]_LIBS to avoid the need to call pkg-config. | ||
119 | See the pkg-config man page for more details.]) | ||
120 | |||
121 | if test $pkg_failed = yes; then | ||
122 | AC_MSG_RESULT([no]) | ||
123 | _PKG_SHORT_ERRORS_SUPPORTED | ||
124 | if test $_pkg_short_errors_supported = yes; then | ||
125 | $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` | ||
126 | else | ||
127 | $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` | ||
128 | fi | ||
129 | # Put the nasty error message in config.log where it belongs | ||
130 | echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD | ||
131 | |||
132 | m4_default([$4], [AC_MSG_ERROR( | ||
133 | [Package requirements ($2) were not met: | ||
134 | |||
135 | $$1_PKG_ERRORS | ||
136 | |||
137 | Consider adjusting the PKG_CONFIG_PATH environment variable if you | ||
138 | installed software in a non-standard prefix. | ||
139 | |||
140 | _PKG_TEXT])[]dnl | ||
141 | ]) | ||
142 | elif test $pkg_failed = untried; then | ||
143 | AC_MSG_RESULT([no]) | ||
144 | m4_default([$4], [AC_MSG_FAILURE( | ||
145 | [The pkg-config script could not be found or is too old. Make sure it | ||
146 | is in your PATH or set the PKG_CONFIG environment variable to the full | ||
147 | path to pkg-config. | ||
148 | |||
149 | _PKG_TEXT | ||
150 | |||
151 | To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl | ||
152 | ]) | ||
153 | else | ||
154 | $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS | ||
155 | $1[]_LIBS=$pkg_cv_[]$1[]_LIBS | ||
156 | AC_MSG_RESULT([yes]) | ||
157 | $3 | ||
158 | fi[]dnl | ||
159 | ])# PKG_CHECK_MODULES | ||
160 | |||
161 | |||
162 | # PKG_INSTALLDIR(DIRECTORY) | ||
163 | # ------------------------- | ||
164 | # Substitutes the variable pkgconfigdir as the location where a module | ||
165 | # should install pkg-config .pc files. By default the directory is | ||
166 | # $libdir/pkgconfig, but the default can be changed by passing | ||
167 | # DIRECTORY. The user can override through the --with-pkgconfigdir | ||
168 | # parameter. | ||
169 | AC_DEFUN([PKG_INSTALLDIR], | ||
170 | [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) | ||
171 | m4_pushdef([pkg_description], | ||
172 | [pkg-config installation directory @<:@]pkg_default[@:>@]) | ||
173 | AC_ARG_WITH([pkgconfigdir], | ||
174 | [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, | ||
175 | [with_pkgconfigdir=]pkg_default) | ||
176 | AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) | ||
177 | m4_popdef([pkg_default]) | ||
178 | m4_popdef([pkg_description]) | ||
179 | ]) dnl PKG_INSTALLDIR | ||
180 | |||
181 | |||
182 | # PKG_NOARCH_INSTALLDIR(DIRECTORY) | ||
183 | # ------------------------- | ||
184 | # Substitutes the variable noarch_pkgconfigdir as the location where a | ||
185 | # module should install arch-independent pkg-config .pc files. By | ||
186 | # default the directory is $datadir/pkgconfig, but the default can be | ||
187 | # changed by passing DIRECTORY. The user can override through the | ||
188 | # --with-noarch-pkgconfigdir parameter. | ||
189 | AC_DEFUN([PKG_NOARCH_INSTALLDIR], | ||
190 | [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) | ||
191 | m4_pushdef([pkg_description], | ||
192 | [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) | ||
193 | AC_ARG_WITH([noarch-pkgconfigdir], | ||
194 | [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, | ||
195 | [with_noarch_pkgconfigdir=]pkg_default) | ||
196 | AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) | ||
197 | m4_popdef([pkg_default]) | ||
198 | m4_popdef([pkg_description]) | ||
199 | ]) dnl PKG_NOARCH_INSTALLDIR | ||
diff --git a/other/Makefile.inc b/other/Makefile.inc new file mode 100644 index 00000000..4f195e63 --- /dev/null +++ b/other/Makefile.inc | |||
@@ -0,0 +1,20 @@ | |||
1 | noinst_PROGRAMS += DHT_bootstrap | ||
2 | |||
3 | DHT_bootstrap_SOURCES = $(top_srcdir)/other/DHT_bootstrap.c \ | ||
4 | $(top_srcdir)/toxcore/DHT.h \ | ||
5 | $(top_srcdir)/toxcore/friend_requests.h \ | ||
6 | $(top_srcdir)/testing/misc_tools.h \ | ||
7 | $(top_srcdir)/testing/misc_tools.c | ||
8 | |||
9 | DHT_bootstrap_CFLAGS = -I$(top_srcdir)/other \ | ||
10 | $(LIBSODIUM_CFLAGS) | ||
11 | |||
12 | DHT_bootstrap_LDADD = $(LIBSODIUM_LDFLAGS) \ | ||
13 | libtoxcore.la \ | ||
14 | $(LIBSODIUM_LIBS) \ | ||
15 | $(WINSOCK2_LIBS) | ||
16 | |||
17 | EXTRA_DIST += $(top_srcdir)/other/cmake/DHT_bootstrap.cmake \ | ||
18 | $(top_srcdir)/other/CMakeLists.txt \ | ||
19 | $(top_srcdir)/other/DHTservers \ | ||
20 | $(top_srcdir)/other/tox.png | ||
diff --git a/other/bootstrap_serverdaemon/Makefile.inc b/other/bootstrap_serverdaemon/Makefile.inc new file mode 100644 index 00000000..a04475c5 --- /dev/null +++ b/other/bootstrap_serverdaemon/Makefile.inc | |||
@@ -0,0 +1,27 @@ | |||
1 | if BUILD_DHT_BOOTSTRAP_DAEMON | ||
2 | |||
3 | noinst_PROGRAMS += DHT_bootstrap_daemon | ||
4 | |||
5 | DHT_bootstrap_daemon_SOURCES = \ | ||
6 | $(top_srcdir)/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c | ||
7 | |||
8 | DHT_bootstrap_daemon_CFLAGS = \ | ||
9 | -I$(top_srcdir)/other/bootstrap_serverdaemon \ | ||
10 | $(LIBSODIUM_CFLAGS) \ | ||
11 | $(LIBCONFIG_CFLAGS) | ||
12 | |||
13 | DHT_bootstrap_daemon_LDADD = \ | ||
14 | $(LIBSODIUM_LDFLAGS) \ | ||
15 | libtoxcore.la \ | ||
16 | $(LIBCONFIG_LIBS) \ | ||
17 | $(LIBSODIUM_LIBS) | ||
18 | |||
19 | endif | ||
20 | |||
21 | EXTRA_DIST += \ | ||
22 | $(top_srcdir)/other/bootstrap_serverdaemon/server.cfg \ | ||
23 | $(top_srcdir)/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.sh \ | ||
24 | $(top_srcdir)/other/bootstrap_serverdaemon/cmake/Modules \ | ||
25 | $(top_srcdir)/other/bootstrap_serverdaemon/cmake/Modules/FindLibConfig.cmake \ | ||
26 | $(top_srcdir)/other/bootstrap_serverdaemon/cmake/Modules/FindLibConfig.cmake \ | ||
27 | $(top_srcdir)/other/bootstrap_serverdaemon/CMakeLists.txt | ||
diff --git a/testing/Makefile.inc b/testing/Makefile.inc new file mode 100644 index 00000000..28604958 --- /dev/null +++ b/testing/Makefile.inc | |||
@@ -0,0 +1,97 @@ | |||
1 | if BUILD_NTOX | ||
2 | |||
3 | bin_PROGRAMS += nTox | ||
4 | |||
5 | nTox_SOURCES = $(top_srcdir)/testing/misc_tools.h \ | ||
6 | $(top_srcdir)/testing/misc_tools.c \ | ||
7 | $(top_srcdir)/testing/nTox.h \ | ||
8 | $(top_srcdir)/testing/nTox.c | ||
9 | |||
10 | nTox_CFLAGS = $(LIBSODIUM_CFLAGS) \ | ||
11 | $(NCURSES_CFLAGS) | ||
12 | |||
13 | nTox_LDADD = $(LIBSODIUM_LDFLAGS) \ | ||
14 | libtoxcore.la \ | ||
15 | $(LIBSODIUM_LIBS) \ | ||
16 | $(NCURSES_LIBS) | ||
17 | |||
18 | endif | ||
19 | |||
20 | |||
21 | noinst_PROGRAMS += DHT_test \ | ||
22 | Lossless_UDP_testclient \ | ||
23 | Lossless_UDP_testserver \ | ||
24 | Messenger_test \ | ||
25 | crypto_speed_test | ||
26 | |||
27 | DHT_test_SOURCES = $(top_srcdir)/testing/DHT_test.c \ | ||
28 | $(top_srcdir)/testing/misc_tools.h \ | ||
29 | $(top_srcdir)/testing/misc_tools.c | ||
30 | |||
31 | DHT_test_CFLAGS = $(LIBSODIUM_CFLAGS) | ||
32 | |||
33 | DHT_test_LDADD = $(LIBSODIUM_LDFLAGS) \ | ||
34 | libtoxcore.la \ | ||
35 | $(LIBSODIUM_LIBS) \ | ||
36 | $(WINSOCK2_LIBS) | ||
37 | |||
38 | |||
39 | Lossless_UDP_testclient_SOURCES = \ | ||
40 | $(top_srcdir)/testing/Lossless_UDP_testclient.c | ||
41 | |||
42 | Lossless_UDP_testclient_CFLAGS = \ | ||
43 | $(LIBSODIUM_CFLAGS) | ||
44 | |||
45 | Lossless_UDP_testclient_LDADD = \ | ||
46 | $(LIBSODIUM_LDFLAGS) \ | ||
47 | libtoxcore.la \ | ||
48 | $(LIBSODIUM_LIBS) \ | ||
49 | $(WINSOCK2_LIBS) | ||
50 | |||
51 | |||
52 | Lossless_UDP_testserver_SOURCES = \ | ||
53 | $(top_srcdir)/testing/Lossless_UDP_testserver.c | ||
54 | |||
55 | Lossless_UDP_testserver_CFLAGS = \ | ||
56 | $(LIBSODIUM_CFLAGS) | ||
57 | |||
58 | Lossless_UDP_testserver_LDADD = \ | ||
59 | $(LIBSODIUM_LDFLAGS) \ | ||
60 | libtoxcore.la \ | ||
61 | $(LIBSODIUM_LIBS) \ | ||
62 | $(WINSOCK2_LIBS) | ||
63 | |||
64 | |||
65 | Messenger_test_SOURCES = \ | ||
66 | $(top_srcdir)/testing/Messenger_test.c \ | ||
67 | $(top_srcdir)/testing/misc_tools.h \ | ||
68 | $(top_srcdir)/testing/misc_tools.c | ||
69 | |||
70 | Messenger_test_CFLAGS = $(LIBSODIUM_CFLAGS) | ||
71 | |||
72 | Messenger_test_LDADD = $(LIBSODIUM_LDFLAGS) \ | ||
73 | libtoxcore.la \ | ||
74 | $(LIBSODIUM_LIBS) \ | ||
75 | $(WINSOCK2_LIBS) | ||
76 | |||
77 | |||
78 | crypto_speed_test_SOURCES = \ | ||
79 | $(top_srcdir)/testing/crypto_speed_test.c | ||
80 | |||
81 | crypto_speed_test_CFLAGS = \ | ||
82 | $(LIBSODIUM_CFLAGS) | ||
83 | |||
84 | crypto_speed_test_LDADD = \ | ||
85 | $(LIBSODIUM_LDFLAGS) \ | ||
86 | libtoxcore.la \ | ||
87 | $(LIBSODIUM_LIBS) \ | ||
88 | $(WINSOCK2_LIBS) | ||
89 | |||
90 | |||
91 | EXTRA_DIST += $(top_srcdir)/testing/cmake/Messenger_test.cmake \ | ||
92 | $(top_srcdir)/testing/cmake/DHT_test.cmake \ | ||
93 | $(top_srcdir)/testing/cmake/Lossless_UDP_testclient.cmake \ | ||
94 | $(top_srcdir)/testing/cmake/Lossless_UDP_testserver.cmake \ | ||
95 | $(top_srcdir)/testing/cmake/nTox.cmake \ | ||
96 | $(top_srcdir)/testing/cmake/crypto_speed_test.cmake \ | ||
97 | $(top_srcdir)/testing/CMakeLists.txt | ||
diff --git a/toxcore/Makefile.inc b/toxcore/Makefile.inc new file mode 100644 index 00000000..a5b245f5 --- /dev/null +++ b/toxcore/Makefile.inc | |||
@@ -0,0 +1,42 @@ | |||
1 | LIBTOXCORE_VERSION = 0:0:0 | ||
2 | |||
3 | lib_LTLIBRARIES = libtoxcore.la | ||
4 | |||
5 | libtoxcore_la_include_HEADERS = \ | ||
6 | $(top_srcdir)/toxcore/tox.h | ||
7 | |||
8 | libtoxcore_la_includedir = $(includedir)/tox | ||
9 | |||
10 | libtoxcore_la_SOURCES = $(top_srcdir)/toxcore/DHT.h \ | ||
11 | $(top_srcdir)/toxcore/DHT.c \ | ||
12 | $(top_srcdir)/toxcore/network.h \ | ||
13 | $(top_srcdir)/toxcore/network.c \ | ||
14 | $(top_srcdir)/toxcore/Lossless_UDP.h \ | ||
15 | $(top_srcdir)/toxcore/Lossless_UDP.c \ | ||
16 | $(top_srcdir)/toxcore/net_crypto.h \ | ||
17 | $(top_srcdir)/toxcore/net_crypto.c \ | ||
18 | $(top_srcdir)/toxcore/friend_requests.h \ | ||
19 | $(top_srcdir)/toxcore/friend_requests.c \ | ||
20 | $(top_srcdir)/toxcore/LAN_discovery.h \ | ||
21 | $(top_srcdir)/toxcore/LAN_discovery.c \ | ||
22 | $(top_srcdir)/toxcore/Messenger.h \ | ||
23 | $(top_srcdir)/toxcore/Messenger.c \ | ||
24 | $(top_srcdir)/toxcore/packets.h \ | ||
25 | $(top_srcdir)/toxcore/ping.h \ | ||
26 | $(top_srcdir)/toxcore/ping.c \ | ||
27 | $(top_srcdir)/toxcore/tox.h \ | ||
28 | $(top_srcdir)/toxcore/tox.c \ | ||
29 | $(top_srcdir)/toxcore/util.h \ | ||
30 | $(top_srcdir)/toxcore/util.c | ||
31 | |||
32 | libtoxcore_la_CFLAGS = -I$(top_srcdir) \ | ||
33 | -I$(top_srcdir)/toxcore \ | ||
34 | $(LIBSODIUM_CFLAGS) | ||
35 | |||
36 | libtoxcore_la_LDFLAGS = -version-info $(LIBTOXCORE_VERSION) \ | ||
37 | $(LIBSODIUM_LDFLAGS) | ||
38 | |||
39 | libtoxcore_la_LIBS = $(LIBSODIUM_LIBS) \ | ||
40 | $(WINSOCK2_LIBS) | ||
41 | |||
42 | EXTRA_DIST += $(top_srcdir)/toxcore/CMakeLists.txt | ||