-
Notifications
You must be signed in to change notification settings - Fork 25
/
configure.ac
1238 lines (1046 loc) · 42.5 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
AC_INIT([ZOO Kernel], [2.0.0], [bugs@zoo-project.org])
AC_CONFIG_MACRO_DIR([macros])
# Checks for programs.
AC_PROG_YACC
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_SED
AC_PROG_AWK
dnl autoconf 2.69 AC_PROG_LEX has no parameters
dnl autoconf 2.70 AC_PROG_LEX prints a deprecation warning without params
m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.70]), [-1], [dnl
dnl autoconf < 2.70
AC_PROG_LEX
], [
dnl autoconf >= 2.70
AC_PROG_LEX([noyywrap])
])
# Checks for libraries.
AC_CHECK_LIB([curl], [curl_easy_init,curl_easy_setopt,curl_easy_cleanup,curl_easy_perform])
AC_CHECK_LIB([dl], [dlopen,dlsym,dlerror,dlclose])
AC_CHECK_LIB([crypto], [EVP_DigestInit,EVP_md5,EVP_DigestUpdate,BIO_f_base64,BIO_new])
DEFAULT_LIBS="$LIBS"
AC_SUBST([DEFAULT_LIBS])
# Checks for header files.
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([fcntl.h inttypes.h malloc.h stddef.h stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT8_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([dup2 getcwd memset setenv strdup strstr])
#============================================================================
# Detect if uuid is available
#============================================================================
AC_ARG_WITH([uuid],
[AS_HELP_STRING([--with-uuid=PATH], [Specifies an alternative location for the ossp-uuid library])],
[UUID_DIR="$withval"], [UUID_DIR="/usr/"])
UUID_CFLAGS="-I$UUID_DIR/include"
UUID_LDFLAGS="-L$UUID_DIR/lib -luuid"
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$UUID_CFLAGS"
LIBS_SAVE="$LIBS"
LIBS="$UUID_LDFLAGS"
AC_CHECK_HEADERS([uuid/uuid.h],
[], [AC_MSG_ERROR([could not find header file uuid.h])])
AC_CHECK_LIB([uuid], [uuid_generate_time],
[], [AC_MSG_ERROR([could not find function in uuid library])])
CPPFLAGS="$CPPFLAGS_SAVE"
AC_SUBST([UUID_CFLAGS])
AC_SUBST([UUID_LDFLAGS])
#============================================================================
# Detect if json-c is available
#============================================================================
AC_ARG_WITH([callback],
[AS_HELP_STRING([--with-callback=yes], [Activate callback invocation during HPC execution])],
[CALLBACK_ACTIVATED="$withval"], [CALLBACK_ACTIVATED="no"])
AC_ARG_WITH([json],
[AS_HELP_STRING([--with-json=PATH], [Specifies an alternative location for the json-c library])],
[JSON_DIR="$withval"], [JSON_DIR="/usr/"])
if test "x$JSON_DIR" != "x"
then
JSON_CPPFLAGS="-DUSE_JSON -I$JSON_DIR/include/json-c/"
JSON_LDFLAGS="-L$JSON_DIR/lib -ljson-c"
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$JSON_CPPFLAGS"
LIBS_SAVE="$LIBS"
LIBS="$JSON_LDFLAGS"
AC_CHECK_HEADERS([json_object.h],
[], [AC_MSG_ERROR([could not find header file json_object.h])])
AC_CHECK_LIB([json-c], [json_object_new_object],
[], [AC_MSG_ERROR([could not find function in json-c library])])
CPPFLAGS="$CPPFLAGS_SAVE"
JSON_FILE="service_json.o service_callback.o"
JSON_ENABLED="-DJSON"
if test "x$CALLBACK_ACTIVATED" == "xyes"
then
CALLBACK_FILE=""
CALLBACK_USE="-DUSE_CALLBACK"
fi
fi
AC_SUBST([JSON_CPPFLAGS])
AC_SUBST([JSON_LDFLAGS])
AC_SUBST([JSON_FILE])
AC_SUBST([JSON_ENABLED])
AC_SUBST([CALLBACK_FILE])
AC_SUBST([CALLBACK_USE])
#============================================================================
# Detect if rabbitmq is available
#============================================================================
AC_ARG_WITH([rabbitmq],
[AS_HELP_STRING([--with-rabbitmq], [asynchronous requests management with rabbitmq ])],
[AMQP="-DUSE_AMQP"], [AMQP=""])
if test -z "$AMQP"
then
RABBITMQ_LDFLAGS=""
RABBITMQ_CPPFLAGS=""
RABBITMQ_FILE=""
else
AC_CHECK_LIB([rabbitmq], [main])
RABBITMQ_LDFLAGS=`pkg-config --libs librabbitmq`
RABBITMQ_CPPFLAGS="-DUSE_AMQP" `pkg-config --cflags librabbitmq`
RABBITMQ_FILE="service_internal_amqp.o"
ZOOFPM_FILE="zoo_loader_fpm"
RELY_ON_DB="-DRELY_ON_DB"
AC_SUBST([RELY_ON_DB])
fi
AC_SUBST([RABBITMQ_LDFLAGS])
AC_SUBST([RABBITMQ_CPPFLAGS])
AC_SUBST([RABBITMQ_FILE])
AC_SUBST([ZOOFPM_FILE])
#============================================================================
# Detect if openssl is available
#============================================================================
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl=PATH], [Specifies an alternative location for the openssl library])],
[OPENSSL_DIR="$withval"], [OPENSSL_DIR="/usr/"])
OPENSSL_CFLAGS="-I$OPENSSL_DIR/include"
OPENSSL_LDFLAGS="-lcrypto -L$OPENSSL_DIR/lib -lssl"
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$OPENSSL_CFLAGS"
LIBS_SAVE="$LIBS"
LIBS="$OPENSSL_LDFLAGS"
AC_CHECK_HEADERS([openssl/md5.h openssl/hmac.h openssl/evp.h openssl/bio.h openssl/buffer.h],
[], [AC_MSG_ERROR([could not find header file $i related to openssl])])
AC_CHECK_LIB(crypto, BIO_f_base64,
[], [AC_MSG_ERROR([could not find $i function in openssl library])])
CPPFLAGS="$CPPFLAGS_SAVE"
AC_SUBST([OPENSSL_CFLAGS])
AC_SUBST([OPENSSL_LDFLAGS])
#============================================================================
# Detect if gettext is available
#============================================================================
#AC_ARG_WITH([gettext],
# [AS_HELP_STRING([--with-gettext=PATH], [Specifies an alternative location for the openssl library])],
# [GETTEXT_DIR="$withval"], [GETTEXT_DIR="/usr/"])
#GETTEXT_CFLAGS="-I$GETTEXT_DIR/include"
#GETTEXT_LDFLAGS="-L$GETTEXT_DIR/lib -lintl"
#CFLAGS_SAVE="$CFLAGS"
#CFLAGS="$GETTEXT_CFLAGS"
#LIBS_SAVE="$LIBS"
#LIBS="$GETTEXT_LDFLAGS"
#AM_GNU_GETTEXT([external], [], [])
#AC_CHECK_LIB(intl,
# [dgettext], [] , [AC_MSG_ERROR([could not find $i function in gettext library])])
#AC_SUBST([GETTEXT_CFLAGS])
#AC_SUBST([GETTEXT_LDFLAGS])
#============================================================================
# Detect if run on debian / ubuntu
#============================================================================
if test -f "/usr/bin/dpkg"
then
DEB_DEF=-DDEB
fi
AC_SUBST([DEB_DEF])
AC_ARG_WITH([etc-dir],
[AS_HELP_STRING([--with-etc-dir=PATH], [Specifies an alternative path to store the main.cfg file ( default: ZOO-Kernel location) ])],
[ETC_DEF="#define ETC_DIR \\\"${sysconfdir}\\\""], [ETC_DEF=""])
AC_SUBST([ETC_DEF])
AC_ARG_WITH([cgi-dir],
[AS_HELP_STRING([--with-cgi-dir=PATH], [Specifies an alternative cgi directory path ( default: /usr/lib/cgi-bin) ])],
[CGI_DIR="$withval"], [CGI_DIR="/usr/lib/cgi-bin"])
AC_SUBST([CGI_DIR])
AC_ARG_WITH([db-backend],
[AS_HELP_STRING([--with-db-backend], [Relies on a database for storing status messages and response files ])],
[RELY_ON_DB="-DRELY_ON_DB"], [RELY_ON_DB=""])
AC_SUBST([RELY_ON_DB])
# ===========================================================================
# Detect if libyaml is available
# ===========================================================================
AC_ARG_WITH([yaml],
[AS_HELP_STRING([--with-yaml=PATH], [Specifies an alternative location for the yaml library])],
[YAMLPATH="$withval"], [YAMLPATH=""])
if test -z "$YAMLPATH"
then
YAML_LDFLAGS=""
YAML_CPPFLAGS=""
YAML_FILE=""
YAML_FILE1=""
else
# Extract the linker and include flags
YAML_LDFLAGS="-L$YAMLPATH/lib -lyaml"
YAML_CPPFLAGS="-I$YAMLPATH/include -DYAML"
YAML_FILE="service_yaml.o"
YAML_FILE1="zcfg2yaml"
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$YAML_CPPFLAGS"
LIBS_SAVE="$LIBS"
LIBS="$YAML_LDFLAGS"
AC_CHECK_LIB([yaml], [yaml_parser_initialize,yaml_parser_set_input_file,yaml_parser_scan])
AC_CHECK_HEADERS([yaml.h],
[], [AC_MSG_ERROR([could not find headers include related to YAML])])
LIBS="$LIBS_SAVE"
fi
AC_SUBST([YAML_CPPFLAGS])
AC_SUBST([YAML_LDFLAGS])
AC_SUBST([YAML_FILE])
AC_SUBST([YAML_FILE1])
# ===========================================================================
# Detect if fastcgi is available
# ===========================================================================
AC_ARG_WITH([fastcgi],
[AS_HELP_STRING([--with-fastcgi=PATH], [Specifies an alternative location for the fastcgi library])],
[FCGIPATH="$withval"], [FCGIPATH="/usr"])
# Extract the linker and include flags
FCGI_LDFLAGS="-L$FCGIPATH/lib -lfcgi"
FCGI_CPPFLAGS="-I$FCGIPATH/include"
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$FCGI_CPPFLAGS"
LIBS_SAVE="$LIBS"
LIBS="$FCGI_LDFLAGS"
AC_CHECK_LIB([fcgi], [main])
AC_CHECK_HEADERS([fcgi_stdio.h],
[], [AC_MSG_ERROR([could not find headers include related to fastcgi])])
LIBS="$LIBS_SAVE"
AC_SUBST([FCGI_CPPFLAGS])
AC_SUBST([FCGI_LDFLAGS])
AC_ARG_WITH([dru],
[AS_HELP_STRING([--with-dru=yes], [Activates the metadata database support])],
[WITHDRU="$withval"], [WITHDRU=""])
if test "x$WITHDRU" = "xyes"; then
DRU_ENABLED="-DDRU_ENABLED"
else
DRU_ENABLED=""
fi
AC_SUBST([DRU_ENABLED])
AC_ARG_WITH([metadb],
[AS_HELP_STRING([--with-metadb=yes], [Activates the metadata database support])],
[WITHMETADB="$withval"], [WITHMETADB=""])
if test "x$WITHMETADB" = "xyes"; then
METADB="-DMETA_DB"
METADB_FILE="meta_sql.o sqlapi.o"
else
METADB=""
METADB_FILE=""
fi
AC_SUBST([METADB])
AC_SUBST([METADB_FILE])
AC_ARG_WITH([hpc],
[AS_HELP_STRING([--with-hpc=yes], [Specifies if you need to activate HPC support])],
[HPCWITH="$withval"], [HPCWITH="no"])
AC_ARG_WITH([ssh2],
[AS_HELP_STRING([--with-ssh2=PATH], [Specifies an alternative location for the ssh2 library])],
[SSH2PATH="$withval"], [SSH2PATH="/usr"])
if test "x$HPCWITH" = "xyes"; then
HPC_FILES="service_internal_hpc.o sshapi.o"
HPC_ENABLED="-DUSE_HPC"
HPC_CPPFLAGS=""
HPC_LDFLAGS=""
# Extract the linker and include flags
SSH2_LDFLAGS="-L$SSH2PATH/lib -lssh2"
SSH2_CPPFLAGS="-I$SSH2PATH/include"
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$SSH2_CPPFLAGS"
LIBS_SAVE="$LIBS"
LIBS="$SSH2_LDFLAGS"
AC_CHECK_HEADERS([libssh2.h],
[], [AC_MSG_ERROR([could not find headers related to libssh2])])
AC_CHECK_LIB([ssh2], [libssh2_session_init])
LIBS="$LIBS_SAVE"
fi
AC_SUBST([HPC_CPPFLAGS])
AC_SUBST([HPC_LDFLAGS])
AC_SUBST([HPC_ENABLED])
AC_SUBST([HPC_FILES])
AC_SUBST([SSH2_CPPFLAGS])
AC_SUBST([SSH2_LDFLAGS])
# ===========================================================================
# Detect if libxml2 is installed
# ===========================================================================
AC_ARG_WITH([xml2config],
[AS_HELP_STRING([--with-xml2config=FILE], [Specifies an alternative xml2-config file])],
[XML2CONFIG="$withval"], [XML2CONFIG=""])
if test "x$XML2CONFIG" = "x"; then
# XML2CONFIG was not specified, so search within the current path
AC_PATH_PROG([XML2CONFIG], [xml2-config])
# If we couldn't find xml2-config, display a warning
if test "x$XML2CONFIG" = "x"; then
AC_MSG_ERROR([could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter.])
fi
else
# XML2CONFIG was specified; display a message to the user
if test "x$XML2CONFIG" = "xyes"; then
AC_MSG_ERROR([you must Specifies a parameter to --with-xml2config, e.g. --with-xml2config=/path/to/xml2-config])
else
if test -f $XML2CONFIG; then
AC_MSG_RESULT([Using user-specified xml2-config file: $XML2CONFIG])
else
AC_MSG_ERROR([the user-specified xml2-config file $XML2CONFIG does not exist])
fi
fi
fi
# Extract the linker and include flags
XML2_LDFLAGS=`$XML2CONFIG --libs`
XML2_CPPFLAGS=`$XML2CONFIG --cflags`
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$XML2_CPPFLAGS"
AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h],
[], [AC_MSG_ERROR([could not find headers include related to libxml2])])
# Ensure we can link against libxml2
LIBS_SAVE="$LIBS"
LIBS="$XML2_LDFLAGS"
AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], [])
AC_SUBST([XML2_CPPFLAGS])
AC_SUBST([XML2_LDFLAGS])
LIBS="$LIBS_SAVE"
# ===========================================================================
# Detect if libxslt is installed
# ===========================================================================
AC_ARG_WITH([xsltconfig],
[AS_HELP_STRING([--with-xsltconfig=FILE], [Specifies an alternative xslt-config file])],
[XSLTCONFIG="$withval"], [XSLTCONFIG=""])
if test "x$XSLTCONFIG" = "x"; then
# XSLTCONFIG was not specified, so search within the current path
AC_PATH_PROG([XSLTCONFIG], [xslt-config])
# If we couldn't find xslt-config, display a warning
if test "x$XSLTCONFIG" = "x"; then
AC_MSG_ERROR([could not find xslt-config from libxslt within the current path. You may need to try re-running configure with a --with-xtltconfig parameter.])
fi
else
# XSLTCONFIG was specified; display a message to the user
if test "x$XSLTCONFIG" = "xyes"; then
AC_MSG_ERROR([you must Specifies a parameter to --with-xsltconfig, e.g. --with-xsltconfig=/path/to/xslt-config])
else
if test -f $XSLTCONFIG; then
AC_MSG_RESULT([Using user-specified xslt-config file: $XSLTCONFIG])
else
AC_MSG_ERROR([the user-specified xslt-config file $XSLTCONFIG does not exist])
fi
fi
fi
# Extract the linker and include flags
XSLT_LDFLAGS=`$XSLTCONFIG --libs`
XSLT_CPPFLAGS=`$XSLTCONFIG --cflags`
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$XSLT_CPPFLAGS"
AC_CHECK_HEADERS([libxslt/xslt.h libxslt/xsltInternals.h libxslt/transform.h libxslt/xsltutils.h],
[], [AC_MSG_ERROR([could not find headers include related to libxlst])])
AC_SUBST([XSLT_CPPFLAGS])
AC_SUBST([XSLT_LDFLAGS])
#============================================================================
# Detect if gdal is installed
#============================================================================
AC_ARG_WITH([gdal-config],
[AS_HELP_STRING([--with-gdal-config=FILE], [Specifies an alternative gdal-config file])],
[GDAL_CONFIG="$withval"], [GDAL_CONFIG=""])
if test -z $GDAL_CONFIG;
then
AC_PATH_PROG([GDAL_CONFIG], [gdal-config])
if test -z $GDAL_CONFIG;
then
AC_MSG_ERROR([could not find gdal-config from libgdal within the current path. You may need to try re-running configure with a --with-gdal-config parameter.])
fi
else
if test -f $GDAL_CONFIG; then
AC_MSG_RESULT([Using user-specified gdal-config file: $GDAL_CONFIG])
else
AC_MSG_ERROR([the user-specified gdal-config file $GDAL_CONFIG does not exist])
fi
fi
GDAL_CFLAGS="`$GDAL_CONFIG --cflags`"
GDAL_LIBS="`$GDAL_CONFIG --libs`"
AC_SUBST([GDAL_CFLAGS])
AC_SUBST([GDAL_LIBS])
# ===========================================================================
# Detect if proj is installed
# ===========================================================================
AC_ARG_WITH([proj],
[AS_HELP_STRING([--with-proj=PATH], [Specifies an alternative location for PROJ4 setup])],
[PROJPATH="$withval"], [PROJPATH="/usr"])
# Extract the linker and include flags
if test -f $PROJPATH/include/proj_api.h ; then
PJ_FULL_VERSION="$(grep 'define PJ_VERSION' /usr/include/proj_api.h | awk {'print $3'})"
PROJ_MAJOR_VERSION="$(echo ${PJ_FULL_VERSION:0:1})"
PROJ_VERSION="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H -DPROJ_VERSION_MAJOR=${PROJ_MAJOR_VERSION}"
else
PROJ_MAJOR_VERSION="$(grep "define PROJ_VERSION_MAJOR" -rni $PROJPATH/include/proj.h | awk {'print $3'})"
PROJ_VERSION="-DPROJ_VERSION_MAJOR=${PROJ_MAJOR_VERSION}"
fi
PROJ_CPPFLAGS="-I$PROJPATH/include ${PROJ_VERSION}"
PROJ_LDFLAGS="-L$PROJPATH/lib"
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$PROJ_CPPFLAGS"
AC_SUBST([PROJ_CPPFLAGS])
AC_SUBST([PROJ_LDFLAGS])
# ===========================================================================
# Detect if libgeos is installed
# ===========================================================================
AC_ARG_WITH([geosconfig],
[AS_HELP_STRING([--with-geosconfig=FILE], [Specifies an alternative geos-config file])],
[GEOSCONFIG="$withval"], [GEOSCONFIG=""])
if test "x$GEOSCONFIG" = "x"; then
# GEOSCONFIG was not specified, so search within the current path
AC_PATH_PROG([GEOSCONFIG], [geos-config])
# If we couldn't find geos-config, display a warning
if test "x$GEOSCONFIG" = "x"; then
AC_MSG_WARN([could not find geos-config from libgeos within the current path. You may need to try re-running configure with a --with-geosconfig parameter.])
fi
else
# GEOSCONFIG was specified; display a message to the user
if test "x$GEOSCONFIG" = "xyes"; then
AC_MSG_WARN([you must Specifies a parameter to --with-geosconfig, e.g. --with-geosconfig=/path/to/geos-config])
else
if test -f $GEOSCONFIG; then
AC_MSG_RESULT([Using user-specified geos-config file: $GEOSCONFIG])
else
AC_MSG_ERROR([the user-specified geos-config file $GEOSCONFIG does not exist])
fi
fi
fi
GEOS_LDFLAGS=`$GEOSCONFIG --clibs`
GEOS_CPPFLAGS=`$GEOSCONFIG --cflags`
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$GEOS_CPPFLAGS"
AC_CHECK_HEADERS([geos_c.h],
[], [AC_MSG_WARN([could not find headers include related to libgeos])])
AC_SUBST([GEOS_CPPFLAGS])
AC_SUBST([GEOS_LDFLAGS])
# ===========================================================================
# Detect if cgal is installed
# ===========================================================================
AC_ARG_WITH([cgal],
[AS_HELP_STRING([--with-cgal=PATH], [Specifies an alternative location for CGAL setup])],
[CGALPATH="$withval"], [CGALPATH="/usr"])
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CGAL_CPPFLAGS="-I$CGALPATH/include"
CPPFLAGS="$CGAL_CPPFLAGS"
AC_CHECK_HEADERS([CGAL/Delaunay_triangulation_2.h],
[], [AC_MSG_WARN([could not find headers include related to libCGAL])])
# Extract the linker and include flags
CGAL_LDFLAGS="-L$CGALPATH/lib"
CGAL_CPPFLAGS="-I$CGALPATH/include"
AC_SUBST([CGAL_CPPFLAGS])
AC_SUBST([CGAL_LDFLAGS])
#============================================================================
# Detect if mapserver is installed
#============================================================================
AC_ARG_WITH([mapserver],
[AS_HELP_STRING([--with-mapserver=PATH], [Specifies the path for MapServer compiled source tree])],
[MS_SRC_PATH="$withval"], [MS_SRC_PATH=""])
AC_ARG_WITH([ms-version],
[AS_HELP_STRING([--with-ms-version=VERSION], [Specifies the MapServer version to build against])],
[MS_VERSION="$withval"], [MS_VERSION=""])
AC_ARG_WITH([ms-force-linkage],
[AS_HELP_STRING([--with-ms-force-linkage=yes], [Specifies if the MapServer version should be force linked])],
[MS_FORCE_LINKAGE="$withval"], [MS_FORCE_LINKAGE=""])
if test -z $MS_SRC_PATH;
then
MS_CPPFLAGS=""
MS_LDFLAGS=""
else
if test "x$MS_SRC_PATH" = "xmacos";
then
MS_LDFLAGS="/Library/Frameworks/MapServer.framework//Versions/6.0/MapServer -lintl"
MS_CPPFLAGS="-DUSE_MS `/Library/Frameworks/MapServer.framework/Programs/mapserver-config --includes` -I/Library/Frameworks/MapServer.framework/Versions/Current/Headers/ -I../mapserver "
AC_MSG_WARN([Please make sure that ../mapserver exists and contains MapServer source tree])
AC_MSG_RESULT([Using MacOS X Framework for MapServer])
else
if test "x$MS_VERSION" = "x7";
then
MS_LDFLAGS="-L$MS_SRC_PATH/lib -lmapserver"
if test "x$MS_FORCE_LINKAGE" = "xyes";
then
MS_LDFLAGS="$MS_LDFLAGS -Wl,-rpath,$MS_SRC_PATH/lib/"
fi
MS_CPPFLAGS="-DUSE_MS -I$MS_SRC_PATH/include/mapserver "
AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
else
if test -d $MS_SRC_PATH; then
MS_LDFLAGS="-L$MS_SRC_PATH -lmapserver `$MS_SRC_PATH/mapserver-config --libs`"
MS_CPPFLAGS="-DUSE_MS `$MS_SRC_PATH/mapserver-config --includes` `$MS_SRC_PATH/mapserver-config --cflags` -I$MS_SRC_PATH "
AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH])
else
AC_MSG_ERROR([the user-specified mapserver-config file $MS_SRC_PATH does not exist])
fi
fi
fi
MS_FILE="service_internal_ms.o"
fi
MS_CFLAGS="$MS_CPPFLAGS"
MS_LIBS="$MS_LDFLAGS"
AC_SUBST([MS_CFLAGS])
AC_SUBST([MS_LIBS])
AC_SUBST([MS_FILE])
AC_SUBST([MS_VERSION])
# ===========================================================================
# Detect if R is installed
# ===========================================================================
AC_ARG_WITH([r],
[AS_HELP_STRING([--with-r=PATH], [To enable R support or Specifies an alternative directory for R installation, disabled by default])],
[R_PATH="$withval"; R_ENABLED="-DUSE_R"], [R_ENABLED=""])
if test -z "$R_ENABLED"
then
R_FILE=""
else
R_FILE="service_internal_r.o"
# Extract the linker and include flags
R_LDFLAGS="-L$R_PATH/lib/ -lR"
R_CPPFLAGS="-I$R_PATH/include/ -I$R_PATH/share/R/include/"
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$R_CPPFLAGS"
AC_CHECK_HEADERS([Rinternals.h],
[], [AC_MSG_ERROR([could not find headers include related to R])])
# Ensure we can link against libphp
#LIBS_SAVE="$LIBS"
#LIBS="$R_LDFLAGS"
#AC_CHECK_LIB([$LIBS], [R_tryEval], [], [AC_MSG_ERROR([could not find libR])], [])
#LIBS="$LIBS_SAVE"
fi
AC_SUBST([R_CPPFLAGS])
AC_SUBST([R_LDFLAGS])
AC_SUBST([R_ENABLED])
AC_SUBST([R_FILE])
# ===========================================================================
# Detect if python is installed
# ===========================================================================
AC_ARG_WITH([python],
[AS_HELP_STRING([--with-python=PATH], [To enable python support or Specifies an alternative directory for python installation, disabled by default])],
[PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""])
AC_ARG_WITH([pyvers],
[AS_HELP_STRING([--with-pyvers=NUM], [To use a specific python version])],
[PYTHON_VERS="$withval"], [PYTHON_VERS=""])
if test -z "$PYTHON_ENABLED"
then
PYTHON_FILE=""
else
PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
PYTHON_FILE="service_internal_python.o"
if test "$PYTHON_PATH" = "yes"
then
# PYTHON was not specified, so search within the current path
PYTHONCFG_PATH=`which python${PYTHON_VERS}-config`
if test -z "${PYTHONCFG_PATH}" ; then
AC_PATH_PROG([PYTHONCONFIG], [python-config-${PYTHON_VERS}])
else
AC_PATH_PROG([PYTHONCONFIG], [python${PYTHON_VERS}-config])
fi
else
PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config"
fi
echo $PYTHONCONFIG
# Extract the linker and include flags
#PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
PYTHON_LDFLAGS=$($PYTHONCONFIG --ldflags | sed "s:python${PYTHON_VERS}/config-${PYTHON_VERS}-::g")
PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes`
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$PYTHON_CPPFLAGS"
AC_CHECK_HEADERS([Python.h],
[], [AC_MSG_ERROR([could not find headers include related to libpython])])
# Ensure we can link against libphp
LIBS_SAVE="$LIBS"
#LIBS="$PYTHON_LDFLAGS"
#PY_LIB=`$PYTHONCONFIG --libs | sed \
# -e 's/.*\(python[[0-9]]\.[[0-9]]\).*/\1/'`
#AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
LIBS="m $PYTHON_LDFLAGS -lpython${PYTHON_VERS}"
PYTHON_LDFLAGS="-l$LIBS"
LDFLAGS=$PYTHON_LDFLAGS
AC_CHECK_LIB([], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
LIBS="$LIBS_SAVE"
fi
AC_SUBST([PYTHON_CPPFLAGS])
AC_SUBST([PYTHON_LDFLAGS])
AC_SUBST([PYTHON_ENABLED])
AC_SUBST([PYTHON_FILE])
# ===========================================================================
# Detect if spidermonkey is installed
# ===========================================================================
AC_ARG_WITH([js],
[AS_HELP_STRING([--with-js=PATH], [Specifies --with-js=path-to-js to enable js support, specify --with-js on linux debian like, js support is disabled by default ])],
[JSHOME="$withval";JS_ENABLED="-DUSE_JS"], [JS_ENABLED=""])
if test -z "$JS_ENABLED"
then
JS_FILE=""
else
JS_FILE="service_internal_js.o"
if test "$JSHOME" = "yes"
then
#on teste si on est sous debian like
if test -f "/usr/bin/dpkg"
then
if test -n "`dpkg -l | grep libmozjs185-dev`"
then
JS_CPPFLAGS="-I/usr/include/js/"
JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm"
JS_LIB="mozjs185"
else
XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | head -1| awk '{print $3;}' | cut -d'+' -f1`"
if test -n "$XUL_VERSION"
then
JS_CPPFLAGS="-I/usr/include/xulrunner-$XUL_VERSION"
JS_LDFLAGS="-L/usr/lib/xulrunner-$XUL_VERSION -lmozjs -lm"
JS_LIB="mozjs"
else
AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ])
fi
fi
else
AC_MSG_ERROR([You must specify your custom install of libmozjs185])
fi
else
JS_CPPFLAGS="-I$JSHOME/include/js/"
JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm"
JS_LIB="mozjs185"
fi
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$JS_CPPFLAGS"
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([jsapi.h],
[], [AC_MSG_ERROR([could not find headers include related to libjs])])
AC_LANG_POP([C++])
LIBS_SAVE="$LIBS"
LIBS="$JS_LDFLAGS"
AC_CHECK_LIB([$JS_LIB], [JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], [])
LIBS="$LIBS_SAVE"
AC_SUBST([JS_CPPFLAGS])
AC_SUBST([JS_LDFLAGS])
fi
AC_SUBST([JS_ENABLED])
AC_SUBST([JS_FILE])
# ===========================================================================
# Detect if libnode is installed
# ===========================================================================
AC_ARG_WITH([nodejs],
[AS_HELP_STRING([--with-nodejs=PATH], [Specifies --with-libnode=path-to-libnode to enable Node.js support, specify --with-libnode on linux debian like, Node.js support is disabled by default ])],
[NODEJS_HOME="$withval";NODEJS_ENABLED="-DUSE_NODEJS"], [NODEJS_ENABLED=""])
if test -z "$NODEJS_ENABLED"
then
NODEJS_FILE=""
else
AC_LANG_PUSH([C++])
NODEJS_FILE="service_internal_nodejs.o"
if test "$NODEJS_HOME" = "yes"
then
NODEJS_HOME=/usr
NODEJS_CPPFLAGS="`pkg-config --cflags node` `pkg-config --cflags node-addon-api`"
NODEJS_LDFLAGS=`pkg-config --libs node`
else
NODEJS_CPPFLAGS="-I$NODEJS_HOME/include/libnode/ -I$NODEJS_HOME/include/node/"
NODEJS_LDFLAGS="-L$NODEJS_HOME/lib -lnode -lm"
fi
NODEJS_LIB="node"
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$NODEJS_CPPFLAGS"
AC_CHECK_HEADERS([node.h],
[], [AC_MSG_ERROR([could not find headers include related to libnode])])
AC_CHECK_HEADERS([napi.h],
[], [AC_MSG_ERROR([could not find headers include related to node-addon-api])])
LIBS_SAVE="$LIBS"
LIBS="$NODEJS_LDFLAGS"
AC_CHECK_LIB([$NODEJS_LIB], [napi_create_environment],
[], [AC_MSG_ERROR([could not find $NODEJS_LIB])], [])
LIBS="$LIBS_SAVE"
AC_LANG_POP([C++])
AC_SUBST([NODEJS_CPPFLAGS])
AC_SUBST([NODEJS_LDFLAGS])
fi
AC_SUBST([NODEJS_ENABLED])
AC_SUBST([NODEJS_FILE])
# ===========================================================================
# Detect if php is installed
# ===========================================================================
AC_ARG_WITH([php],
[AS_HELP_STRING([--with-php=PATH], [To enable php support or specify an alternative directory for php installation, disabled by default])],
[PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""])
AC_ARG_WITH([php-version],
[AS_HELP_STRING([--with-phpvers=NUM], [To use a specific php version])],
[PHP_VERS="$withval"], [PHP_VERS=""])
if test -z "$PHP_ENABLED"
then
PHP_FILE=""
else
PHPCONFIG="$PHP_PATH/bin/php-config"
if test "x$PHP_VERS" = "x7"
then
PHP_FILE="service_internal_php7.o"
else
PHP_FILE="service_internal_php.o"
fi
if test "$PHP_PATH" = "yes"
then
# PHP was not specified, so search within the current path
AC_PATH_PROG([PHPCONFIG], [php-config])
else
PHPCONFIG="$PHP_PATH/bin/php-config"
fi
# Extract the linker and include flags
if test "x$PHP_VERS" = "x7"
then
PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib64 -lphp7"
else
PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5"
fi
PHP_CPPFLAGS=`$PHPCONFIG --includes`
# Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$PHP_CPPFLAGS"
AC_CHECK_HEADERS([sapi/embed/php_embed.h],
[], [AC_MSG_ERROR([could not find headers include related to libphp])])
# Ensure we can link against libphp
LIBS_SAVE="$LIBS"
LIBS="$PHP_LDFLAGS"
# Shouldn't we get php here rather than php5 :) ??
if test "x$PHP_VERS" = "x7"
then
echo $LIBS
#AC_CHECK_LIB([php7], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
else
AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], [])
fi
LIBS="$LIBS_SAVE"
AC_SUBST([PHP_CPPFLAGS])
AC_SUBST([PHP_LDFLAGS])
fi
AC_SUBST([PHP_ENABLED])
AC_SUBST([PHP_FILE])
# ===========================================================================
# Detect if java is installed
# ===========================================================================
AC_ARG_WITH([java],
[AS_HELP_STRING([--with-java=PATH], [To enable java support, specify a JDK_HOME, disabled by default])],
[JDKHOME="$withval"; JAVA_ENABLED="-DUSE_JAVA"], [JAVA_ENABLED=""])
AC_ARG_WITH([java-rpath],
[AS_HELP_STRING([--with-java-rpath=yes], [To set rpath for java support, disabled by default])],
[JAVA_RPATH="$withval"], [JAVA_RPATH=""])
if test -z "$JAVA_ENABLED"
then
JAVA_FILE=""
else
JAVA_FILE="service_internal_java.o"
if test "x$JDKHOME" = "x";
then
AC_MSG_ERROR([could not find java installation path within the current path. You may need to try re-running configure with a --with-java parameter.])
fi # JAVA was specified; display a message to the user
if test "x$JDKHOME" = "xyes";
then
AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java])
fi
# Extract the linker and include flags
if test "x$JDKHOME" = "xmacos";
then
JAVA_LDFLAGS="-framework JavaVM"
for i in `ls /Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/`; do
JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/$i/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/"
done
else
if test -d "$JDKHOME/jre/lib/i386";
then
JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/server/ -ljvm -lpthread"
JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
if test x$JAVA_RPATH = "xyes"; then
JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/i386/server/"
fi
else
if test -d "$JDKHOME/jre/lib/amd64"; then
JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/server/ -ljvm -lpthread"
JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux"
if test x$JAVA_RPATH = "xyes"; then
JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/amd64/server/"
fi
else
JAVA_LDFLAGS="-L$JDKHOME/jre/lib/server/ -ljvm -lpthread"
JAVA_CPPFLAGS="-I$JDKHOME/include/ -I$JDKHOME/include/darwin"
if test x$JAVA_RPATH = "xyes"; then
JAVA_LDFLAGS="$JAVA_LDFLAGS -Wl,-rpath,$JDKHOME/jre/lib/server/"
fi
fi
fi
fi
AC_LANG([C++])
#echo $JAVA_CPPFLAGS
# Check headers file (second time we check that in fact)
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$JAVA_CPPFLAGS"
AC_CHECK_HEADERS([jni.h],
[], [AC_MSG_ERROR([could not find jni.h file])])
CPPFLAGS="$CPPFLAGS_SAVE"
# Ensure we can link against libjava
LIBS_SAVE="$LIBS"
LIBS="$JAVA_LDFLAGS"
if test "x$JDKHOME" != "xmacos";
then
AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjvm])], [])
fi
LIBS="$LIBS_SAVE"
AC_SUBST([JAVA_CPPFLAGS])
AC_SUBST([JAVA_LDFLAGS])
fi
AC_SUBST([JAVA_ENABLED])
AC_SUBST([JAVA_FILE])
# ===========================================================================
# Detect if mono is installed
# ===========================================================================
AC_ARG_WITH([mono],
[AS_HELP_STRING([--with-mono=PATH], [To enable mono support, specify the path to find pkg-config, disabled by default])],
[MONOHOME="$withval"; MONO_ENABLED="-DUSE_MONO"], [MONO_ENABLED=""])
if test -z "$MONO_ENABLED"
then
MONO_FILE=""
else
MONO_FILE="service_internal_mono.o"
if test "x$MONOHOME" = "x";
then
MONOHOME="/usr"
fi
if test "x$MONOHOME" = "xyes";
then
MONOHOME="/usr"
fi
# Extract the linker and include flags
MONO_CFLAGS=`$MONOHOME/bin/pkg-config --cflags mono-2`
MONO_LDFLAGS=`$MONOHOME/bin/pkg-config --libs mono-2`
AC_LANG([C++])
#echo $JAVA_CPPFLAGS
# Check headers file (second time we check that in fact)
CPPFLAGS_SAVE="$CFLAGS"
CPPFLAGS="$MONO_CFLAGS"
AC_CHECK_HEADERS([mono/jit/jit.h],
[], [AC_MSG_ERROR([could not find jit.h file])])
CPPFLAGS="$CPPFLAGS_SAVE"
# Ensure we can link against libmono-2.0
LIBS_SAVE="$LIBS"
LIBS="$MONO_LDFLAGS"
AC_CHECK_LIB([mono-2.0], [mono_runtime_invoke], [], [AC_MSG_ERROR([could not find libmono])], [])
LIBS="$LIBS_SAVE"