forked from jedisct1/pure-ftpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1484 lines (1311 loc) · 41.2 KB
/
configure.ac
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
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl AM_ACLOCAL_INCLUDE(m4)
AC_PREREQ(2.65)
AC_INIT([pure-ftpd],[1.0.43],[bugs at pureftpd dot org])
AC_CONFIG_SRCDIR(src/ftpd.c)
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar])
AC_CONFIG_LIBOBJ_DIR(src)
AC_SUBST(VERSION)
ISODATE=`date +%Y-%m-%d`
AC_SUBST(ISODATE)
dnl Checks for programs.
LX_CFLAGS=${CFLAGS-NONE}
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_CC
AM_PROG_CC_C_O
AC_USE_SYSTEM_EXTENSIONS
AC_SEARCH_LIBS([strerror],[cposix])
AX_CHECK_COMPILE_FLAG([-fPIC], [
AX_CHECK_LINK_FLAG([-fPIC],
[CFLAGS="$CFLAGS -fPIC"]
)
])
AS_IF([test "$enable_pie" != "no"],[
AX_CHECK_COMPILE_FLAG([-fPIE], [
AX_CHECK_LINK_FLAG([-fPIE],
[AX_CHECK_LINK_FLAG([-pie],
[CFLAGS="$CFLAGS -fPIE"
LDFLAGS="$LDFLAGS -pie"])
])
])
])
AX_CHECK_COMPILE_FLAG([-fwrapv], [CFLAGS="$CFLAGS -fwrapv"])
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"])
AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CFLAGS="$CFLAGS -fno-strict-overflow"])
AS_IF([echo `(uname -s) 2>/dev/null` | $GREP "CYGWIN" > /dev/null], [
AX_CHECK_LINK_FLAG([-Wl,--dynamicbase], [LDFLAGS="$LDFLAGS -Wl,--dynamicbase"])
AX_CHECK_LINK_FLAG([-Wl,--nxcompat], [LDFLAGS="$LDFLAGS -Wl,--nxcompat"])
], [
AS_IF([test `(uname -s) 2>/dev/null` = "DragonFly"],
[
AX_CHECK_COMPILE_FLAG([-fstack-protector], [
AX_CHECK_LINK_FLAG([-fstack-protector],
[CFLAGS="$CFLAGS -fstack-protector"]
)
])
],
[
AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [
AX_CHECK_LINK_FLAG([-fstack-protector-all],
[CFLAGS="$CFLAGS -fstack-protector-all"]
)
])
]
)
])
AX_CHECK_COMPILE_FLAG([-Winit-self], [CFLAGS="$CFLAGS -Winit-self"])
AX_CHECK_COMPILE_FLAG([-Wwrite-strings], [CFLAGS="$CFLAGS -Wwrite-strings"])
AX_CHECK_COMPILE_FLAG([-Wdiv-by-zero], [CFLAGS="$CFLAGS -Wdiv-by-zero"])
AC_ARG_VAR([CWFLAGS], [define to compilation flags for generating extra warnings])
AX_CHECK_COMPILE_FLAG([-Wall], [CWFLAGS="$CWFLAGS -Wall"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wextra], [CWFLAGS="$CWFLAGS -Wextra"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wbad-function-cast], [CWFLAGS="$CWFLAGS -Wbad-function-cast"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wcast-align], [CWFLAGS="$CWFLAGS -Wcast-align"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wcast-qual], [CWFLAGS="$CWFLAGS -Wcast-qual"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wchar-subscripts], [CWFLAGS="$CWFLAGS -Wchar-subscripts"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wcomment], [CWFLAGS="$CWFLAGS -Wcomment"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wfloat-equal], [CWFLAGS="$CWFLAGS -Wfloat-equal"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wformat=2], [CWFLAGS="$CWFLAGS -Wformat=2"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wimplicit], [CWFLAGS="$CWFLAGS -Wimplicit"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wmissing-declarations], [CWFLAGS="$CWFLAGS -Wmissing-declarations"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wmissing-prototypes], [CWFLAGS="$CWFLAGS -Wmissing-prototypes"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wnormalized=id], [CWFLAGS="$CWFLAGS -Wnormalized=id"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Woverride-init], [CWFLAGS="$CWFLAGS -Woverride-init"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wparentheses], [CWFLAGS="$CWFLAGS -Wparentheses"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wpointer-arith], [CWFLAGS="$CWFLAGS -Wpointer-arith"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wredundant-decls], [CWFLAGS="$CWFLAGS -Wredundant-decls"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wstrict-prototypes], [CWFLAGS="$CWFLAGS -Wstrict-prototypes"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wswitch-enum], [CWFLAGS="$CWFLAGS -Wswitch-enum"])
AX_CHECK_COMPILE_FLAG([$CWFLAGS -Wvariable-decl], [CWFLAGS="$CWFLAGS -Wvariable-decl"])
AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="$LDFLAGS -Wl,-z,relro"])
AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS="$LDFLAGS -Wl,-z,now"])
AX_CHECK_LINK_FLAG([-Wl,-z,noexecstack], [LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"])
AC_ARG_VAR(PERL,local path to the perl interpreter)
perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
AC_ARG_VAR(PYTHON,local path to the python interpreter)
python_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/python/bin:/opt/python/usr/bin:/opt/python/usr/local/bin"
AC_PATH_PROG(PYTHON,python,/usr/bin/env python,$python_possible_path)
if test -d /usr/local/include; then
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
fi
if test -d /usr/kerberos/include; then
CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
fi
if test -d /usr/local/lib; then
LDFLAGS="$LDFLAGS -L/usr/local/lib"
fi
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
dnl Checks for header files
AC_SYS_LARGEFILE
AC_HEADER_STDC
AC_HEADER_STAT
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/param.h ioctl.h sys/ioctl.h)
AC_CHECK_HEADERS(sys/vfs.h sys/statvfs.h sys/sendfile.h sys/uio.h)
AC_CHECK_HEADERS(sys/time.h sys/resource.h sys/capability.h)
AC_CHECK_HEADERS(shadow.h getopt.h stddef.h stdint.h)
AC_CHECK_HEADERS(netinet/in_systm.h netinet/in.h sys/pstat.h sys/file.h)
AC_CHECK_HEADERS(sys/mount.h, [], [],
[#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif])
AC_CHECK_HEADERS(fcntl.h sys/fcntl.h sys/loadavg.h sys/ptrace.h)
AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h)
AC_CHECK_HEADERS(security/pam_modules.h security/pam_filter.h)
AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h pam/pam_modules.h)
AC_CHECK_HEADERS(pam/pam_filter.h)
AC_CHECK_HEADERS(sgtty.h termio.h)
AC_CHECK_HEADERS(locale.h)
AC_CHECK_HEADERS(stdarg.h varargs.h)
AC_CHECK_HEADERS(windows.h io.h)
AC_CHECK_HEADERS(crypt.h)
AC_CHECK_HEADERS(utime.h)
AC_CHECK_HEADERS(openssl/ssl.h openssl/ec.h)
AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
AC_CHECK_HEADERS(iconv.h)
AC_SYS_POSIX_TERMIOS
if test "x$ac_cv_sys_posix_termios" = "xyes"; then
AC_DEFINE(HAVE_POSIX_TERMIOS,,[Define if you have POSIX termios])
fi
dnl Check for endianness
AC_C_BIGENDIAN
dnl Checks for types
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_OFF_T
AC_TYPE_MODE_T
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_CHECK_MEMBER(struct tm.tm_gmtoff, [AC_DEFINE(STRUCT_TM_TM_GMTOFF,,[Define if you have struct tm/tm_gmtoff])],,[
#include <sys/types.h>
#include <$ac_cv_struct_tm>
])
AC_MSG_CHECKING([whether timezone is scalar])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <$ac_cv_struct_tm>
]], [[timezone = 42L]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SCALAR_TIMEZONE,,[Define if your timezone is a scalar number])
],[ AC_MSG_RESULT(no) ])
AC_CHECK_TYPE(nlink_t, , [AC_DEFINE(nlink_t, int, [nlink_t type])],
[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
])
AC_CHECK_TYPE(dev_t, , [AC_DEFINE(dev_t, unsigned int, [dev_t type])],
[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
])
AC_CHECK_TYPE(ino_t, , [AC_DEFINE(ino_t, unsigned long, [ino_t type])],
[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
])
dnl Check for sizes
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(mode_t)
dnl Socket things
AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
fi
if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
AC_MSG_CHECKING([if we can include libnsl + libsocket])
LIBS="-lnsl -lsocket $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
if test "$my_ac_link_result" = "no" ; then
AC_MSG_RESULT([failure])
AC_MSG_ERROR([unable to use gethostbyname()])
else
AC_MSG_RESULT([success])
fi
fi
AC_CHECK_LIB(sendfile, sendfile)
dnl Types - continued
AC_CHECK_TYPE(socklen_t, , [AC_DEFINE(socklen_t, int, [socklen_t type])],
[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#include <netinet/in.h>
])
AC_CHECK_TYPE(in_port_t, , [AC_DEFINE(in_port_t, unsigned short, [in_port_t type])],
[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_NETINET_IN_SYSTM_H
# include <netinet/in_systm.h>
#endif
#include <netinet/in.h>
])
AC_CHECK_TYPE(sig_atomic_t, , [AC_DEFINE(sig_atomic_t, signed char, [sig_atomic_t type])],
[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <signal.h>
])
dnl Compiler characteristics
AC_PROG_GCC_TRADITIONAL
AC_C_CONST
AC_C_INLINE
dnl Options
AM_WITH_DMALLOC
AC_ARG_ENABLE(pie,
[AS_HELP_STRING(--enable-pie,Produce position independent executables @<:@default=yes@:>@)],
enable_pie=$enableval, enable_pie="maybe")
AC_ARG_ENABLE(ssp,
[AS_HELP_STRING(--disable-ssp,Don't compile with -fstack-protector)],
[AS_IF([test "x$enableval" = "xno"], [
nxflags=""
for flag in `echo $CFLAGS`; do
case "$flag" in
-fstack-protector*) ;;
*) AS_VAR_APPEND([nxflags], [" $flag"]) ;;
esac
done
CFLAGS="$nxflags"
])
])
AC_ARG_WITH(standalone,
[AS_HELP_STRING(--without-standalone,Don't compile the standalone server code)],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(NO_STANDALONE,,[without standalone])
no_standalone=yes
fi ])
AC_ARG_WITH(inetd,
[AS_HELP_STRING(--without-inetd,Don't support super-servers (like inetd))],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(NO_INETD,,[without inetd])
no_inetd=yes
fi ])
if test "x$no_standalone" = "xyes" && test "x$no_inetd" = "xyes" ; then
AC_MSG_ERROR(You can't disable both standalone and inetd mode.)
fi
AC_ARG_WITH(capabilities,
[AS_HELP_STRING(--without-capabilities,Don't use Linux capabilities (default=detect))],
[ if test "x$withval" = "xno" ; then
no_capabilities=1
fi ])
if test -z "$no_capabilities" ; then
AC_CHECK_LIB(cap, cap_init, , )
if test "x$ac_cv_lib_cap_cap_init" = "xyes"; then
if test "x$ac_cv_header_sys_capability_h" = "xyes"; then
AC_DEFINE(USE_CAPABILITIES,,[use capabilities])
fi
fi
fi
AC_ARG_WITH(shadow,
[AS_HELP_STRING(--without-shadow,Don't use shadow passwords (default=detect))],
[ if test "x$withval" = "xno" ; then
no_shadow=1
fi ])
if test -z "$no_shadow" && test "x$ac_cv_header_shadow_h" = "xyes" ; then
AC_CHECK_FUNC(getspnam, AC_DEFINE(USE_SHADOW,,[use shadow passwords]),
AC_CHECK_LIB(shadow, getspnam, AC_DEFINE(USE_SHADOW),
AC_MSG_WARN(shadow.h was found, but getspnam() isn't available)
)
)
fi
AC_ARG_WITH(usernames,
[AS_HELP_STRING(--without-usernames,Use only numerical UIDs/GIDs)],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(NO_FTP_USERS,,[without usernames])
fi ])
AC_ARG_WITH(iplogging,
[AS_HELP_STRING(--without-iplogging,Never log remote IP addresses (privacy))],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(DONT_LOG_IP,,[without iplogging])
fi ])
AC_ARG_WITH(humor,
[AS_HELP_STRING(--without-humor,Disable humor (enabled by default))],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(DISABLE_HUMOR,,[without humor])
fi ])
AC_ARG_WITH(longoptions,
[AS_HELP_STRING(--without-longoptions,Ignored - just for backward compatibility)],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(NO_GETOPT_LONG,,[without longoptions])
fi ])
AC_ARG_WITH(ascii,
[AS_HELP_STRING(--without-ascii,Don't support 7-bits (ASCII) transfers)],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(WITHOUT_ASCII,,[without ascii])
fi ])
AC_ARG_WITH(globbing,
[AS_HELP_STRING(--without-globbing,Don't include globbing code)],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(DISABLE_GLOBBING,,[without globbing])
fi ])
AC_ARG_WITH(nonalnum,
[AS_HELP_STRING(--without-nonalnum,Only allow basic alphanumeric characters in file names)],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(PARANOID_FILE_NAMES,,[disallow non-alphanumeric characters])
fi ])
AC_ARG_WITH(unicode,
[AS_HELP_STRING(--without-unicode,Disable non-latin characters in file names)],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(DISABLE_UNICODE_CONTROL_CHARS,,[disallow unicode control chars])
fi ])
AC_ARG_WITH(sendfile,
[AS_HELP_STRING(--without-sendfile,Don't use zero-copy optimizations (for network FS))],
[ if test "x$withval" = "xno" ; then
AC_DEFINE(DISABLE_SENDFILE,,[without sendfile])
fi ])
AC_ARG_WITH(privsep,
[AS_HELP_STRING(--without-privsep,Disable privilege separation)],
[ if test "x$withval" = "xno" ; then
without_privsep=yes
fi ])
AC_ARG_WITH(boring,
[AS_HELP_STRING(--with-boring,Display only boring messages)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(BORING_MODE,,[display only boring messages])
AC_DEFINE(DISABLE_HUMOR)
fi ])
AC_ARG_WITH(brokenrealpath,
[AS_HELP_STRING(--with-brokenrealpath,If your libc has a broken realpath() call)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(USE_BUILTIN_REALPATH,,[realpath() is broken])
fi ])
AC_ARG_WITH(minimal,
[AS_HELP_STRING(--with-minimal,Build only a small minimal server)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(MINIMAL,,[with minimal])
AC_DEFINE(NO_GETOPT_LONG)
AC_DEFINE(DISABLE_HUMOR)
AC_DEFINE(NO_FTP_USERS)
AC_DEFINE(WITHOUT_ASCII)
AC_DEFINE(BORING_MODE)
CFLAGS="$CFLAGS -Os -fomit-frame-pointer -fno-unroll-loops "
LDFLAGS="$LDFLAGS -s "
fi ])
AC_ARG_WITH(paranoidmsg,
[AS_HELP_STRING(--with-paranoidmsg,Use paranoid but not admin-friendly messages)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(PARANOID_MESSAGES,,[with paranoidmsg])
fi ])
AC_ARG_WITH(sysquotas,
[AS_HELP_STRING(--with-sysquotas,Use system (not virtual) quotas)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(SYSTEM_QUOTAS,,[with sysquotas])
fi ])
AC_ARG_WITH(altlog,
[AS_HELP_STRING(--with-altlog,Support alternative log format (Apache-like))],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(WITH_ALTLOG,,[with altlog])
fi ])
AC_ARG_WITH(puredb,
[AS_HELP_STRING(--with-puredb,Support virtual (FTP-only) users)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(WITH_PUREDB,,[with puredb])
fi ])
AC_ARG_WITH(extauth,
[AS_HELP_STRING(--with-extauth,Support external authentication modules)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(WITH_EXTAUTH,,[with extauth (*BETA*)])
fi ])
AC_ARG_WITH(pam,
[AS_HELP_STRING(--with-pam,Enable PAM support (default=disabled))],
[ if test "x$withval" = "xyes" ; then
with_pam="yes"
fi ])
if test "x`uname`" = "xDarwin"; then
if test "x$with_pam" = "x"; then
with_pam="yes"
fi
fi
if test "x$with_pam" = "xyes" ; then
if test "x$ac_cv_header_security_pam_appl_h" != "xyes" &&
test "x$ac_cv_header_pam_pam_appl_h" != "xyes"; then
AC_MSG_ERROR(PAM headers not found.)
else
AC_CHECK_LIB(dl, dlopen, , )
LIBS="$LIBS -lpam"
AC_DEFINE(USE_PAM,,[use pam])
AC_CHECK_FUNCS(pam_getenvlist)
AC_MSG_CHECKING([whether pam_strerror takes only one argument])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#include <security/pam_appl.h>
]], [[(void)pam_strerror((pam_handle_t *)NULL, -1)]])],[AC_MSG_RESULT(no)],[
AC_DEFINE(HAVE_OLD_PAM,,[obsolete pam])
AC_MSG_RESULT(yes)
])
fi
fi
AC_MSG_CHECKING([whether syslog names are available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define SYSLOG_NAMES 1
#include <stdio.h>
#include <syslog.h>
]], [[
(void) facilitynames
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SYSLOG_NAMES,,[define if syslog names are available])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([whether struct addrinfo is defined])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
]], [[
do {
struct addrinfo a;
(void) a.ai_flags;
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_STRUCT_ADDRINFO,,[define if you have struct addrinfo])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([whether sin_len is defined])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
]], [[
do {
struct sockaddr_in a;
(void) a.sin_len;
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SIN_LEN,,[define if you have sin_len])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([whether __ss_family is defined])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
]], [[
do {
struct sockaddr_storage a;
(void) a.__ss_family;
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE___SS_FAMILY,,[define if you have __ss_family])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([whether ss_len is defined])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
]], [[
do {
struct sockaddr_storage a;
(void) a.ss_len;
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SS_LEN,,[define if you have ss_len])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([whether __ss_len is defined])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
]], [[
do {
struct sockaddr_storage a;
(void) a.__ss_len;
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE___SS_LEN,,[define if you have __ss_len])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([if a linuxish sendfile is available])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_SYS_SENDFILE_H
# include <sys/sendfile.h>
#endif
]], [[
do {
int fd = 0;
off_t *off = NULL;
size_t cnt = (size_t) 0;
(void) sendfile(fd, fd, off, cnt);
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(SENDFILE_LINUX,,[define if you have a linuxish sendfile])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([if a linuxish sendfile64 is available])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_SYS_SENDFILE_H
# include <sys/sendfile.h>
#endif
]], [[
do {
int fd = 0;
off_t *off = NULL;
size_t cnt = (size_t) 0;
(void) sendfile64(fd, fd, off, cnt);
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(SENDFILE64_LINUX,,[define if you have a linuxish sendfile64])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([if a freebsdish sendfile is available])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_SYS_SENDFILE_H
# include <sys/sendfile.h>
#endif
]], [[
do {
int fd = 0;
off_t off = (off_t) 0;
size_t cnt = (size_t) 0;
struct sf_hdtr *hdtr = NULL;
(void) sendfile(fd, fd, off, cnt, hdtr, &off, 42);
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(SENDFILE_FREEBSD,,[define if you have a freebsdish sendfile])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([if a hpuxish sendfile is available])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/socket.h>
#include <stdio.h>
]], [[
do {
int fd = 0;
off_t off = (off_t) 0;
bsize_t nbytes = (size_t) 0;
const struct iovec *hdtrl = NULL;
(void) sendfile(fd, fd, off, nbytes, hdtrl, 42);
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(SENDFILE_HPUX,,[define if you have a hpuxish sendfile])
],[
AC_MSG_RESULT(no)
])
AC_CHECK_FUNC(sendfilev, , [AC_CHECK_LIB(sendfile, sendfilev)])
AC_MSG_CHECKING([if a solarisish sendfilev is available])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef HAVE_SYS_SENDFILE_H
# include <sys/sendfile.h>
#endif
]], [[
do {
int fd = 0, sfvcnt = 0;
const struct sendfilevec vec;
size_t xferred;
(void) sendfilev(fd, &vec, sfvcnt, &xferred);
} while(0)
]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(SENDFILEV_SOLARIS,,[define if you have a solarisish sendfilev])
],[
AC_MSG_RESULT(no)
])
AC_ARG_WITH(cookie,
[AS_HELP_STRING(--with-cookie,Support 'fortune' cookies (-F option))],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(COOKIE,,[with cookie])
fi ])
AC_ARG_WITH(throttling,
[AS_HELP_STRING(--with-throttling,Support bandwidth throttling (disabled by default))],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(THROTTLING,,[with throttling])
fi ])
AC_ARG_WITH(ratios,
[AS_HELP_STRING(--with-ratios,Support for upload/download ratios)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(RATIOS,,[with ratios])
fi ])
AC_ARG_WITH(quotas,
[AS_HELP_STRING(--with-quotas,Support .ftpquota files)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(QUOTAS,,[with quotas])
fi ])
AC_ARG_WITH(ftpwho,
[AS_HELP_STRING(--with-ftpwho,Support for pure-ftpwho)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(FTPWHO,,[with ftpwho])
fi ])
AC_ARG_WITH(welcomemsg,
[AS_HELP_STRING(--with-welcomemsg,Support welcome.msg backward compatibility (deprecated))],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(WITH_WELCOME_MSG,,[with welcomemsg])
fi ])
AC_ARG_WITH(uploadscript,
[AS_HELP_STRING(--with-uploadscript,Allow running an external script after an upload (experimental))],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(WITH_UPLOAD_SCRIPT,,[with uploadscript])
fi ])
AC_ARG_WITH(virtualhosts,
[AS_HELP_STRING(--with-virtualhosts,Handle virtual servers on different IP addresses)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(WITH_VIRTUAL_HOSTS,,[with virtualhosts])
fi ])
AC_ARG_WITH(virtualchroot,
[AS_HELP_STRING(--with-virtualchroot,Enable the ability to follow symlinks outside a chroot jail)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(WITH_VIRTUAL_CHROOT,,[with virtual chroot])
fi ])
AC_ARG_WITH(diraliases,
[AS_HELP_STRING(--with-diraliases,Enable directory aliases)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(WITH_DIRALIASES,,[with directory aliases])
fi ])
AC_ARG_WITH(nonroot,
[AS_HELP_STRING(--with-nonroot,[Compile a limited server designed to be started as a regular user. Only enable this option as a last resort if you really don't have root privileges on the server host.])],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(NON_ROOT_FTP,,[with nonroot])
AC_DEFINE(WITH_VIRTUAL_CHROOT)
non_root_ftp=yes
without_privsep=yes
fi ])
if test "x$without_privsep" = "xyes" ; then
AC_DEFINE(WITHOUT_PRIVSEP,,[disable privilege separation])
fi
AC_ARG_WITH(peruserlimits,
[AS_HELP_STRING(--with-peruserlimits,Support per-user concurrency limits)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(PER_USER_LIMITS,,[with per-user limits])
AC_DEFINE(FTPWHO)
fi ])
AC_ARG_WITH(implicittls,
[AS_HELP_STRING(--with-implicittls,Implicit TLS (port 990) - DO NOT USE unless you know what you are doing)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(IMPLICIT_TLS,,[with implicit TLS])
with_tls="yes"
fi ])
AC_ARG_WITH(debug,
[AS_HELP_STRING(--with-debug,For maintainers only - please do not use)],
[ if test "x$withval" = "xyes" ; then
if test "$LX_CFLAGS" = "NONE"; then
nxflags=""
for flag in `echo $CFLAGS`; do
case "$flag" in
-O*) ;;
-g*) ;;
*) nxflags="$nxflags $flag"
esac
done
CFLAGS="$nxflags -O0 -g3 $CWFLAGS"
fi
CPPFLAGS="$CPPFLAGS -DDEBUG=1"
fi ])
AC_ARG_WITH(everything,
[AS_HELP_STRING(--with-everything,Build a big server with almost everything)],
[ if test "x$withval" = "xyes" ; then
AC_DEFINE(WITH_ALTLOG)
AC_DEFINE(COOKIE)
AC_DEFINE(THROTTLING)
AC_DEFINE(RATIOS)
AC_DEFINE(QUOTAS)
AC_DEFINE(WITH_UPLOAD_SCRIPT)
AC_DEFINE(WITH_VIRTUAL_HOSTS)
AC_DEFINE(WITH_PUREDB)
AC_DEFINE(WITH_EXTAUTH)
AC_DEFINE(FTPWHO)
AC_DEFINE(WITH_DIRALIASES)
AC_DEFINE(PER_USER_LIMITS)
with_bonjour='yes'
fi ])
AC_ARG_WITH(language,
[AS_HELP_STRING(--with-language=,< english | german | romanian | french |
french-funny | polish | spanish | danish | dutch | italian |
brazilian-portuguese | slovak | korean | swedish | norwegian | russian |
traditional-chinese | simplified-chinese | czech | turkish | hungarian |
catalan>)],
[ if test "x$withval" = "xenglish" ; then
AC_DEFINE(MESSAGES_EN,,[english])
elif test "x$withval" = "xgerman" ; then
AC_DEFINE(MESSAGES_DE,,[german])
elif test "x$withval" = "xromanian" ; then
AC_DEFINE(MESSAGES_RO,,[romanian])
elif test "x$withval" = "xfrench" ; then
AC_DEFINE(MESSAGES_FR,,[french])
elif test "x$withval" = "xfrench-funny" ; then
AC_DEFINE(MESSAGES_FR_FUNNY,,[french-funny])
elif test "x$withval" = "xpolish" ; then
AC_DEFINE(MESSAGES_PL,,[polish])
elif test "x$withval" = "xspanish" ; then
AC_DEFINE(MESSAGES_ES,,[spanish])
elif test "x$withval" = "xdanish" ; then
AC_DEFINE(MESSAGES_DA,,[danish])
elif test "x$withval" = "xdutch" ; then
AC_DEFINE(MESSAGES_NL,,[dutch])
elif test "x$withval" = "xitalian" ; then
AC_DEFINE(MESSAGES_IT,,[italian])
elif test "x$withval" = "xbrazilian-portuguese" ; then
AC_DEFINE(MESSAGES_PT_BR,,[brazilian portuguese])
elif test "x$withval" = "xslovak" ; then
AC_DEFINE(MESSAGES_SK,,[slovak])
elif test "x$withval" = "xkorean" ; then
AC_DEFINE(MESSAGES_KR,,[korean])
elif test "x$withval" = "xswedish" ; then
AC_DEFINE(MESSAGES_SV,,[swedish])
elif test "x$withval" = "xnorwegian" ; then
AC_DEFINE(MESSAGES_NO,,[norwegian])
elif test "x$withval" = "xrussian" ; then
AC_DEFINE(MESSAGES_RU,,[russian])
elif test "x$withval" = "xtraditional-chinese" ; then
AC_DEFINE(MESSAGES_ZH_TW,,[traditional chinese])
elif test "x$withval" = "xsimplified-chinese" ; then
AC_DEFINE(MESSAGES_ZH_CN,,[simplified chinese])
elif test "x$withval" = "xczech" ; then
AC_DEFINE(MESSAGES_CS_CZ,,[czech])
elif test "x$withval" = "xturkish" ; then
AC_DEFINE(MESSAGES_TR,,[turkish])
elif test "x$withval" = "xhungarian" ; then
AC_DEFINE(MESSAGES_HU,,[hungarian])
elif test "x$withval" = "xcatalan" ; then
AC_DEFINE(MESSAGES_CA_ES,,[catalan])
else
AC_MSG_WARN(--with-language=$withval is not recognized)
fi ])
dnl Checks for libraries.
AC_CHECK_LIB(crypt, crypt, , )
AC_CHECK_LIB(sodium, crypto_pwhash_scryptsalsa208sha256_str)
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MMAP
AC_FUNC_MEMCMP
AC_FUNC_STRFTIME
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_FUNC_GETLOADAVG(src)
AC_FUNC_GETGROUPS
AC_FUNC_WAIT3
AC_FUNC_UTIME_NULL
AC_FUNC_STRTOD
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_MKTIME
AC_FUNC_LSTAT
AC_FUNC_FORK
AC_FUNC_ERROR_AT_LINE
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_CHOWN
AC_C_VOLATILE
AC_CHECK_FUNCS(initgroups setrlimit waitpid setproctitle getopt_long)
AC_CHECK_FUNCS(seteuid setreuid setresuid setegid setregid setresgid)
AC_CHECK_FUNCS(statvfs statfs putenv setenv unsetenv getpagesize realpath)
AC_CHECK_FUNCS(pread posix_fadvise ptrace)
AC_CHECK_FUNCS(strtoull strtoq)
AC_CHECK_FUNCS(strlcpy strlcat)
AC_CHECK_FUNCS(memset munmap strdup fileno mapviewoffile madvise)
AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_ntop inet_pton)
AC_CHECK_FUNCS(setusershell setgroups snprintf vsnprintf vfprintf gethostname)
AC_CHECK_FUNCS(setlocale timegm)
AC_CHECK_FUNCS(tzset utime utimes mknod mkfifo)
AC_CHECK_FUNCS(random srandomdev arc4random arc4random_stir arc4random_addrandom)
AC_CHECK_FUNCS(closefrom explicit_bzero getpwnam_shadow)
AC_MSG_CHECKING([whether statvfs64() is defined])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif