File: configure.ac

package info (click to toggle)
pupnp-1.8 1:1.8.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,416 kB
  • sloc: ansic: 31,588; xml: 1,173; makefile: 338; sh: 34
file content (725 lines) | stat: -rw-r--r-- 22,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
# -*- Autoconf -*-
#
# Top-level configure.ac file for libupnp
#
# Process this file with autoconf to produce a configure script.
#
# (C) Copyright 2005-2007 RĂ©mi Turboult <r3mi@users.sourceforge.net>
#

AC_PREREQ(2.60)

AC_INIT([libupnp], [1.8.4], [mroberto@users.sourceforge.net])
dnl ############################################################################
dnl # *Independently* of the above libupnp package version, the libtool version
dnl # of the 3 libraries need to be updated whenever there is a change released:
dnl # "current:revision:age" (this is NOT the same as the package version),
dnl # where:
dnl # 	- library code modified:		revision++
dnl # 	- interfaces changed/added/removed:	current++ and revision=0
dnl # 	- interfaces added: 			age++
dnl # 	- interfaces removed:			age=0
dnl # *please update only once, before a formal release, not for each change*
dnl #
dnl ############################################################################
dnl # Release 1.4.1:
dnl #AC_SUBST([LT_VERSION_IXML],       [2:2:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [2:2:0])
dnl #
dnl ############################################################################
dnl # Release 1.4.6:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in ixml
dnl #	revision: 2 -> 3
dnl # - Code has changed in threadutil
dnl #	revision: 2 -> 3
dnl # - Interface added in threadutil
dnl #	current: 2 -> 3
dnl #	revisiion: 3 -> 0
dnl #	age: 0 -> 1
dnl # - Code has changed in upnp
dnl #	revision: 2 -> 3
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:3:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
dnl #AC_SUBST([LT_VERSION_UPNP],       [2:3:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.0:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in ixml
dnl #	revision: 3 -> 4
dnl # - Code has changed in threadutil
dnl #	revision: 0 -> 1
dnl # - Code has changed in upnp
dnl #	revision: 3 -> 4
dnl # - Interface changed in upnp
dnl #	current: 2 -> 3
dnl #	revision: 4 -> 0
dnl # - Interface removed in upnp
dnl #	age: 0 -> 0
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:1:1])
dnl #AC_SUBST([LT_VERSION_UPNP],       [3:0:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.1:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in threadutil
dnl #	revision: 1 -> 2
dnl # - Interface added in threadutil
dnl #	current: 3 -> 4
dnl #	revision: 2 -> 0
dnl # - Interface added in threadutil
dnl #	age: 1 -> 2
dnl # - Code has changed in upnp
dnl #	revision: 0 -> 1
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [3:1:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.2:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in upnp
dnl #	revision: 1 -> 2
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [3:2:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.3:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in threadutil
dnl #	revision: 0 -> 1
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [3:2:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.4:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in threadutil
dnl #	revision: 1 -> 2
dnl # - Code has changed in upnp
dnl #	revision: 2 -> 3
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [3:3:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.5:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in upnp
dnl #	revision: 3 -> 4
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [3:4:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.6:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in threadutil
dnl #	revision: 2 -> 3
dnl # - Code has changed in upnp
dnl #	revision: 4 -> 5
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:3:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [3:5:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.7:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in threadutil
dnl #	revision: 3 -> 4
dnl # - Code has changed in upnp
dnl #	revision: 5 -> 6
dnl # - Interfaces have been changed, added and removed in upnp
dnl #	current: 3 -> 4
dnl #   revision: 6 -> 0
dnl # - Interfaces removed in upnp:
dnl #   age: -> 0
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:0:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [3:5:0])
dnl #
dnl # Obs.: 1.6.7 was released with a version error, the correct nubers should
dnl # have been:
dnl #AC_SUBST([LT_VERSION_UPNP],       [4:0:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.8:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in ixml
dnl #	revision: 4 -> 5
dnl # - Code has changed in threadutil
dnl #	revision: 0 -> 1
dnl # - Code has changed in upnp
dnl #	revision: 0 -> 1
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:5:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:1:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [4:1:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.9:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in threadutil
dnl #	revision: 1 -> 2
dnl # - Code has changed in upnp
dnl #	revision: 1 -> 2
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:5:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:2:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [4:2:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.10:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in ixml 
dnl #	revision: 5 -> 6
dnl # - Code has changed in threadutil
dnl #	revision: 2 -> 3
dnl # - Code has changed in upnp
dnl #	revision: 2 -> 3
dnl # - interface has changed in upnp
dnl #   current: 4 -> 5
dnl #   revision: 3 -> 0
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0])
dnl ############################################################################
dnl # Release 1.6.11:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in threadutil
dnl #	revision: 3 -> 4
dnl # - Code has changed in upnp
dnl #	revision: 3 -> 4
dnl # - interface has changed in upnp
dnl #   current: 5 -> 6
dnl #   revision: 4 -> 0
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:4:2])
dnl #AC_SUBST([LT_VERSION_UPNP],       [6:0:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.12:
dnl # "current:revision:age"
dnl #
dnl # - interface added in threadutil
dnl #   current: 5 -> 6
dnl #   revision: 4 - > 0
dnl #   age: 2 -> 3
dnl # - interfaces removed in threadutil
dnl #   age: 3 -> 0
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:0:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [6:0:0])
dnl #
dnl ############################################################################
dnl # Release 1.6.13:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in upnp
dnl #	revision: 0 -> 1
dnl # - interface added in upnp
dnl #   current: 6 -> 7
dnl #   revision: 1 - > 0
dnl #   age: 0 -> 1
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:0:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [7:0:1])
dnl #
dnl ############################################################################
dnl # Release 1.6.14:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in upnp
dnl #	revision: 0 -> 1
dnl # - interface added in upnp
dnl #   current: 7 -> 8
dnl #   revision: 1 - > 0
dnl #   age: 1 -> 2
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:0:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [8:0:2])
dnl #
dnl ############################################################################
dnl # Release 1.6.15:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in upnp
dnl #	revision: 0 -> 1
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:0:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [8:1:2])
dnl #
dnl ############################################################################
dnl # Release 1.6.16:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in ixml
dnl #	revision: 6 -> 7
dnl # - Code has changed in threadutil
dnl #   revision: 0 -> 1
dnl # - Code has changed in upnp
dnl #	revision: 1 -> 2
dnl # - interface changed/added/removed in upnp
dnl #   current++(9); revision = 0
dnl # - interface added in upnp
dnl #   age++(3)
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:7:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:1:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [9:0:3])
dnl #
dnl ############################################################################
dnl # Release 1.6.17:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in threadutil
dnl #   revision: 1 -> 2
dnl # - Code has changed in upnp
dnl #   revision: 0 -> 1
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [2:7:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:2:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [9:1:3])
dnl #
dnl ############################################################################
dnl # Release 1.6.18:
dnl # "current:revision:age"
dnl #
dnl # -
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [::])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [::])
dnl #AC_SUBST([LT_VERSION_UPNP],       [::])
dnl #
dnl ############################################################################
dnl # Release 1.8.0:
dnl # "current:revision:age"
dnl #
dnl # - Start from a new ground.
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [10:0:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [10:0:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [10:0:0])
dnl #
dnl ############################################################################
dnl # Release 1.8.1:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in ixml
dnl #   revision: 0 -> 1
dnl # - Code has changed in upnp
dnl #   revision: 0 -> 1
dnl # - interface changed/added/removed in upnp
dnl #   current++(11); revision = 0
dnl # - interface added in upnp
dnl #   age++(1)
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [10:1:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [11:0:1])
dnl #
dnl ############################################################################
dnl # Release 1.8.2:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in upnp
dnl #   revision: 0 -> 1
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [10:1:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [11:1:1])
dnl #
dnl ############################################################################
dnl # Release 1.8.3:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in upnp
dnl #   revision: 1 -> 2
dnl # - interfaces changed/added/removed:
dnl #   current: 11 -> 12, revision 2 -> 0
dnl # - interfaces added:
dnl #   age: 1 -> 2
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [10:1:0])
dnl #AC_SUBST([LT_VERSION_UPNP],       [12:0:2])
dnl #
dnl ############################################################################
dnl # Release 1.8.4:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in upnp
dnl #   revision: 0 -> 1
dnl # - interfaces changed/added/removed:
dnl #   current: 12 -> 13, revision 1 -> 0
dnl # - interfaces removed:
dnl #   age: 2 -> 0
dnl #
dnl #AC_SUBST([LT_VERSION_IXML],       [::])
dnl #AC_SUBST([LT_VERSION_UPNP],       [::])
dnl #
dnl ############################################################################
AC_SUBST([LT_VERSION_IXML],       [10:1:0])
AC_SUBST([LT_VERSION_UPNP],       [13:0:0])
dnl ############################################################################
dnl # Repeating the algorithm to place it closer to the modificatin place:
dnl # 	- library code modified:		revision++
dnl # 	- interfaces changed/added/removed:	current++ and revision=0
dnl # 	- interfaces added: 			age++
dnl # 	- interfaces removed:			age=0
dnl # *please update only once, before a formal release, not for each change*
dnl ############################################################################


AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([upnp/inc/upnp.h])


AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])


#
# Get canonical host names in host and host_os
#
AC_CANONICAL_HOST

#
# There are 3 configuration files :
# 1) "./autoconfig.h" is auto-generated and used only internally during build
#    (usually named "config.h" but conflicts with the file below)
# 2) "./upnp/src/inc/config.h" is static and contains some compile-time 
#    parameters. This file was previously in "./upnp/inc" but is no longer 
#    installed (contains internal definitions only).
# 3) "./upnp/inc/upnpconfig.h" is auto-generated and installed with the 
#    libraries : it contains information on the configuration of the
#    installed libraries.
#
AC_CONFIG_HEADERS([autoconfig.h upnp/inc/upnpconfig.h])
AX_SYS_LARGEFILE_SENSITIVE

if test "x$ac_cv_sys_largefile_sensitive" = "xyes"; then
	AC_DEFINE([UPNP_LARGEFILE_SENSITIVE], 1, [whether the system defaults to 32bit off_t but can do 64bit when requested])
fi

upnpmaj=`echo "$PACKAGE_VERSION" | sed 's/\..*//' `
upnpmin=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.// ; s/[^0-9].*$//' `]
upnppatch=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.[^.]\.// ; s/[^0-9].*$//' `]
AC_DEFINE_UNQUOTED([UPNP_VERSION_STRING], "$PACKAGE_VERSION", [see upnpconfig.h])
AC_DEFINE_UNQUOTED([UPNP_VERSION_MAJOR], $upnpmaj, [see upnpconfig.h])
AC_DEFINE_UNQUOTED([UPNP_VERSION_MINOR], $upnpmin, [see upnpconfig.h])
AC_DEFINE_UNQUOTED([UPNP_VERSION_PATCH], $upnppatch, [see upnpconfig.h])


#
# Check for DEBUG flag
#
RT_BOOL_ARG_ENABLE([debug], [no], [extra debugging code])
if test "x$enable_debug" = xyes ; then
	AC_DEFINE(UPNP_HAVE_DEBUG, 1, [see upnpconfig.h])
	AC_DEFINE(DEBUG, 1, [Define to 1 to compile debug code])
else
	AC_DEFINE(NDEBUG, 1, [Define to 1 to prevent compilation of assert()])
fi


#
# Check for libupnp subsets
#
RT_BOOL_ARG_ENABLE([client], [yes], [control point code (client)])
if test "x$enable_client" = xyes ; then
	AC_DEFINE(UPNP_HAVE_CLIENT, 1, [see upnpconfig.h])
fi


RT_BOOL_ARG_ENABLE([device], [yes],
     [device specific code (implies --disable-webserver if disabled)])
if test "x$enable_device" = xyes ; then
	AC_DEFINE(UPNP_HAVE_DEVICE, 1, [see upnpconfig.h])
fi


if test "x$enable_device" = xno ; then 
	enable_webserver=no
else 
	RT_BOOL_ARG_ENABLE([webserver], [yes], [integrated web server])
fi
AM_CONDITIONAL(ENABLE_WEBSERVER, test x"$enable_webserver" = xyes)
if test "x$enable_webserver" = xyes ; then
	AC_DEFINE(UPNP_HAVE_WEBSERVER, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([ssdp], [yes], [SSDP part])
if test "x$enable_ssdp" = xyes ; then
        AC_DEFINE(UPNP_HAVE_SSDP, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([optssdp], [yes], [optional SSDP headers support)])
if test "x$enable_optssdp" = xyes ; then
        AC_DEFINE(UPNP_HAVE_OPTSSDP, 1, [see upnpconfig.h])
	enable_uuid=yes
fi

RT_BOOL_ARG_ENABLE([soap], [yes], [SOAP part])
if test "x$enable_soap" = xyes ; then
        AC_DEFINE(UPNP_HAVE_SOAP, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([gena], [yes], [GENA part])
if test "x$enable_gena" = xyes ; then
        AC_DEFINE(UPNP_HAVE_GENA, 1, [see upnpconfig.h])
	enable_uuid=yes
fi

AM_CONDITIONAL(ENABLE_UUID, test x"$enable_uuid" = xyes)

RT_BOOL_ARG_ENABLE([tools], [yes], [helper APIs in upnptools.h])
if test "x$enable_tools" = xyes ; then
	AC_DEFINE(UPNP_HAVE_TOOLS, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([ipv6], [yes], [ipv6 support])
if test "x$enable_ipv6" = xyes ; then
        AC_DEFINE(UPNP_ENABLE_IPV6, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([unspecified_server], [no], [unspecified SERVER header])
if test "x$enable_unspecified_server" = xyes ; then
        AC_DEFINE(UPNP_ENABLE_UNSPECIFIED_SERVER, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([open_ssl], [no], [open-ssl support])
if test "x$enable_open_ssl" = xyes ; then
        AC_DEFINE(UPNP_ENABLE_OPEN_SSL, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([blocking_tcp_connections], [yes], [blocking TCP connections])
if test "x$enable_blocking_tcp_connections" = xyes ; then
        AC_DEFINE(UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([scriptsupport], [yes], [script support for IXML document tree, see ixml.h])
if test "x$enable_scriptsupport" = xyes ; then
        AC_DEFINE(IXML_HAVE_SCRIPTSUPPORT, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([postwrite], [no], [write to the filesystem on otherwise unhandled POST requests])
if test "x$enable_postwrite" = xyes ; then
        AC_DEFINE(UPNP_ENABLE_POST_WRITE, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([reuseaddr], [no], [bind the miniserver socket with reuseaddr to allow clean restarts])
if test "x$enable_reuseaddr" = xyes ; then
        AC_DEFINE(UPNP_MINISERVER_REUSEADDR, 1, [see upnpconfig.h])
fi

RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])

#
# Checks for programs
#
AC_PROG_CC
AM_PROG_CC_C_O
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_EGREP

#
# Default compilation flags
#
echo "--------------------- Default compilation flags -------------------------------"
echo host is $host
echo host_os is $host_os
case $host_os in
freebsd*)
	echo "Using FreeBSD specific compiler settings"
	# Put FreeBSD specific compiler flags here
	;;
*)
	echo "Using non-specific system compiler settings"
	if test x"$enable_debug" = xyes; then
		# AC_PROG_CC already sets CFLAGS to "-g -O2" by default,
		# but only if CFLAGS was not previously set.
		#:
		# Use -O0 in debug so that variables do not get optimized out
		AX_CFLAGS_GCC_OPTION([-O0, -g])
	fi
	;;
esac

AX_CFLAGS_WARN_ALL
echo "-------------------------------------------------------------------------------"


AC_TYPE_SIZE_T


#
# Are we targetting Win32?
#
AC_MSG_CHECKING([for Win32])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#ifdef WIN32
	#error Yup
#endif
],[])], [ac_cv_win32="no"], [ac_cv_win32="yes"])
if test "$ac_cv_win32" = "yes"; then
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no])
fi


#
# Checks for header files (which aren't needed on Win32)
#
AC_HEADER_STDC
if test "$ac_cv_win32" = "no"; then
# libupnp code doesn't use autoconf variables yet,
# so just abort if a header file is not found.
AC_CHECK_HEADERS(
	[ \
	arpa/inet.h \
	fcntl.h \
	inttypes.h \
	limits.h \
	netdb.h \
	netinet/in.h \
	stdlib.h \
	string.h \
	sys/ioctl.h \
	sys/socket.h \
	sys/time.h \
	syslog.h \
	unistd.h \
	],
	[],
	[AC_MSG_ERROR([required header file missing])])
fi


#
# Checks for typedefs, structures, and compiler characteristics
#	
AC_C_CONST
AC_C_BIGENDIAN

AC_CHECK_HEADERS([sys/types.h sys/socket.h ws2tcpip.h])
AC_MSG_CHECKING(for socklen_t)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#ifdef HAVE_SYS_TYPES_H
	#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
	#include <sys/socket.h>
#endif
#ifdef HAVE_WS2TCPIP_H
	#include <ws2tcpip.h>
#endif
],[ socklen_t t = 0; return t; ])
],[ac_cv_socklen_t="yes"],[ac_cv_socklen_t="no"])
if test "$ac_cv_socklen_t" = "yes"; then
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no, using int])
	AC_DEFINE(socklen_t, int, [Type for storing the length of struct sockaddr])
fi


#
# Checks for library functions
#
AC_FUNC_VPRINTF
AC_FUNC_FSEEKO
AC_CHECK_FUNC(strnlen,
	AC_DEFINE(HAVE_STRNLEN, 1, [Defines if strnlen is available on your system]))
AC_CHECK_FUNC(strndup,
	AC_DEFINE(HAVE_STRNDUP, 1, [Defines if strndup is available on your system]))
#
# Solaris needs -lsocket -lnsl -lrt
AC_SEARCH_LIBS([bind],           [socket])
AC_SEARCH_LIBS([gethostbyname],  [nsl])
AC_SEARCH_LIBS([sched_getparam], [rt])


#
# Checks for POSIX Threads
#
echo "--------------------------- pthread stuff -------------------------------------"
ACX_PTHREAD(
	[],
	[AC_MSG_ERROR([POSIX threads are required to build this program])])
#
# Update environment variables for pthreads
#
CC="$PTHREAD_CC"
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
#
# Determine if pthread_rwlock_t is available
#
echo "----------------------- pthread_rwlock_t stuff --------------------------------"
AC_MSG_CHECKING([if pthread_rwlock_t is available])
AC_LANG([C])
AC_COMPILE_IFELSE(
	[AC_LANG_PROGRAM(
		[#include <pthread.h>],
		[pthread_rwlock_t *x;])],
	[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
		AC_MSG_RESULT([yes, supported without any options])],
	[AC_COMPILE_IFELSE(
		[AC_LANG_PROGRAM(
			[#define _GNU_SOURCE
			#include <pthread.h>],
			[pthread_rwlock_t *x;])],
		[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
			CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
			AC_MSG_RESULT([yes, definition of _GNU_SOURCE required])],
		[AC_DEFINE([UPNP_USE_RWLOCK], [0], [Do not use pthread_rwlock_t])
			AC_MSG_RESULT([no, needs to fallback to pthread_mutex])
			AC_MSG_ERROR([pthread_rwlock_t not available])])])
echo "-------------------------------------------------------------------------------"


AC_CONFIG_FILES([
	Makefile
	ixml/Makefile
	ixml/doc/Makefile
	upnp/Makefile
	upnp/doc/Makefile
	upnp/sample/Makefile
	upnp/unittest/Makefile
	libupnp.pc
	])

AC_OUTPUT